##// END OF EJS Templates
tests: unify test-transplant
Nicolas Dumazet -
r11800:88c3ff05 default
parent child Browse files
Show More
@@ -1,168 +1,353 b''
1 #!/bin/sh
1 $ cat <<EOF >> $HGRCPATH
2 > [extensions]
3 > transplant=
4 > EOF
2
5
3 cat <<EOF >> $HGRCPATH
6 $ hg init t
4 [extensions]
7 $ cd t
5 transplant=
8 $ echo r1 > r1
6 EOF
9 $ hg ci -Amr1 -d'0 0'
10 adding r1
11 $ echo r2 > r2
12 $ hg ci -Amr2 -d'1 0'
13 adding r2
14 $ hg up 0
15 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
7
16
8 hg init t
17 $ echo b1 > b1
9 cd t
18 $ hg ci -Amb1 -d '0 0'
10 echo r1 > r1
19 adding b1
11 hg ci -Amr1 -d'0 0'
20 created new head
12 echo r2 > r2
21 $ echo b2 > b2
13 hg ci -Amr2 -d'1 0'
22 $ hg ci -Amb2 -d '1 0'
14 hg up 0
23 adding b2
24 $ echo b3 > b3
25 $ hg ci -Amb3 -d '2 0'
26 adding b3
27
28 $ hg log --template '{rev} {parents} {desc}\n'
29 4 b3
30 3 b2
31 2 0:17ab29e464c6 b1
32 1 r2
33 0 r1
34
35 $ hg clone . ../rebase
36 updating to branch default
37 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 $ cd ../rebase
39
40 $ hg up -C 1
41 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
42
43 rebase b onto r1
15
44
16 echo b1 > b1
45 $ hg transplant -a -b tip
17 hg ci -Amb1 -d '0 0'
46 applying 37a1297eb21b
18 echo b2 > b2
47 37a1297eb21b transplanted to e234d668f844
19 hg ci -Amb2 -d '1 0'
48 applying 722f4667af76
20 echo b3 > b3
49 722f4667af76 transplanted to 539f377d78df
21 hg ci -Amb3 -d '2 0'
50 applying a53251cdf717
51 a53251cdf717 transplanted to ffd6818a3975
52 $ hg log --template '{rev} {parents} {desc}\n'
53 7 b3
54 6 b2
55 5 1:d11e3596cc1a b1
56 4 b3
57 3 b2
58 2 0:17ab29e464c6 b1
59 1 r2
60 0 r1
22
61
23 hg log --template '{rev} {parents} {desc}\n'
62 $ hg clone ../t ../prune
63 updating to branch default
64 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 $ cd ../prune
66
67 $ hg up -C 1
68 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
69
70 rebase b onto r1, skipping b2
24
71
25 hg clone . ../rebase
72 $ hg transplant -a -b tip -p 3
26 cd ../rebase
73 applying 37a1297eb21b
74 37a1297eb21b transplanted to e234d668f844
75 applying a53251cdf717
76 a53251cdf717 transplanted to 7275fda4d04f
77 $ hg log --template '{rev} {parents} {desc}\n'
78 6 b3
79 5 1:d11e3596cc1a b1
80 4 b3
81 3 b2
82 2 0:17ab29e464c6 b1
83 1 r2
84 0 r1
85
86
87 remote transplant
27
88
28 hg up -C 1
89 $ hg clone -r 1 ../t ../remote
29 echo '% rebase b onto r1'
90 requesting all changes
30 hg transplant -a -b tip
91 adding changesets
31 hg log --template '{rev} {parents} {desc}\n'
92 adding manifests
93 adding file changes
94 added 2 changesets with 2 changes to 2 files
95 updating to branch default
96 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 $ cd ../remote
98 $ hg transplant --log -s ../t 2 4
99 searching for changes
100 applying 37a1297eb21b
101 37a1297eb21b transplanted to c19cf0ccb069
102 applying a53251cdf717
103 a53251cdf717 transplanted to f7fe5bf98525
104 $ hg log --template '{rev} {parents} {desc}\n'
105 3 b3
106 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
107 2 b1
108 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
109 1 r2
110 0 r1
32
111
33 hg clone ../t ../prune
112 skip previous transplants
34 cd ../prune
35
113
36 hg up -C 1
114 $ hg transplant -s ../t -a -b 4
37 echo '% rebase b onto r1, skipping b2'
115 searching for changes
38 hg transplant -a -b tip -p 3
116 applying 722f4667af76
39 hg log --template '{rev} {parents} {desc}\n'
117 722f4667af76 transplanted to 47156cd86c0b
118 $ hg log --template '{rev} {parents} {desc}\n'
119 4 b2
120 3 b3
121 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
122 2 b1
123 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
124 1 r2
125 0 r1
126
127 skip local changes transplanted to the source
128
129 $ echo b4 > b4
130 $ hg ci -Amb4 -d '3 0'
131 adding b4
132 $ hg clone ../t ../pullback
133 updating to branch default
134 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 $ cd ../pullback
136 $ hg transplant -s ../remote -a -b tip
137 searching for changes
138 applying 4333daefcb15
139 4333daefcb15 transplanted to 5f42c04e07cc
140
40
141
41 echo '% remote transplant'
142 remote transplant with pull
42 hg clone -r 1 ../t ../remote
143
43 cd ../remote
144 $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
44 hg transplant --log -s ../t 2 4
145 $ cat ../t.pid >> $DAEMON_PIDS
45 hg log --template '{rev} {parents} {desc}\n'
46
146
47 echo '% skip previous transplants'
147 $ hg clone -r 0 ../t ../rp
48 hg transplant -s ../t -a -b 4
148 requesting all changes
49 hg log --template '{rev} {parents} {desc}\n'
149 adding changesets
150 adding manifests
151 adding file changes
152 added 1 changesets with 1 changes to 1 files
153 updating to branch default
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 $ cd ../rp
156 $ hg transplant -s http://localhost:$HGPORT/ 2 4
157 searching for changes
158 searching for changes
159 adding changesets
160 adding manifests
161 adding file changes
162 added 1 changesets with 1 changes to 1 files
163 applying a53251cdf717
164 a53251cdf717 transplanted to 8d9279348abb
165 $ hg log --template '{rev} {parents} {desc}\n'
166 2 b3
167 1 b1
168 0 r1
169
170 transplant --continue
50
171
51 echo '% skip local changes transplanted to the source'
172 $ hg init ../tc
52 echo b4 > b4
173 $ cd ../tc
53 hg ci -Amb4 -d '3 0'
174 $ cat <<EOF > foo
54 hg clone ../t ../pullback
175 > foo
55 cd ../pullback
176 > bar
56 hg transplant -s ../remote -a -b tip
177 > baz
57
178 > EOF
58 echo '% remote transplant with pull'
179 $ echo toremove > toremove
59 hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
180 $ hg ci -Amfoo
60 cat ../t.pid >> $DAEMON_PIDS
181 adding foo
182 adding toremove
183 $ cat <<EOF > foo
184 > foo2
185 > bar2
186 > baz2
187 > EOF
188 $ rm toremove
189 $ echo added > added
190 $ hg ci -Amfoo2
191 adding added
192 removing toremove
193 $ echo bar > bar
194 $ hg ci -Ambar
195 adding bar
196 $ echo bar2 >> bar
197 $ hg ci -mbar2
198 $ hg up 0
199 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
200 $ echo foobar > foo
201 $ hg ci -mfoobar
202 created new head
203 $ hg transplant 1:3
204 applying a1e30dd1b8e7
205 patching file foo
206 Hunk #1 FAILED at 0
207 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
208 patch failed to apply
209 abort: Fix up the merge and run hg transplant --continue
61
210
62 hg clone -r 0 ../t ../rp
211 transplant -c shouldn't use an old changeset
63 cd ../rp
64 hg transplant -s http://localhost:$HGPORT/ 2 4
65 hg log --template '{rev} {parents} {desc}\n'
66
212
67 echo '% transplant --continue'
213 $ hg up -C
68 hg init ../tc
214 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 cd ../tc
215 $ rm added
70 cat <<EOF > foo
216 $ hg transplant 1
71 foo
217 applying a1e30dd1b8e7
218 patching file foo
219 Hunk #1 FAILED at 0
220 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
221 patch failed to apply
222 abort: Fix up the merge and run hg transplant --continue
223 $ hg transplant --continue
224 a1e30dd1b8e7 transplanted as f1563cf27039
225 $ hg transplant 1:3
226 skipping already applied revision 1:a1e30dd1b8e7
227 applying 1739ac5f6139
228 1739ac5f6139 transplanted to d649c221319f
229 applying 0282d5fbbe02
230 0282d5fbbe02 transplanted to 77418277ccb3
231 $ hg locate
232 added
72 bar
233 bar
73 baz
234 foo
74 EOF
235 $ cd ..
75 echo toremove > toremove
236
76 hg ci -Amfoo
237 Test transplant --merge (issue 1111)
77 cat <<EOF > foo
238 test transplant merge
78 foo2
239
79 bar2
240 $ hg init t1111
80 baz2
241 $ cd t1111
81 EOF
242 $ echo a > a
82 rm toremove
243 $ hg ci -Am adda
83 echo added > added
244 adding a
84 hg ci -Amfoo2
245 $ echo b >> a
85 echo bar > bar
246 $ hg ci -m appendb
86 hg ci -Ambar
247 $ echo c >> a
87 echo bar2 >> bar
248 $ hg ci -m appendc
88 hg ci -mbar2
249 $ hg up -C 0
89 hg up 0
250 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 echo foobar > foo
251 $ echo d >> a
91 hg ci -mfoobar
252 $ hg ci -m appendd
92 hg transplant 1:3
253 created new head
93 # transplant -c shouldn't use an old changeset
94 hg up -C
95 rm added
96 hg transplant 1
97 hg transplant --continue
98 hg transplant 1:3
99 hg locate
100 cd ..
101
254
102 # Test transplant --merge (issue 1111)
255 tranplant
103 echo % test transplant merge
256
104 hg init t1111
257 $ hg transplant -m 1
105 cd t1111
258 applying 42dc4432fd35
106 echo a > a
259 1:42dc4432fd35 merged at a9f4acbac129
107 hg ci -Am adda
260 $ cd ..
108 echo b >> a
261
109 hg ci -m appendb
262 test transplant into empty repository
110 echo c >> a
263
111 hg ci -m appendc
264 $ hg init empty
112 hg up -C 0
265 $ cd empty
113 echo d >> a
266 $ hg transplant -s ../t -b tip -a
114 hg ci -m appendd
267 requesting all changes
115 echo % tranplant
268 adding changesets
116 hg transplant -m 1
269 adding manifests
117 cd ..
270 adding file changes
271 added 4 changesets with 4 changes to 4 files
272 $ cd ..
273
274
275 test filter
118
276
119 echo '% test transplant into empty repository'
277 $ hg init filter
120 hg init empty
278 $ cd filter
121 cd empty
279 $ cat <<'EOF' >test-filter
122 hg transplant -s ../t -b tip -a
280 > #!/bin/sh
123 cd ..
281 > sed 's/r1/r2/' $1 > $1.new
282 > mv $1.new $1
283 > EOF
284 $ chmod +x test-filter
285 $ hg transplant -s ../t -b tip -a --filter ./test-filter
286 filtering .*
287 applying 17ab29e464c6
288 17ab29e464c6 transplanted to e9ffc54ea104
289 filtering .*
290 applying 37a1297eb21b
291 37a1297eb21b transplanted to 348b36d0b6a5
292 filtering .*
293 applying 722f4667af76
294 722f4667af76 transplanted to 0aa6979afb95
295 filtering .*
296 applying a53251cdf717
297 a53251cdf717 transplanted to 14f8512272b5
298 $ hg log --template '{rev} {parents} {desc}\n'
299 3 b3
300 2 b2
301 1 b1
302 0 r2
303 $ cd ..
124
304
125 echo '% test filter'
305
126 hg init filter
306 test filter with failed patch
127 cd filter
128 cat <<'EOF' >test-filter
129 #!/bin/sh
130 sed 's/r1/r2/' $1 > $1.new
131 mv $1.new $1
132 EOF
133 chmod +x test-filter
134 hg transplant -s ../t -b tip -a --filter ./test-filter |\
135 sed 's/filtering.*/filtering/g'
136 hg log --template '{rev} {parents} {desc}\n'
137 cd ..
138
307
139 echo '% test filter with failed patch'
308 $ cd filter
140 cd filter
309 $ hg up 0
141 hg up 0
310 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
142 echo foo > b1
311 $ echo foo > b1
143 hg ci -d '0 0' -Am foo
312 $ hg ci -d '0 0' -Am foo
144 hg transplant 1 --filter ./test-filter |\
313 adding b1
145 sed 's/filtering.*/filtering/g'
314 adding test-filter
146 cd ..
315 created new head
316 $ hg transplant 1 --filter ./test-filter
317 filtering .*
318 applying 348b36d0b6a5
319 file b1 already exists
320 1 out of 1 hunks FAILED -- saving rejects to file b1.rej
321 patch failed to apply
322 abort: Fix up the merge and run hg transplant --continue
323 $ cd ..
324
325
326 test with a win32ext like setup (differing EOLs)
147
327
148 echo '% test with a win32ext like setup (differing EOLs)'
328 $ hg init twin1
149 hg init twin1
329 $ cd twin1
150 cd twin1
330 $ echo a > a
151 echo a > a
331 $ echo b > b
152 echo b > b
332 $ echo b >> b
153 echo b >> b
333 $ hg ci -Am t
154 hg ci -Am t
334 adding a
155 echo a > b
335 adding b
156 echo b >> b
336 $ echo a > b
157 hg ci -m changeb
337 $ echo b >> b
158 cd ..
338 $ hg ci -m changeb
339 $ cd ..
159
340
160 hg init twin2
341 $ hg init twin2
161 cd twin2
342 $ cd twin2
162 echo '[patch]' >> .hg/hgrc
343 $ echo '[patch]' >> .hg/hgrc
163 echo 'eol = crlf' >> .hg/hgrc
344 $ echo 'eol = crlf' >> .hg/hgrc
164 python -c "file('b', 'wb').write('b\r\nb\r\n')"
345 $ python -c "file('b', 'wb').write('b\r\nb\r\n')"
165 hg ci -m addb
346 $ hg ci -m addb
166 hg transplant -s ../twin1 tip
347 nothing changed
167 python -c "print repr(file('b', 'rb').read())"
348 $ hg transplant -s ../twin1 tip
168 cd ..
349 applying 2e849d776c17
350 2e849d776c17 transplanted to 589cea8ba85b
351 $ python -c "print repr(file('b', 'rb').read())"
352 'a\r\nb\r\n'
353 $ cd ..
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now