update readmes
[git-darcs-import.git] / tests / revert_interactive.sh
blob52126096e67aa26c113c443c21b2abc8fce77058
1 #!/usr/bin/env bash
2 set -ev
4 rm -rf temp1
5 mkdir temp1
6 cd temp1
7 darcs init
8 echo hello world > foo
9 darcs add foo
10 darcs record -a -m add -A x
11 echo goodbye world >> foo
12 echo y/y | tr / \\012 | darcs revert
13 darcs show contents foo | cmp foo -
15 # Now let's test a trickier revert where changes commute nontrivially.
17 cat > foo <<EOF
23 EOF
25 darcs record -a -A me -m cleanup
27 mv foo foo.tmp
28 cat foo.tmp | grep -v b | grep -v d > foo
30 echo "nyy" | darcs revert
32 DARCS_DONT_COLOR=1 darcs wh > whatsnew
33 cat > correct <<EOF
34 hunk ./foo 2
36 EOF
37 diff -c correct whatsnew
39 # Try a situation where earlier (kept) changes are depended upon by the
40 # changes we want to revert:
42 darcs record -a -A me -m cleanup
44 echo hello world > bar
45 echo hello world > foo
46 darcs add bar
47 darcs replace hello goodbye bar foo
49 echo "cnnnyy/y" | tr / \\012 | darcs revert
51 DARCS_DONT_COLOR=1 darcs wh > whatsnew
52 cat > correct <<EOF
53 addfile ./bar
54 hunk ./bar 1
55 +goodbye world
56 hunk ./foo 1
61 +hello world
62 EOF
63 diff -c correct whatsnew
65 cd ..
66 rm -rf temp1