File: revert.sh

package info (click to toggle)
darcs 2.18.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,008 kB
  • sloc: haskell: 47,748; sh: 13,466; ansic: 447; perl: 134; makefile: 6
file content (88 lines) | stat: -rw-r--r-- 1,261 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
. ./lib

rm -rf temp1
mkdir temp1
cd temp1
darcs init
echo hello world > foo
darcs add foo
darcs record -lam add
echo goodbye world >> foo
darcs revert -a
darcs show contents foo | cmp foo -

# Now let's test a trickier revert where changes commute nontrivially.

cat > foo <<EOF
a
b
c
d
e
EOF

darcs record -am cleanup

mv foo foo.tmp
cat foo.tmp | grep -v b | grep -v d > foo

echo "nyy" | darcs revert

darcs wh > whatsnew
cat > correct <<EOF
hunk ./foo 2
-b
EOF
diff -c correct whatsnew

# Try a situation where earlier (kept) changes are depended upon by the
# changes we want to revert:

darcs record -am cleanup

echo hello world > bar
echo hello world > foo
darcs add bar
darcs replace hello goodbye bar foo

# revert only the last of 4 changes which is the replace in ./foo
echo "nnnyy" | darcs revert

darcs wh > whatsnew
cat > correct <<EOF
addfile ./bar
hunk ./bar 1
+goodbye world
hunk ./foo 1
-a
-c
-d
-e
+hello world
EOF
diff -c correct whatsnew

cd ..
rm -rf temp1

# test for reverting removed directory

darcs init temp1
cd temp1
mkdir d
darcs add d
darcs record -lam 'add dir'
rmdir d
darcs revert -a d
cd ..
rm -rf temp1

# revert unrecorded add

darcs init temp1
cd temp1
echo stuff > foo
darcs add foo
darcs revert -a