1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/sh
# Copyright (C) 2004 Aaron Bentley
#
# See the file "COPYING" for further information about
# the copyright and warranty status of this work.
. "$abadir/aba-lib"
cmd_exec()
{
if [ $1 = "--undo" ]; then
undo="--undo"
shift
fi
undofile="$(dirname $1)/,,revert-undo.$(basename $1)"
if [ -n "$undo" ]; then
if [ ! -f "$undofile" ]; then
echo "No revert undo file for $1. Are you sure you reverted it?"
exit 1
fi
aba_break_link $1
if patch $1 < $undofile; then
rm $undofile
fi
else
if [ -f $undofile ]; then
echo "You already have a file named $undofile. Please do something with it. (or did you mean file-revert --undo $1?)"
exit 1
fi
# if tla file-diffs $1 > $undofile; then
aba_break_link $1
tla file-diffs $1 $2> $undofile
patch -R $1< $undofile
# else
# echo Error encountered reverting file
# if [ -f $undofile ]; then
# cat $undofile
# rm $undofile
# fi
# fi
fi
}
cmd_desc()
{
echo ' file-revert : Reverts changes since last or specified revision'
}
cmd_help()
{
echo "Usage: file-revert [--undo] file [revision]"
}
cmd_ext_help()
{
echo ""
}
aba_run "$@"
# arch-tag: file-revert by Aaron Bentley (07:57 Feb 03, 2004)
|