Show More
@@ -1,918 +1,984 | |||
|
1 | 1 | #require killdaemons |
|
2 | 2 | |
|
3 | 3 | $ cat <<EOF >> $HGRCPATH |
|
4 | 4 | > [extensions] |
|
5 | 5 | > transplant= |
|
6 | 6 | > EOF |
|
7 | 7 | |
|
8 | 8 | $ hg init t |
|
9 | 9 | $ cd t |
|
10 | $ hg transplant | |
|
11 | abort: no source URL, branch revision, or revision list provided | |
|
12 | [255] | |
|
13 | $ hg transplant --continue --all | |
|
14 | abort: --continue is incompatible with --branch, --all and --merge | |
|
15 | [255] | |
|
16 | $ hg transplant --all tip | |
|
17 | abort: --all requires a branch revision | |
|
18 | [255] | |
|
19 | $ hg transplant --all --branch default tip | |
|
20 | abort: --all is incompatible with a revision list | |
|
21 | [255] | |
|
10 | 22 | $ echo r1 > r1 |
|
11 | 23 | $ hg ci -Amr1 -d'0 0' |
|
12 | 24 | adding r1 |
|
25 | $ hg co -q null | |
|
26 | $ hg transplant tip | |
|
27 | abort: no revision checked out | |
|
28 | [255] | |
|
29 | $ hg up -q | |
|
13 | 30 | $ echo r2 > r2 |
|
14 | 31 | $ hg ci -Amr2 -d'1 0' |
|
15 | 32 | adding r2 |
|
16 | 33 | $ hg up 0 |
|
17 | 34 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
18 | 35 | |
|
19 | 36 | $ echo b1 > b1 |
|
20 | 37 | $ hg ci -Amb1 -d '0 0' |
|
21 | 38 | adding b1 |
|
22 | 39 | created new head |
|
40 | $ hg merge 1 | |
|
41 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
42 | (branch merge, don't forget to commit) | |
|
43 | $ hg transplant 1 | |
|
44 | abort: outstanding uncommitted merges | |
|
45 | [255] | |
|
46 | $ hg up -qC tip | |
|
47 | $ echo b0 > b1 | |
|
48 | $ hg transplant 1 | |
|
49 | abort: outstanding local changes | |
|
50 | [255] | |
|
51 | $ hg up -qC tip | |
|
23 | 52 | $ echo b2 > b2 |
|
24 | 53 |
$ |
|
25 | 54 | adding b2 |
|
26 | 55 | $ echo b3 > b3 |
|
27 | 56 |
$ |
|
28 | 57 | adding b3 |
|
29 | 58 | |
|
30 | 59 |
|
|
31 | 60 | 4 b3 |
|
32 | 61 | 3 b2 |
|
33 | 62 | 2 0:17ab29e464c6 b1 |
|
34 | 63 | 1 r2 |
|
35 | 64 | 0 r1 |
|
36 | 65 | |
|
37 | 66 | $ hg clone . ../rebase |
|
38 | 67 | updating to branch default |
|
39 | 68 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
69 | $ hg init ../emptydest | |
|
70 | $ cd ../emptydest | |
|
71 | $ hg transplant --source=../t > /dev/null | |
|
40 | 72 | $ cd ../rebase |
|
41 | 73 | |
|
42 | 74 | $ hg up -C 1 |
|
43 | 75 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
44 | 76 | |
|
45 | 77 | rebase b onto r1 |
|
46 | 78 | (this also tests that editor is not invoked if '--edit' is not specified) |
|
47 | 79 | |
|
48 | 80 | $ HGEDITOR=cat hg transplant -a -b tip |
|
49 | 81 | applying 37a1297eb21b |
|
50 | 82 | 37a1297eb21b transplanted to e234d668f844 |
|
51 | 83 | applying 722f4667af76 |
|
52 | 84 | 722f4667af76 transplanted to 539f377d78df |
|
53 | 85 | applying a53251cdf717 |
|
54 | 86 | a53251cdf717 transplanted to ffd6818a3975 |
|
55 | 87 |
|
|
56 | 88 | 7 b3 |
|
57 | 89 | 6 b2 |
|
58 | 90 | 5 1:d11e3596cc1a b1 |
|
59 | 91 | 4 b3 |
|
60 | 92 | 3 b2 |
|
61 | 93 | 2 0:17ab29e464c6 b1 |
|
62 | 94 | 1 r2 |
|
63 | 95 | 0 r1 |
|
64 | 96 | |
|
65 | 97 | test transplanted revset |
|
66 | 98 | |
|
67 | 99 |
|
|
68 | 100 | 5 1:d11e3596cc1a b1 |
|
69 | 101 | 6 b2 |
|
70 | 102 | 7 b3 |
|
103 | $ hg log -r 'transplanted(head())' --template '{rev} {parents} {desc}\n' | |
|
104 | 7 b3 | |
|
71 | 105 | $ hg help revsets | grep transplanted |
|
72 | 106 | "transplanted([set])" |
|
73 | 107 | Transplanted changesets in set, or all transplanted changesets. |
|
74 | 108 | |
|
75 | 109 | test transplanted keyword |
|
76 | 110 | |
|
77 | 111 |
|
|
78 | 112 | 7 a53251cdf717679d1907b289f991534be05c997a |
|
79 | 113 | 6 722f4667af767100cb15b6a79324bf8abbfe1ef4 |
|
80 | 114 | 5 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21 |
|
81 | 115 | 4 |
|
82 | 116 | 3 |
|
83 | 117 | 2 |
|
84 | 118 | 1 |
|
85 | 119 | 0 |
|
86 | 120 | |
|
87 | 121 | test destination() revset predicate with a transplant of a transplant; new |
|
88 | 122 |
|
|
89 | 123 |
(this also tests that editor is invoked if '--edit |
|
90 | 124 | |
|
91 | 125 | $ hg clone -q . ../destination |
|
92 | 126 | $ cd ../destination |
|
93 | 127 | $ hg up -Cq 0 |
|
94 | 128 | $ hg branch -q b4 |
|
95 | 129 | $ hg ci -qm "b4" |
|
96 | 130 | $ hg status --rev "7^1" --rev 7 |
|
97 | 131 | A b3 |
|
98 | 132 | $ cat > $TESTTMP/checkeditform.sh <<EOF |
|
99 | 133 |
> env | grep |
|
100 | 134 | > true |
|
101 | 135 | > EOF |
|
102 | 136 |
$ |
|
103 | 137 |
> env | grep |
|
104 | 138 | > cat \$* |
|
105 | 139 | > EOF |
|
106 | 140 |
$ |
|
107 | 141 |
|
|
108 | 142 |
|
|
109 | 143 |
|
|
110 | 144 | |
|
111 | 145 | |
|
112 | 146 |
HG: |
|
113 | 147 |
HG: |
|
114 | 148 |
HG: |
|
115 | 149 |
HG: user: |
|
116 | 150 |
HG: |
|
117 | 151 |
HG: |
|
118 | 152 |
|
|
119 | 153 | |
|
120 | 154 | |
|
121 | 155 |
$ |
|
122 | 156 |
changeset: |
|
123 | 157 |
parent: |
|
124 | 158 |
user: |
|
125 | 159 |
date: |
|
126 | 160 |
summary: |
|
127 | 161 | |
|
128 | 162 |
changeset: |
|
129 | 163 |
user: |
|
130 | 164 |
date: |
|
131 | 165 |
summary: |
|
132 | 166 | |
|
133 | 167 |
changeset: |
|
134 | 168 |
user: |
|
135 | 169 |
date: |
|
136 | 170 |
summary: |
|
137 | 171 | |
|
138 | 172 |
changeset: |
|
139 | 173 |
branch: |
|
140 | 174 |
tag: |
|
141 | 175 |
user: |
|
142 | 176 |
date: |
|
143 | 177 |
summary: |
|
144 | 178 | |
|
145 | 179 |
$ hg |
|
146 | 180 |
changeset: |
|
147 | 181 |
user: |
|
148 | 182 |
date: |
|
149 | 183 |
summary: |
|
150 | 184 | |
|
151 | 185 |
changeset: |
|
152 | 186 |
branch: |
|
153 | 187 |
tag: |
|
154 | 188 |
user: |
|
155 | 189 |
date: |
|
156 | 190 |
summary: |
|
157 | 191 | |
|
158 | 192 | |
|
159 | 193 |
|
|
160 | 194 |
$ |
|
161 | 195 |
changeset: |
|
162 | 196 |
branch: |
|
163 | 197 |
tag: |
|
164 | 198 |
user: |
|
165 | 199 |
date: |
|
166 | 200 |
summary: |
|
167 | 201 | |
|
168 | 202 |
changeset: |
|
169 | 203 |
user: |
|
170 | 204 |
date: |
|
171 | 205 |
summary: |
|
172 | 206 | |
|
173 | 207 | |
|
174 | 208 |
|
|
175 | 209 |
$ |
|
176 | 210 | |
|
177 | 211 |
|
|
178 | 212 |
$ |
|
179 | 213 |
|
|
180 | 214 |
|
|
181 | 215 |
$ hg |
|
182 | 216 |
|
|
183 | 217 |
$ hg |
|
184 | 218 |
|
|
185 | 219 |
$ hg |
|
186 | 220 | ? b1 |
|
187 | 221 | ? b2 |
|
188 | 222 | ? b3 |
|
189 | 223 | |
|
190 | 224 | $ hg clone ../t ../prune |
|
191 | 225 |
updating |
|
192 | 226 |
|
|
193 | 227 |
$ |
|
194 | 228 | |
|
195 | 229 |
$ |
|
196 | 230 |
|
|
197 | 231 | |
|
198 | 232 |
|
|
199 | 233 | |
|
200 | 234 |
$ |
|
201 | 235 |
|
|
202 | 236 |
|
|
203 | 237 |
|
|
204 | 238 |
|
|
205 | 239 |
$ |
|
206 | 240 | 6 b3 |
|
207 | 241 | 5 1:d11e3596cc1a b1 |
|
208 | 242 | 4 b3 |
|
209 | 243 | 3 b2 |
|
210 | 244 | 2 0:17ab29e464c6 b1 |
|
211 | 245 | 1 r2 |
|
212 | 246 | 0 r1 |
|
213 | 247 | |
|
214 | 248 | test same-parent transplant with --log |
|
215 | 249 | |
|
216 | 250 | $ hg clone -r 1 ../t ../sameparent |
|
217 | 251 | adding changesets |
|
218 | 252 | adding manifests |
|
219 | 253 | adding file changes |
|
220 | 254 | added 2 changesets with 2 changes to 2 files |
|
221 | 255 | updating to branch default |
|
222 | 256 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
223 | 257 | $ cd ../sameparent |
|
224 | 258 | $ hg transplant --log -s ../prune 5 |
|
225 | 259 | searching for changes |
|
226 | 260 | applying e234d668f844 |
|
227 | 261 | e234d668f844 transplanted to e07aea8ecf9c |
|
228 | 262 | $ hg log --template '{rev} {parents} {desc}\n' |
|
229 | 263 | 2 b1 |
|
230 | 264 | (transplanted from e234d668f844e1b1a765f01db83a32c0c7bfa170) |
|
231 | 265 | 1 r2 |
|
232 | 266 | 0 r1 |
|
233 | 267 | remote transplant, and also test that transplant doesn't break with |
|
234 | 268 | format-breaking diffopts |
|
235 | 269 | |
|
236 | 270 | $ hg clone -r 1 ../t ../remote |
|
237 | 271 | adding changesets |
|
238 | 272 | adding manifests |
|
239 | 273 | adding file changes |
|
240 | 274 | added 2 changesets with 2 changes to 2 files |
|
241 | 275 | updating to branch default |
|
242 | 276 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
243 | 277 | $ cd ../remote |
|
244 | 278 | $ hg --config diff.noprefix=True transplant --log -s ../t 2 4 |
|
245 | 279 | searching for changes |
|
246 | 280 | applying 37a1297eb21b |
|
247 | 281 | 37a1297eb21b transplanted to c19cf0ccb069 |
|
248 | 282 | applying a53251cdf717 |
|
249 | 283 | a53251cdf717 transplanted to f7fe5bf98525 |
|
250 | 284 | $ hg log --template '{rev} {parents} {desc}\n' |
|
251 | 285 | 3 b3 |
|
252 | 286 | (transplanted from a53251cdf717679d1907b289f991534be05c997a) |
|
253 | 287 | 2 b1 |
|
254 | 288 | (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21) |
|
255 | 289 | 1 r2 |
|
256 | 290 | 0 r1 |
|
257 | 291 | |
|
258 | 292 | skip previous transplants |
|
259 | 293 | |
|
260 | 294 | $ hg transplant -s ../t -a -b 4 |
|
261 | 295 | searching for changes |
|
262 | 296 | applying 722f4667af76 |
|
263 | 297 | 722f4667af76 transplanted to 47156cd86c0b |
|
264 | 298 | $ hg log --template '{rev} {parents} {desc}\n' |
|
265 | 299 | 4 b2 |
|
266 | 300 | 3 b3 |
|
267 | 301 | (transplanted from a53251cdf717679d1907b289f991534be05c997a) |
|
268 | 302 | 2 b1 |
|
269 | 303 | (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21) |
|
270 | 304 | 1 r2 |
|
271 | 305 | 0 r1 |
|
272 | 306 | |
|
273 | 307 | skip local changes transplanted to the source |
|
274 | 308 | |
|
275 | 309 | $ echo b4 > b4 |
|
276 | 310 | $ hg ci -Amb4 -d '3 0' |
|
277 | 311 | adding b4 |
|
278 | 312 | $ hg clone ../t ../pullback |
|
279 | 313 | updating to branch default |
|
280 | 314 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
281 | 315 | $ cd ../pullback |
|
282 | 316 | $ hg transplant -s ../remote -a -b tip |
|
283 | 317 | searching for changes |
|
284 | 318 | applying 4333daefcb15 |
|
285 | 319 | 4333daefcb15 transplanted to 5f42c04e07cc |
|
286 | 320 | |
|
287 | 321 | |
|
288 | 322 | remote transplant with pull |
|
289 | 323 | |
|
290 | 324 | $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid |
|
291 | 325 | $ cat ../t.pid >> $DAEMON_PIDS |
|
292 | 326 | |
|
293 | 327 | $ hg clone -r 0 ../t ../rp |
|
294 | 328 | adding changesets |
|
295 | 329 | adding manifests |
|
296 | 330 | adding file changes |
|
297 | 331 | added 1 changesets with 1 changes to 1 files |
|
298 | 332 | updating to branch default |
|
299 | 333 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
300 | 334 | $ cd ../rp |
|
301 | 335 | $ hg transplant -s http://localhost:$HGPORT/ 37a1297eb21b a53251cdf717 |
|
302 | 336 | searching for changes |
|
303 | 337 | searching for changes |
|
304 | 338 | adding changesets |
|
305 | 339 | adding manifests |
|
306 | 340 | adding file changes |
|
307 | 341 | added 1 changesets with 1 changes to 1 files |
|
308 | 342 | applying a53251cdf717 |
|
309 | 343 | a53251cdf717 transplanted to 8d9279348abb |
|
310 | 344 | $ hg log --template '{rev} {parents} {desc}\n' |
|
311 | 345 | 2 b3 |
|
312 | 346 | 1 b1 |
|
313 | 347 | 0 r1 |
|
314 | 348 | |
|
315 | 349 | remote transplant without pull |
|
316 | 350 | (It was using "2" and "4" (as the previous transplant used to) which referenced |
|
317 | 351 | revision different from one run to another) |
|
318 | 352 | |
|
319 | 353 | $ hg pull -q http://localhost:$HGPORT/ |
|
320 | 354 | $ hg transplant -s http://localhost:$HGPORT/ 8d9279348abb 722f4667af76 |
|
321 | 355 | skipping already applied revision 2:8d9279348abb |
|
322 | 356 | applying 722f4667af76 |
|
323 | 357 | 722f4667af76 transplanted to 76e321915884 |
|
324 | 358 | |
|
325 | 359 | transplant --continue |
|
326 | 360 | |
|
327 | 361 | $ hg init ../tc |
|
328 | 362 | $ cd ../tc |
|
329 | 363 | $ cat <<EOF > foo |
|
330 | 364 | > foo |
|
331 | 365 | > bar |
|
332 | 366 | > baz |
|
333 | 367 | > EOF |
|
334 | 368 | $ echo toremove > toremove |
|
335 | 369 | $ echo baz > baz |
|
336 | 370 | $ hg ci -Amfoo |
|
337 | 371 | adding baz |
|
338 | 372 | adding foo |
|
339 | 373 | adding toremove |
|
340 | 374 | $ cat <<EOF > foo |
|
341 | 375 | > foo2 |
|
342 | 376 | > bar2 |
|
343 | 377 | > baz2 |
|
344 | 378 | > EOF |
|
345 | 379 | $ rm toremove |
|
346 | 380 | $ echo added > added |
|
347 | 381 | $ hg ci -Amfoo2 |
|
348 | 382 | adding added |
|
349 | 383 | removing toremove |
|
350 | 384 | $ echo bar > bar |
|
351 | 385 | $ cat > baz <<EOF |
|
352 | 386 | > before baz |
|
353 | 387 | > baz |
|
354 | 388 | > after baz |
|
355 | 389 | > EOF |
|
356 | 390 | $ hg ci -Ambar |
|
357 | 391 | adding bar |
|
358 | 392 | $ echo bar2 >> bar |
|
359 | 393 | $ hg ci -mbar2 |
|
360 | 394 | $ hg up 0 |
|
361 | 395 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
362 | 396 | $ echo foobar > foo |
|
363 | 397 | $ hg ci -mfoobar |
|
364 | 398 | created new head |
|
365 | 399 | $ hg transplant 1:3 |
|
366 | 400 | applying 46ae92138f3c |
|
367 | 401 | patching file foo |
|
368 | 402 | Hunk #1 FAILED at 0 |
|
369 | 403 | 1 out of 1 hunks FAILED -- saving rejects to file foo.rej |
|
370 | 404 | patch failed to apply |
|
371 | 405 | abort: fix up the merge and run hg transplant --continue |
|
372 | 406 | [255] |
|
373 | 407 | |
|
374 | 408 | transplant -c shouldn't use an old changeset |
|
375 | 409 | |
|
376 | 410 | $ hg up -C |
|
377 | 411 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
378 | 412 | $ rm added |
|
379 | 413 | $ hg transplant 1 |
|
380 | 414 | applying 46ae92138f3c |
|
381 | 415 | patching file foo |
|
382 | 416 | Hunk #1 FAILED at 0 |
|
383 | 417 | 1 out of 1 hunks FAILED -- saving rejects to file foo.rej |
|
384 | 418 | patch failed to apply |
|
385 | 419 | abort: fix up the merge and run hg transplant --continue |
|
386 | 420 | [255] |
|
421 | $ cp .hg/transplant/journal .hg/transplant/journal.orig | |
|
422 | $ cat .hg/transplant/journal | |
|
423 | # User test | |
|
424 | # Date 0 0 | |
|
425 | # Node ID 46ae92138f3ce0249f6789650403286ead052b6d | |
|
426 | # Parent e8643552fde58f57515e19c4b373a57c96e62af3 | |
|
427 | foo2 | |
|
428 | $ grep -v 'Date' .hg/transplant/journal.orig > .hg/transplant/journal | |
|
429 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e | |
|
430 | abort: filter corrupted changeset (no user or date) | |
|
431 | [255] | |
|
432 | $ cp .hg/transplant/journal.orig .hg/transplant/journal | |
|
387 | 433 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e |
|
388 | 434 | HGEDITFORM=transplant.normal |
|
389 | 435 | 46ae92138f3c transplanted as 9159dada197d |
|
390 | 436 | $ hg transplant 1:3 |
|
391 | 437 | skipping already applied revision 1:46ae92138f3c |
|
392 | 438 | applying 9d6d6b5a8275 |
|
393 | 439 | 9d6d6b5a8275 transplanted to 2d17a10c922f |
|
394 | 440 | applying 1dab759070cf |
|
395 | 441 | 1dab759070cf transplanted to e06a69927eb0 |
|
396 | 442 | $ hg locate |
|
397 | 443 | added |
|
398 | 444 | bar |
|
399 | 445 | baz |
|
400 | 446 | foo |
|
401 | 447 | |
|
402 | 448 | test multiple revisions and --continue |
|
403 | 449 | |
|
404 | 450 | $ hg up -qC 0 |
|
405 | 451 | $ echo bazbaz > baz |
|
406 | 452 | $ hg ci -Am anotherbaz baz |
|
407 | 453 | created new head |
|
408 | 454 | $ hg transplant 1:3 |
|
409 | 455 | applying 46ae92138f3c |
|
410 | 456 | 46ae92138f3c transplanted to 1024233ea0ba |
|
411 | 457 | applying 9d6d6b5a8275 |
|
412 | 458 | patching file baz |
|
413 | 459 | Hunk #1 FAILED at 0 |
|
414 | 460 | 1 out of 1 hunks FAILED -- saving rejects to file baz.rej |
|
415 | 461 | patch failed to apply |
|
416 | 462 | abort: fix up the merge and run hg transplant --continue |
|
417 | 463 | [255] |
|
418 | 464 | $ echo fixed > baz |
|
419 | 465 | $ hg transplant --continue |
|
420 | 466 | 9d6d6b5a8275 transplanted as d80c49962290 |
|
421 | 467 | applying 1dab759070cf |
|
422 | 468 | 1dab759070cf transplanted to aa0ffe6bd5ae |
|
423 | 469 | |
|
424 | 470 | $ cd .. |
|
425 | 471 | |
|
426 | 472 | Issue1111: Test transplant --merge |
|
427 | 473 | |
|
428 | 474 | $ hg init t1111 |
|
429 | 475 | $ cd t1111 |
|
430 | 476 | $ echo a > a |
|
431 | 477 | $ hg ci -Am adda |
|
432 | 478 | adding a |
|
433 | 479 | $ echo b >> a |
|
434 | 480 | $ hg ci -m appendb |
|
435 | 481 | $ echo c >> a |
|
436 | 482 | $ hg ci -m appendc |
|
437 | 483 | $ hg up -C 0 |
|
438 | 484 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
439 | 485 | $ echo d >> a |
|
440 | 486 | $ hg ci -m appendd |
|
441 | 487 | created new head |
|
442 | 488 | |
|
443 | 489 | transplant |
|
444 | 490 | |
|
445 | 491 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant -m 1 -e |
|
446 | 492 | applying 42dc4432fd35 |
|
447 | 493 | HGEDITFORM=transplant.merge |
|
448 | 494 | 1:42dc4432fd35 merged at a9f4acbac129 |
|
449 | 495 | $ hg update -q -C 2 |
|
450 | 496 | $ cat > a <<EOF |
|
451 | 497 | > x |
|
452 | 498 | > y |
|
453 | 499 | > z |
|
454 | 500 | > EOF |
|
455 | 501 | $ hg commit -m replace |
|
456 | 502 | $ hg update -q -C 4 |
|
457 | 503 | $ hg transplant -m 5 |
|
458 | 504 | applying 600a3cdcb41d |
|
459 | 505 | patching file a |
|
460 | 506 | Hunk #1 FAILED at 0 |
|
461 | 507 | 1 out of 1 hunks FAILED -- saving rejects to file a.rej |
|
462 | 508 | patch failed to apply |
|
463 | 509 | abort: fix up the merge and run hg transplant --continue |
|
464 | 510 | [255] |
|
465 | 511 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e |
|
466 | 512 | HGEDITFORM=transplant.merge |
|
467 | 513 | 600a3cdcb41d transplanted as a3f88be652e0 |
|
468 | 514 | |
|
469 | 515 | $ cd .. |
|
470 | 516 | |
|
471 | 517 | test transplant into empty repository |
|
472 | 518 | |
|
473 | 519 | $ hg init empty |
|
474 | 520 | $ cd empty |
|
475 | 521 | $ hg transplant -s ../t -b tip -a |
|
476 | 522 | adding changesets |
|
477 | 523 | adding manifests |
|
478 | 524 | adding file changes |
|
479 | 525 | added 4 changesets with 4 changes to 4 files |
|
480 | 526 | |
|
481 | 527 | test "--merge" causing pull from source repository on local host |
|
482 | 528 | |
|
483 | 529 | $ hg --config extensions.mq= -q strip 2 |
|
484 | 530 | $ hg transplant -s ../t --merge tip |
|
485 | 531 | searching for changes |
|
486 | 532 | searching for changes |
|
487 | 533 | adding changesets |
|
488 | 534 | adding manifests |
|
489 | 535 | adding file changes |
|
490 | 536 | added 2 changesets with 2 changes to 2 files |
|
491 | 537 | applying a53251cdf717 |
|
492 | 538 | 4:a53251cdf717 merged at 4831f4dc831a |
|
493 | 539 | |
|
494 | 540 | test interactive transplant |
|
495 | 541 | |
|
496 | 542 | $ hg --config extensions.strip= -q strip 0 |
|
497 | 543 | $ hg -R ../t log -G --template "{rev}:{node|short}" |
|
498 | 544 | @ 4:a53251cdf717 |
|
499 | 545 | | |
|
500 | 546 | o 3:722f4667af76 |
|
501 | 547 | | |
|
502 | 548 | o 2:37a1297eb21b |
|
503 | 549 | | |
|
504 | 550 | | o 1:d11e3596cc1a |
|
505 | 551 | |/ |
|
506 | 552 | o 0:17ab29e464c6 |
|
507 | 553 | |
|
508 | 554 | $ hg transplant -q --config ui.interactive=true -s ../t <<EOF |
|
555 | > ? | |
|
556 | > x | |
|
557 | > q | |
|
558 | > EOF | |
|
559 | 0:17ab29e464c6 | |
|
560 | apply changeset? [ynmpcq?]: ? | |
|
561 | y: yes, transplant this changeset | |
|
562 | n: no, skip this changeset | |
|
563 | m: merge at this changeset | |
|
564 | p: show patch | |
|
565 | c: commit selected changesets | |
|
566 | q: quit and cancel transplant | |
|
567 | ?: ? (show this help) | |
|
568 | apply changeset? [ynmpcq?]: x | |
|
569 | unrecognized response | |
|
570 | apply changeset? [ynmpcq?]: q | |
|
571 | $ hg transplant -q --config ui.interactive=true -s ../t <<EOF | |
|
509 | 572 | > p |
|
510 | 573 | > y |
|
511 | 574 | > n |
|
512 | 575 | > n |
|
513 | 576 | > m |
|
514 | 577 | > c |
|
515 | 578 | > EOF |
|
516 | 579 | 0:17ab29e464c6 |
|
517 | 580 | apply changeset? [ynmpcq?]: p |
|
518 | 581 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
519 | 582 | +++ b/r1 Thu Jan 01 00:00:00 1970 +0000 |
|
520 | 583 | @@ -0,0 +1,1 @@ |
|
521 | 584 | +r1 |
|
522 | 585 | apply changeset? [ynmpcq?]: y |
|
523 | 586 | 1:d11e3596cc1a |
|
524 | 587 | apply changeset? [ynmpcq?]: n |
|
525 | 588 | 2:37a1297eb21b |
|
526 | 589 | apply changeset? [ynmpcq?]: n |
|
527 | 590 | 3:722f4667af76 |
|
528 | 591 | apply changeset? [ynmpcq?]: m |
|
529 | 592 | 4:a53251cdf717 |
|
530 | 593 | apply changeset? [ynmpcq?]: c |
|
531 | 594 | $ hg log -G --template "{node|short}" |
|
532 | 595 | @ 88be5dde5260 |
|
533 | 596 | |\ |
|
534 | 597 | | o 722f4667af76 |
|
535 | 598 | | | |
|
536 | 599 | | o 37a1297eb21b |
|
537 | 600 | |/ |
|
538 | 601 | o 17ab29e464c6 |
|
539 | 602 | |
|
540 | 603 | $ hg transplant -q --config ui.interactive=true -s ../t <<EOF |
|
541 | 604 | > x |
|
542 | 605 | > ? |
|
543 | 606 | > y |
|
544 | 607 | > q |
|
545 | 608 | > EOF |
|
546 | 609 | 1:d11e3596cc1a |
|
547 | 610 | apply changeset? [ynmpcq?]: x |
|
548 | 611 | unrecognized response |
|
549 | 612 | apply changeset? [ynmpcq?]: ? |
|
550 | 613 | y: yes, transplant this changeset |
|
551 | 614 | n: no, skip this changeset |
|
552 | 615 | m: merge at this changeset |
|
553 | 616 | p: show patch |
|
554 | 617 | c: commit selected changesets |
|
555 | 618 | q: quit and cancel transplant |
|
556 | 619 | ?: ? (show this help) |
|
557 | 620 | apply changeset? [ynmpcq?]: y |
|
558 | 621 | 4:a53251cdf717 |
|
559 | 622 | apply changeset? [ynmpcq?]: q |
|
560 | 623 | $ hg heads --template "{node|short}\n" |
|
561 | 624 | 88be5dde5260 |
|
562 | 625 | |
|
563 | 626 | $ cd .. |
|
564 | 627 | |
|
565 | 628 | |
|
566 | 629 | #if unix-permissions system-sh |
|
567 | 630 | |
|
568 | 631 | test filter |
|
569 | 632 | |
|
570 | 633 | $ hg init filter |
|
571 | 634 | $ cd filter |
|
572 | 635 | $ cat <<'EOF' >test-filter |
|
573 | 636 | > #!/bin/sh |
|
574 | 637 | > sed 's/r1/r2/' $1 > $1.new |
|
575 | 638 | > mv $1.new $1 |
|
576 | 639 | > EOF |
|
577 | 640 | $ chmod +x test-filter |
|
578 | 641 | $ hg transplant -s ../t -b tip -a --filter ./test-filter |
|
579 | 642 | filtering * (glob) |
|
580 | 643 | applying 17ab29e464c6 |
|
581 | 644 | 17ab29e464c6 transplanted to e9ffc54ea104 |
|
582 | 645 | filtering * (glob) |
|
583 | 646 | applying 37a1297eb21b |
|
584 | 647 | 37a1297eb21b transplanted to 348b36d0b6a5 |
|
585 | 648 | filtering * (glob) |
|
586 | 649 | applying 722f4667af76 |
|
587 | 650 | 722f4667af76 transplanted to 0aa6979afb95 |
|
588 | 651 | filtering * (glob) |
|
589 | 652 | applying a53251cdf717 |
|
590 | 653 | a53251cdf717 transplanted to 14f8512272b5 |
|
591 | 654 | $ hg log --template '{rev} {parents} {desc}\n' |
|
592 | 655 | 3 b3 |
|
593 | 656 | 2 b2 |
|
594 | 657 | 1 b1 |
|
595 | 658 | 0 r2 |
|
596 | 659 | $ cd .. |
|
597 | 660 | |
|
598 | 661 | |
|
599 | 662 | test filter with failed patch |
|
600 | 663 | |
|
601 | 664 | $ cd filter |
|
602 | 665 | $ hg up 0 |
|
603 | 666 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
604 | 667 | $ echo foo > b1 |
|
605 | 668 | $ hg ci -Am foo |
|
606 | 669 | adding b1 |
|
607 | 670 | adding test-filter |
|
608 | 671 | created new head |
|
609 | 672 | $ hg transplant 1 --filter ./test-filter |
|
610 | 673 | filtering * (glob) |
|
611 | 674 | applying 348b36d0b6a5 |
|
612 | 675 | file b1 already exists |
|
613 | 676 | 1 out of 1 hunks FAILED -- saving rejects to file b1.rej |
|
614 | 677 | patch failed to apply |
|
615 | 678 | abort: fix up the merge and run hg transplant --continue |
|
616 | 679 | [255] |
|
617 | 680 | $ cd .. |
|
618 | 681 | |
|
619 | 682 | test environment passed to filter |
|
620 | 683 | |
|
621 | 684 | $ hg init filter-environment |
|
622 | 685 | $ cd filter-environment |
|
623 | 686 | $ cat <<'EOF' >test-filter-environment |
|
624 | 687 | > #!/bin/sh |
|
625 | 688 | > echo "Transplant by $HGUSER" >> $1 |
|
626 | 689 | > echo "Transplant from rev $HGREVISION" >> $1 |
|
627 | 690 | > EOF |
|
628 | 691 | $ chmod +x test-filter-environment |
|
629 | 692 | $ hg transplant -s ../t --filter ./test-filter-environment 0 |
|
630 | 693 | filtering * (glob) |
|
631 | 694 | applying 17ab29e464c6 |
|
632 | 695 | 17ab29e464c6 transplanted to 5190e68026a0 |
|
633 | 696 | |
|
634 | 697 | $ hg log --template '{rev} {parents} {desc}\n' |
|
635 | 698 | 0 r1 |
|
636 | 699 | Transplant by test |
|
637 | 700 | Transplant from rev 17ab29e464c6ca53e329470efe2a9918ac617a6f |
|
638 | 701 | $ cd .. |
|
639 | 702 | |
|
640 | 703 | test transplant with filter handles invalid changelog |
|
641 | 704 | |
|
642 | 705 | $ hg init filter-invalid-log |
|
643 | 706 | $ cd filter-invalid-log |
|
644 | 707 | $ cat <<'EOF' >test-filter-invalid-log |
|
645 | 708 | > #!/bin/sh |
|
646 | 709 | > echo "" > $1 |
|
647 | 710 | > EOF |
|
648 | 711 | $ chmod +x test-filter-invalid-log |
|
649 | 712 | $ hg transplant -s ../t --filter ./test-filter-invalid-log 0 |
|
650 | 713 | filtering * (glob) |
|
651 | 714 | abort: filter corrupted changeset (no user or date) |
|
652 | 715 | [255] |
|
653 | 716 | $ cd .. |
|
654 | 717 | |
|
655 | 718 | #endif |
|
656 | 719 | |
|
657 | 720 | |
|
658 | 721 | test with a win32ext like setup (differing EOLs) |
|
659 | 722 | |
|
660 | 723 | $ hg init twin1 |
|
661 | 724 | $ cd twin1 |
|
662 | 725 | $ echo a > a |
|
663 | 726 | $ echo b > b |
|
664 | 727 | $ echo b >> b |
|
665 | 728 | $ hg ci -Am t |
|
666 | 729 | adding a |
|
667 | 730 | adding b |
|
668 | 731 | $ echo a > b |
|
669 | 732 | $ echo b >> b |
|
670 | 733 | $ hg ci -m changeb |
|
671 | 734 | $ cd .. |
|
672 | 735 | |
|
673 | 736 | $ hg init twin2 |
|
674 | 737 | $ cd twin2 |
|
675 | 738 | $ echo '[patch]' >> .hg/hgrc |
|
676 | 739 | $ echo 'eol = crlf' >> .hg/hgrc |
|
677 | 740 | $ $PYTHON -c "file('b', 'wb').write('b\r\nb\r\n')" |
|
678 | 741 | $ hg ci -Am addb |
|
679 | 742 | adding b |
|
680 | 743 | $ hg transplant -s ../twin1 tip |
|
681 | 744 | searching for changes |
|
682 | 745 | warning: repository is unrelated |
|
683 | 746 | applying 2e849d776c17 |
|
684 | 747 | 2e849d776c17 transplanted to 8e65bebc063e |
|
685 | 748 | $ cat b |
|
686 | 749 | a\r (esc) |
|
687 | 750 | b\r (esc) |
|
688 | 751 | $ cd .. |
|
689 | 752 | |
|
690 | 753 | test transplant with merge changeset is skipped |
|
691 | 754 | |
|
692 | 755 | $ hg init merge1a |
|
693 | 756 | $ cd merge1a |
|
694 | 757 | $ echo a > a |
|
695 | 758 | $ hg ci -Am a |
|
696 | 759 | adding a |
|
697 | 760 | $ hg branch b |
|
698 | 761 | marked working directory as branch b |
|
699 | 762 | (branches are permanent and global, did you want a bookmark?) |
|
700 | 763 | $ hg ci -m branchb |
|
701 | 764 | $ echo b > b |
|
702 | 765 | $ hg ci -Am b |
|
703 | 766 | adding b |
|
704 | 767 | $ hg update default |
|
705 | 768 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
706 | 769 | $ hg merge b |
|
707 | 770 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
708 | 771 | (branch merge, don't forget to commit) |
|
709 | 772 | $ hg ci -m mergeb |
|
710 | 773 | $ cd .. |
|
711 | 774 | |
|
712 | 775 | $ hg init merge1b |
|
713 | 776 | $ cd merge1b |
|
714 | 777 | $ hg transplant -s ../merge1a tip |
|
715 | 778 | $ cd .. |
|
716 | 779 | |
|
717 | 780 | test transplant with merge changeset accepts --parent |
|
718 | 781 | |
|
719 | 782 | $ hg init merge2a |
|
720 | 783 | $ cd merge2a |
|
721 | 784 | $ echo a > a |
|
722 | 785 | $ hg ci -Am a |
|
723 | 786 | adding a |
|
724 | 787 | $ hg branch b |
|
725 | 788 | marked working directory as branch b |
|
726 | 789 | (branches are permanent and global, did you want a bookmark?) |
|
727 | 790 | $ hg ci -m branchb |
|
728 | 791 | $ echo b > b |
|
729 | 792 | $ hg ci -Am b |
|
730 | 793 | adding b |
|
731 | 794 | $ hg update default |
|
732 | 795 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
733 | 796 | $ hg merge b |
|
734 | 797 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
735 | 798 | (branch merge, don't forget to commit) |
|
736 | 799 | $ hg ci -m mergeb |
|
737 | 800 | $ cd .. |
|
738 | 801 | |
|
739 | 802 | $ hg init merge2b |
|
740 | 803 | $ cd merge2b |
|
804 | $ hg transplant -s ../merge2a --parent tip tip | |
|
805 | abort: be9f9b39483f is not a parent of be9f9b39483f | |
|
806 | [255] | |
|
741 | 807 | $ hg transplant -s ../merge2a --parent 0 tip |
|
742 | 808 | applying be9f9b39483f |
|
743 | 809 | be9f9b39483f transplanted to 9959e51f94d1 |
|
744 | 810 | $ cd .. |
|
745 | 811 | |
|
746 | 812 | test transplanting a patch turning into a no-op |
|
747 | 813 | |
|
748 | 814 | $ hg init binarysource |
|
749 | 815 | $ cd binarysource |
|
750 | 816 | $ echo a > a |
|
751 | 817 | $ hg ci -Am adda a |
|
752 | 818 | >>> file('b', 'wb').write('\0b1') |
|
753 | 819 | $ hg ci -Am addb b |
|
754 | 820 | >>> file('b', 'wb').write('\0b2') |
|
755 | 821 | $ hg ci -m changeb b |
|
756 | 822 | $ cd .. |
|
757 | 823 | |
|
758 | 824 | $ hg clone -r0 binarysource binarydest |
|
759 | 825 | adding changesets |
|
760 | 826 | adding manifests |
|
761 | 827 | adding file changes |
|
762 | 828 | added 1 changesets with 1 changes to 1 files |
|
763 | 829 | updating to branch default |
|
764 | 830 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
765 | 831 | $ cd binarydest |
|
766 | 832 | $ cp ../binarysource/b b |
|
767 | 833 | $ hg ci -Am addb2 b |
|
768 | 834 | $ hg transplant -s ../binarysource 2 |
|
769 | 835 | searching for changes |
|
770 | 836 | applying 7a7d57e15850 |
|
771 | 837 | skipping emptied changeset 7a7d57e15850 |
|
772 | 838 | |
|
773 | 839 | Test empty result in --continue |
|
774 | 840 | |
|
775 | 841 | $ hg transplant -s ../binarysource 1 |
|
776 | 842 | searching for changes |
|
777 | 843 | applying 645035761929 |
|
778 | 844 | file b already exists |
|
779 | 845 | 1 out of 1 hunks FAILED -- saving rejects to file b.rej |
|
780 | 846 | patch failed to apply |
|
781 | 847 | abort: fix up the merge and run hg transplant --continue |
|
782 | 848 | [255] |
|
783 | 849 | $ hg status |
|
784 | 850 | ? b.rej |
|
785 | 851 | $ hg transplant --continue |
|
786 | 852 | 645035761929 skipped due to empty diff |
|
787 | 853 | |
|
788 | 854 | $ cd .. |
|
789 | 855 | |
|
790 | 856 | Explicitly kill daemons to let the test exit on Windows |
|
791 | 857 | |
|
792 | 858 | $ killdaemons.py |
|
793 | 859 | |
|
794 | 860 | Test that patch-ed files are treated as "modified", when transplant is |
|
795 | 861 | aborted by failure of patching, even if none of mode, size and |
|
796 | 862 | timestamp of them isn't changed on the filesystem (see also issue4583) |
|
797 | 863 | |
|
798 | 864 | $ cd t |
|
799 | 865 | |
|
800 | 866 | $ cat > $TESTTMP/abort.py <<EOF |
|
801 | 867 | > # emulate that patch.patch() is aborted at patching on "abort" file |
|
802 | 868 | > from mercurial import extensions, patch as patchmod |
|
803 | 869 | > def patch(orig, ui, repo, patchname, |
|
804 | 870 | > strip=1, prefix='', files=None, |
|
805 | 871 | > eolmode='strict', similarity=0): |
|
806 | 872 | > if files is None: |
|
807 | 873 | > files = set() |
|
808 | 874 | > r = orig(ui, repo, patchname, |
|
809 | 875 | > strip=strip, prefix=prefix, files=files, |
|
810 | 876 | > eolmode=eolmode, similarity=similarity) |
|
811 | 877 | > if 'abort' in files: |
|
812 | 878 | > raise patchmod.PatchError('intentional error while patching') |
|
813 | 879 | > return r |
|
814 | 880 | > def extsetup(ui): |
|
815 | 881 | > extensions.wrapfunction(patchmod, 'patch', patch) |
|
816 | 882 | > EOF |
|
817 | 883 | |
|
818 | 884 | $ echo X1 > r1 |
|
819 | 885 | $ hg diff --nodates r1 |
|
820 | 886 | diff -r a53251cdf717 r1 |
|
821 | 887 | --- a/r1 |
|
822 | 888 | +++ b/r1 |
|
823 | 889 | @@ -1,1 +1,1 @@ |
|
824 | 890 | -r1 |
|
825 | 891 | +X1 |
|
826 | 892 | $ hg commit -m "X1 as r1" |
|
827 | 893 | |
|
828 | 894 | $ echo 'marking to abort patching' > abort |
|
829 | 895 | $ hg add abort |
|
830 | 896 | $ echo Y1 > r1 |
|
831 | 897 | $ hg diff --nodates r1 |
|
832 | 898 | diff -r 22c515968f13 r1 |
|
833 | 899 | --- a/r1 |
|
834 | 900 | +++ b/r1 |
|
835 | 901 | @@ -1,1 +1,1 @@ |
|
836 | 902 | -X1 |
|
837 | 903 | +Y1 |
|
838 | 904 | $ hg commit -m "Y1 as r1" |
|
839 | 905 | |
|
840 | 906 | $ hg update -q -C d11e3596cc1a |
|
841 | 907 | $ cat r1 |
|
842 | 908 | r1 |
|
843 | 909 | |
|
844 | 910 | $ cat >> .hg/hgrc <<EOF |
|
845 | 911 | > [fakedirstatewritetime] |
|
846 | 912 | > # emulate invoking dirstate.write() via repo.status() or markcommitted() |
|
847 | 913 | > # at 2000-01-01 00:00 |
|
848 | 914 | > fakenow = 200001010000 |
|
849 | 915 | > |
|
850 | 916 | > # emulate invoking patch.internalpatch() at 2000-01-01 00:00 |
|
851 | 917 | > [fakepatchtime] |
|
852 | 918 | > fakenow = 200001010000 |
|
853 | 919 | > |
|
854 | 920 | > [extensions] |
|
855 | 921 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
856 | 922 | > fakepatchtime = $TESTDIR/fakepatchtime.py |
|
857 | 923 | > abort = $TESTTMP/abort.py |
|
858 | 924 | > EOF |
|
859 | 925 | $ hg transplant "22c515968f13::" |
|
860 | 926 | applying 22c515968f13 |
|
861 | 927 | 22c515968f13 transplanted to * (glob) |
|
862 | 928 | applying e38700ba9dd3 |
|
863 | 929 | intentional error while patching |
|
864 | 930 | abort: fix up the merge and run hg transplant --continue |
|
865 | 931 | [255] |
|
866 | 932 | $ cat >> .hg/hgrc <<EOF |
|
867 | 933 | > [hooks] |
|
868 | 934 | > fakedirstatewritetime = ! |
|
869 | 935 | > fakepatchtime = ! |
|
870 | 936 | > [extensions] |
|
871 | 937 | > abort = ! |
|
872 | 938 | > EOF |
|
873 | 939 | |
|
874 | 940 | $ cat r1 |
|
875 | 941 | Y1 |
|
876 | 942 | $ hg debugstate | grep ' r1$' |
|
877 | 943 | n 644 3 unset r1 |
|
878 | 944 | $ hg status -A r1 |
|
879 | 945 | M r1 |
|
880 | 946 | |
|
881 | 947 | Test that rollback by unexpected failure after transplanting the first |
|
882 | 948 | revision restores dirstate correctly. |
|
883 | 949 | |
|
884 | 950 | $ hg rollback -q |
|
885 | 951 | $ rm -f abort |
|
886 | 952 | $ hg update -q -C d11e3596cc1a |
|
887 | 953 | $ hg parents -T "{node|short}\n" |
|
888 | 954 | d11e3596cc1a |
|
889 | 955 | $ hg status -A |
|
890 | 956 | C r1 |
|
891 | 957 | C r2 |
|
892 | 958 | |
|
893 | 959 | $ cat >> .hg/hgrc <<EOF |
|
894 | 960 | > [hooks] |
|
895 | 961 | > # emulate failure at transplanting the 2nd revision |
|
896 | 962 | > pretxncommit.abort = test ! -f abort |
|
897 | 963 | > EOF |
|
898 | 964 | $ hg transplant "22c515968f13::" |
|
899 | 965 | applying 22c515968f13 |
|
900 | 966 | 22c515968f13 transplanted to * (glob) |
|
901 | 967 | applying e38700ba9dd3 |
|
902 | 968 | transaction abort! |
|
903 | 969 | rollback completed |
|
904 | 970 | abort: pretxncommit.abort hook exited with status 1 |
|
905 | 971 | [255] |
|
906 | 972 | $ cat >> .hg/hgrc <<EOF |
|
907 | 973 | > [hooks] |
|
908 | 974 | > pretxncommit.abort = ! |
|
909 | 975 | > EOF |
|
910 | 976 | |
|
911 | 977 | $ hg parents -T "{node|short}\n" |
|
912 | 978 | d11e3596cc1a |
|
913 | 979 | $ hg status -A |
|
914 | 980 | M r1 |
|
915 | 981 | ? abort |
|
916 | 982 | C r2 |
|
917 | 983 | |
|
918 | 984 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now