##// 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
15
42
16 echo b1 > b1
43 rebase b onto r1
17 hg ci -Amb1 -d '0 0'
44
18 echo b2 > b2
45 $ hg transplant -a -b tip
19 hg ci -Amb2 -d '1 0'
46 applying 37a1297eb21b
20 echo b3 > b3
47 37a1297eb21b transplanted to e234d668f844
21 hg ci -Amb3 -d '2 0'
48 applying 722f4667af76
49 722f4667af76 transplanted to 539f377d78df
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
24
66
25 hg clone . ../rebase
67 $ hg up -C 1
26 cd ../rebase
68 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
69
70 rebase b onto r1, skipping b2
27
71
28 hg up -C 1
72 $ hg transplant -a -b tip -p 3
29 echo '% rebase b onto r1'
73 applying 37a1297eb21b
30 hg transplant -a -b tip
74 37a1297eb21b transplanted to e234d668f844
31 hg log --template '{rev} {parents} {desc}\n'
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
32
85
33 hg clone ../t ../prune
86
34 cd ../prune
87 remote transplant
35
88
36 hg up -C 1
89 $ hg clone -r 1 ../t ../remote
37 echo '% rebase b onto r1, skipping b2'
90 requesting all changes
38 hg transplant -a -b tip -p 3
91 adding changesets
39 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
40
111
41 echo '% remote transplant'
112 skip previous transplants
42 hg clone -r 1 ../t ../remote
113
43 cd ../remote
114 $ hg transplant -s ../t -a -b 4
44 hg transplant --log -s ../t 2 4
115 searching for changes
45 hg log --template '{rev} {parents} {desc}\n'
116 applying 722f4667af76
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
46
128
47 echo '% skip previous transplants'
129 $ echo b4 > b4
48 hg transplant -s ../t -a -b 4
130 $ hg ci -Amb4 -d '3 0'
49 hg log --template '{rev} {parents} {desc}\n'
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
141
142 remote transplant with pull
143
144 $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
145 $ cat ../t.pid >> $DAEMON_PIDS
50
146
51 echo '% skip local changes transplanted to the source'
147 $ hg clone -r 0 ../t ../rp
52 echo b4 > b4
148 requesting all changes
53 hg ci -Amb4 -d '3 0'
149 adding changesets
54 hg clone ../t ../pullback
150 adding manifests
55 cd ../pullback
151 adding file changes
56 hg transplant -s ../remote -a -b tip
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
57
169
58 echo '% remote transplant with pull'
170 transplant --continue
59 hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
60 cat ../t.pid >> $DAEMON_PIDS
61
62 hg clone -r 0 ../t ../rp
63 cd ../rp
64 hg transplant -s http://localhost:$HGPORT/ 2 4
65 hg log --template '{rev} {parents} {desc}\n'
66
171
67 echo '% transplant --continue'
172 $ hg init ../tc
68 hg init ../tc
173 $ cd ../tc
69 cd ../tc
174 $ cat <<EOF > foo
70 cat <<EOF > foo
175 > foo
71 foo
176 > bar
72 bar
177 > baz
73 baz
178 > EOF
74 EOF
179 $ echo toremove > toremove
75 echo toremove > toremove
180 $ hg ci -Amfoo
76 hg ci -Amfoo
181 adding foo
77 cat <<EOF > foo
182 adding toremove
78 foo2
183 $ cat <<EOF > foo
79 bar2
184 > foo2
80 baz2
185 > bar2
81 EOF
186 > baz2
82 rm toremove
187 > EOF
83 echo added > added
188 $ rm toremove
84 hg ci -Amfoo2
189 $ echo added > added
85 echo bar > bar
190 $ hg ci -Amfoo2
86 hg ci -Ambar
191 adding added
87 echo bar2 >> bar
192 removing toremove
88 hg ci -mbar2
193 $ echo bar > bar
89 hg up 0
194 $ hg ci -Ambar
90 echo foobar > foo
195 adding bar
91 hg ci -mfoobar
196 $ echo bar2 >> bar
92 hg transplant 1:3
197 $ hg ci -mbar2
93 # transplant -c shouldn't use an old changeset
198 $ hg up 0
94 hg up -C
199 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
95 rm added
200 $ echo foobar > foo
96 hg transplant 1
201 $ hg ci -mfoobar
97 hg transplant --continue
202 created new head
98 hg transplant 1:3
203 $ hg transplant 1:3
99 hg locate
204 applying a1e30dd1b8e7
100 cd ..
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
210
211 transplant -c shouldn't use an old changeset
212
213 $ hg up -C
214 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
215 $ rm added
216 $ hg transplant 1
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
233 bar
234 foo
235 $ cd ..
236
237 Test transplant --merge (issue 1111)
238 test transplant merge
239
240 $ hg init t1111
241 $ cd t1111
242 $ echo a > a
243 $ hg ci -Am adda
244 adding a
245 $ echo b >> a
246 $ hg ci -m appendb
247 $ echo c >> a
248 $ hg ci -m appendc
249 $ hg up -C 0
250 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
251 $ echo d >> a
252 $ hg ci -m appendd
253 created new head
254
255 tranplant
256
257 $ hg transplant -m 1
258 applying 42dc4432fd35
259 1:42dc4432fd35 merged at a9f4acbac129
260 $ cd ..
101
261
102 # Test transplant --merge (issue 1111)
262 test transplant into empty repository
103 echo % test transplant merge
263
104 hg init t1111
264 $ hg init empty
105 cd t1111
265 $ cd empty
106 echo a > a
266 $ hg transplant -s ../t -b tip -a
107 hg ci -Am adda
267 requesting all changes
108 echo b >> a
268 adding changesets
109 hg ci -m appendb
269 adding manifests
110 echo c >> a
270 adding file changes
111 hg ci -m appendc
271 added 4 changesets with 4 changes to 4 files
112 hg up -C 0
272 $ cd ..
113 echo d >> a
273
114 hg ci -m appendd
274
115 echo % tranplant
275 test filter
116 hg transplant -m 1
117 cd ..
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 ..
304
305
306 test filter with failed patch
124
307
125 echo '% test filter'
308 $ cd filter
126 hg init filter
309 $ hg up 0
127 cd filter
310 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
128 cat <<'EOF' >test-filter
311 $ echo foo > b1
129 #!/bin/sh
312 $ hg ci -d '0 0' -Am foo
130 sed 's/r1/r2/' $1 > $1.new
313 adding b1
131 mv $1.new $1
314 adding test-filter
132 EOF
315 created new head
133 chmod +x test-filter
316 $ hg transplant 1 --filter ./test-filter
134 hg transplant -s ../t -b tip -a --filter ./test-filter |\
317 filtering .*
135 sed 's/filtering.*/filtering/g'
318 applying 348b36d0b6a5
136 hg log --template '{rev} {parents} {desc}\n'
319 file b1 already exists
137 cd ..
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)
138
327
139 echo '% test filter with failed patch'
328 $ hg init twin1
140 cd filter
329 $ cd twin1
141 hg up 0
330 $ echo a > a
142 echo foo > b1
331 $ echo b > b
143 hg ci -d '0 0' -Am foo
332 $ echo b >> b
144 hg transplant 1 --filter ./test-filter |\
333 $ hg ci -Am t
145 sed 's/filtering.*/filtering/g'
334 adding a
146 cd ..
335 adding b
336 $ echo a > b
337 $ echo b >> b
338 $ hg ci -m changeb
339 $ cd ..
147
340
148 echo '% test with a win32ext like setup (differing EOLs)'
341 $ hg init twin2
149 hg init twin1
342 $ cd twin2
150 cd twin1
343 $ echo '[patch]' >> .hg/hgrc
151 echo a > a
344 $ echo 'eol = crlf' >> .hg/hgrc
152 echo b > b
345 $ python -c "file('b', 'wb').write('b\r\nb\r\n')"
153 echo b >> b
346 $ hg ci -m addb
154 hg ci -Am t
347 nothing changed
155 echo a > b
348 $ hg transplant -s ../twin1 tip
156 echo b >> b
349 applying 2e849d776c17
157 hg ci -m changeb
350 2e849d776c17 transplanted to 589cea8ba85b
158 cd ..
351 $ python -c "print repr(file('b', 'rb').read())"
159
352 'a\r\nb\r\n'
160 hg init twin2
353 $ cd ..
161 cd twin2
162 echo '[patch]' >> .hg/hgrc
163 echo 'eol = crlf' >> .hg/hgrc
164 python -c "file('b', 'wb').write('b\r\nb\r\n')"
165 hg ci -m addb
166 hg transplant -s ../twin1 tip
167 python -c "print repr(file('b', 'rb').read())"
168 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