~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to fai/aba/commands/rev-depends

  • Committer: Robert Collins
  • Date: 2005-09-13 13:07:03 UTC
  • mto: (147.2.6) (364.1.3 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: robertc@robertcollins.net-20050913130702-f471ae9f2833a484
create the output directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
## Copyright (C) 2004 Aaron Bentley
 
3
##
 
4
## See the file "COPYING" for further information about
 
5
## the copyright and warranty status of this work.
 
6
 
 
7
. "$abadir/aba-lib"
 
8
 
 
9
# this command works by attempting to remove revisions.  Any revision that
 
10
# cannot be removed without producing conflicts is a dependency.
 
11
 
 
12
# executes the command ("$@" are the arguments after the command name)
 
13
cmd_exec()
 
14
{
 
15
  cd $abadir
 
16
  gooddir=$abadir/gooddir
 
17
  testdir=$abadir/testdir
 
18
  rm -Rf $gooddir
 
19
  rm -Rf $testdir
 
20
 
 
21
  version="$(tla parse-package-name -a $1)/$(tla parse-package-name --package-version $1)"
 
22
  supplied="$version--$(tla parse-package-name -l $1)"
 
23
 
 
24
  tla get $supplied $gooddir > /dev/null
 
25
  cp -a $gooddir testdir
 
26
 
 
27
  patches=$(tla logs --reverse --dir $gooddir)
 
28
  for patch in $patches;
 
29
  do
 
30
    revision="$version--$patch"
 
31
    if [ $revision = $supplied ]; then
 
32
#      echo "skipping:     $patch"
 
33
      echo -n
 
34
    elif tla replay --dir $testdir --reverse "$version--$patch" > /dev/null 2>/dev/null; then
 
35
#      echo "not required: $patch"
 
36
      tla replay --dir $gooddir --reverse "$version--$patch" > /dev/null;
 
37
    else
 
38
#      echo "required:     $patch"
 
39
      required="$required $patch"
 
40
      rm -Rf $testdir
 
41
      cp -a $gooddir testdir
 
42
    fi
 
43
  done
 
44
 
 
45
  rm -Rf $gooddir
 
46
  rm -Rf $testdir
 
47
#  echo Required revisions:
 
48
  oneperline $required|sort -t - -k 2 -n
 
49
}
 
50
 
 
51
oneperline()
 
52
{
 
53
  for l in $@; do
 
54
    echo $l
 
55
  done
 
56
}
 
57
 
 
58
# one-liner description for aba help
 
59
cmd_desc()
 
60
{
 
61
    aba_desc $(basename $0) "Determines a revision's dependencies"
 
62
}
 
63
 
 
64
# short help for aba command -h, --help
 
65
cmd_help()
 
66
{
 
67
    cat <<EOH
 
68
determines a revision's dependencies
 
69
usage: $abaname $(basename $0) revision
 
70
 
 
71
Determines the textual dependencies of a revision by removing everything which
 
72
can be removed without producing conflicts.
 
73
 
 
74
EOH
 
75
}
 
76
 
 
77
# extended help for aba command -H or aba help command
 
78
cmd_ext_help()
 
79
{
 
80
    cat <<EOH
 
81
The guarantee provided by this command is that list of patches can be applied
 
82
to the base revision without producing conflicts.  No guarantee can be provided
 
83
that the resulting tree is usable.
 
84
 
 
85
EOH
 
86
}       
 
87
 
 
88
aba_run "$@"
 
89
# arch-tag: rev-depends by Aaron Bentley  (16:53 Feb 15 2004)