Follow upstream changes -- rest
[git-darcs-import.git] / tests / pull_compl.sh
blob6dd669801efbcd1644b610cfa6c2f17cbff5d412
1 #!/usr/bin/env bash
3 # This test script is in the public domain.
5 set -ev
7 rm -rf temp1 temp2 temp3 temp4 temp5
9 mkdir temp1
10 cd temp1
11 cat > foo <<EOF
12 line1
13 line2
14 line3
15 line4
16 line5
17 line6
18 line7
19 EOF
20 darcs initialize
21 darcs add foo
22 darcs record -a -m addfoo
24 cd ..
25 darcs get temp1 temp4
27 chgrec () {
28 set -ev
29 perl -i~ -pe "$1" foo
30 darcs record -a --ignore-times -m "$2"
33 cd temp1
34 chgrec 's/line2/line2\nline2.1\nline2.2/' inssub2
35 chgrec 's/line4/Line 4/' Line4
37 darcs changes | grep ' \*'
38 echo done with changes on temp1 > /dev/null
40 cd ..
41 darcs get temp1 temp2
42 darcs get temp1 temp3
43 cd temp1
45 chgrec 's/line1/line0\nline1/' line0
46 chgrec 's/Line 4/LINE FOUR/' LINE4
47 chgrec 's/line7/line7\nLastLine/' LastLine
48 chgrec 's/LINE FOUR/LINE FOUR\nline4.1/' line4.1
50 darcs changes | grep ' \*'
51 echo done with changes on temp1 > /dev/null
53 cd ../temp3
54 darcs pull -p LastLine -av
55 chgrec 's/line1$/FirstLine/' FirstLine
57 cd ../temp4
59 darcs changes | grep ' \*'
60 echo done with changes on temp4 > /dev/null
62 darcs pull ../temp1 --dry-run | grep ' \*'
63 darcs pull ../temp1 --dry-run | grep ' \*' > p1.out
64 cat > p1.req <<EOF
65 * inssub2
66 * Line4
67 * line0
68 * LINE4
69 * LastLine
70 * line4.1
71 EOF
72 diff p1.req p1.out
74 darcs pull ../temp1 --dry-run --complement | grep ' \*' > p2.out
75 diff p1.out p2.out
77 darcs pull --dry-run --complement ../temp1 ../temp2 | grep ' \*' > p3.out
78 cat > p3.req <<EOF
79 * line0
80 * LastLine
81 EOF
82 diff p3.req p3.out
84 darcs pull --dry-run --complement ../temp1 ../temp3 | grep ' \*' > p4.out
85 cat > p4.req <<EOF
86 * line0
87 EOF
88 diff p3.req p3.out
90 darcs pull --dry-run --complement ../temp1 ../temp2 ../temp3 | grep ' \*' > p5.out
91 diff p4.out p5.out
93 darcs pull --dry-run --complement ../temp1 ../temp2 ../temp3 ../temp2 ../temp2 ../temp3 ../temp3 ../temp2 | grep ' \*' > p6.out
94 diff p4.out p6.out
96 darcs pull --dry-run --complement ../temp3 ../temp2 | grep ' \*' > p7.out
97 cat > p7.req <<EOF
98 * LastLine
99 EOF
101 darcs pull --dry-run --complement ../temp2 ../temp3 > p8.out
102 grep "No remote changes to pull in!" p8.out
104 # because duplicates are stripped before performing action,
105 # this is the same as: darcs pull ../temp1
106 darcs pull --dry-run --complement ../temp1 ../temp1 > fooout
107 cat fooout
108 grep ' \*' fooout > p9.out
109 diff p1.req p9.out
111 # so the "null" pull must be tested this way:
112 darcs get ../temp1 ../temp5
113 darcs pull --dry-run --complement ../temp1 ../temp5 > p9.out
114 grep "No remote changes to pull in!" p9.out
116 darcs pull -av --complement ../temp1 ../temp3
117 darcs check
119 cd ..
120 rm -rf temp1 temp2 temp3 temp4 temp5