Follow upstream changes -- rest
[git-darcs-import.git] / tests / nodeps.sh
blob24e153aa8d0cbc13c4dda86cbf5a652cbe76ee28
1 #!/usr/bin/env bash
2 set -ev
4 # Test the --no-deps option with Send, Push, Pull, Obliterate and Unrecord.
6 # Create four patches with dependencies.
7 # file 'f': patch 'fa' and 'fb'
8 # file 'g': patch 'ga' and 'gb'
9 # The 'b' patches depend on the 'a' patches.
11 rm -rf tmp1
12 mkdir tmp1
13 cd tmp1
14 darcs init
15 echo 'record no-ask-deps' >> _darcs/prefs/defaults
16 echo 'record ignore-times' >> _darcs/prefs/defaults
17 echo 'a' > f
18 darcs add f
19 darcs rec -am 'fa' f
20 echo 'a' > g
21 darcs add g
22 darcs rec -am 'ga' g
23 echo 'b' > f
24 darcs rec -am 'fb' f
25 echo 'b' > g
26 darcs rec -am 'gb' g
29 mkdir d
30 darcs init --repodir d
33 # Try to Send all 'b' and 'g' patches. The two 'g' patches should succeed,
34 # but the 'fb' patch depends on the unselected 'fa' patch, an should be
35 # skipped.
37 darcs send -o bundle -a -p '[bg]' --no-deps d
38 grep '^\[ga$' bundle
39 grep '^\[fb$' bundle && exit 1
42 # Try to Push all 'b' and 'g' patches. Expect same result as for Send.
44 darcs push -a -p '[bg]' --no-deps d
45 cd d
46 darcs changes | grep '^ \* ga$'
47 darcs changes | grep '^ \* fb$' && exit 1
48 # stay in d !!
51 # Try to Pull all 'b' and 'g' patches. Expect same result as for Send.
53 # already in d
54 rm -rf *; darcs init
55 darcs pull -a -p '[bg]' --no-deps ..
56 darcs changes | grep '^ \* ga$'
57 darcs changes | grep '^ \* fb$' && exit 1
58 cd ..
61 # Try to Obliterate all 'a' and 'g' patches. The two 'g' patches should
62 # succeed, but the 'fa' patch depends on the unselected 'fb' patch, an
63 # should be skipped.
65 darcs get . tmp; cd tmp
66 echo y/y/y/q | tr / \\012 | darcs obliterate -p '[ag]' --no-deps
67 darcs changes | grep '^ \* gb$' && exit 1
68 darcs changes | grep '^ \* fa$'
69 cd ..
72 # Try to Unrecord all 'a' and 'g' patches. Expect same result as for
73 # Obliterate.
75 # in "top" tmp repo -- destroys it!
76 echo y/y/y/q | tr / \\012 | darcs unrecord -p '[ag]' --no-deps
77 darcs changes | grep '^ \* gb$' && exit 1
78 darcs changes | grep '^ \* fa$'
80 cd ..
81 rm -rf tmp1