~abentley/bzrtools/bzrtools.dev

147.1.3 by Robert Collins
test and deliver basic pending-merges into bzr so that merging is recorded
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
cmd_exec()
9
{
10
  if [ $1 = "--undo" ]; then
11
    undo="--undo"
12
    shift
13
  fi
14
  undofile="$(dirname $1)/,,revert-undo.$(basename $1)"
15
  if [ -n "$undo" ]; then
16
    if [ ! -f "$undofile" ]; then
17
      echo "No revert undo file for $1.  Are you sure you reverted it?"
18
      exit 1
19
    fi
20
    aba_break_link $1
21
    if patch $1 < $undofile; then
22
      rm $undofile
23
    fi
24
  else
25
    if [ -f $undofile ]; then
26
      echo "You already have a file named $undofile.  Please do something with it.  (or did you mean file-revert --undo $1?)"
27
      exit 1
28
    fi
29
#    if tla file-diffs $1 > $undofile; then
30
     aba_break_link $1
31
     tla file-diffs $1 $2> $undofile
32
      patch -R $1< $undofile
33
#    else
34
#      echo Error encountered reverting file
35
#      if [ -f $undofile ]; then 
36
#        cat $undofile
37
#        rm $undofile
38
#      fi
39
#    fi
40
  fi
41
}
42
43
44
cmd_desc()
45
{
46
  echo '                 file-revert : Reverts changes since last or specified revision'
47
}
48
cmd_help()
49
{
50
  echo "Usage: file-revert [--undo] file [revision]"
51
}
52
cmd_ext_help()
53
{
54
  echo ""
55
}
56
aba_run "$@"
57
# arch-tag: file-revert by Aaron Bentley (07:57 Feb 03, 2004)