Find git executable at run time
[git-darcs-import.git] / tests / issue157_rollback_conflict.sh
blobed2b8f910459ffd9aa30770c3cf49843c2aebb4f
1 #!/usr/bin/env bash
2 set -ev
4 # issue157: A test for how rollback handles dependencies and conflicts.
6 not () { "$@" && exit 1 || :; }
8 rm -rf temp1 temp2
10 # set up the repository
11 mkdir temp1
12 cd temp1
13 darcs init --darcs-2
14 cd ..
16 # do some work here
17 cd temp1
18 echo a > foo
19 # Create three patches
20 darcs record -lam AA
21 echo b > foo
22 darcs record -lam BB
23 echo c > foo
24 darcs record -lam CC
25 # Rollback the last one
26 darcs rollback -a -p CC -m 'rollback CC'
27 grep b foo # reality check
28 cd ..
30 # Now get just the first two patches into a new repo...ignoring the third patch and the rollback.
31 darcs get --to-patch BB temp1 temp2
32 cd temp2
33 # Now in the second repo, rollback the second patch.
34 darcs rollback -a -p BB -m 'rollback BB'
35 grep a foo # reality check
36 # Finally, pull the third patch and the rollback of it.
37 # Because the two patches should cancel each other other, there should be no change here.
38 darcs pull -a ../temp1
39 # expect a conflict between the contents being 'a' or 'b'
40 grep "v v v" foo
41 grep a foo
42 grep b foo
43 cd ..
45 rm -rf temp1 temp2