##// END OF EJS Templates
tests: better document the graft copy case...
Martin von Zweigbergk -
r42222:b9e5f385 default
parent child Browse files
Show More
@@ -1,2234 +1,2249
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extdiff]
3 3 > # for portability:
4 4 > pdiff = sh "$RUNTESTDIR/pdiff"
5 5 > EOF
6 6
7 7 Create a repo with some stuff in it:
8 8
9 9 $ hg init a
10 10 $ cd a
11 11 $ echo a > a
12 12 $ echo a > d
13 13 $ echo a > e
14 14 $ hg ci -qAm0
15 15 $ echo b > a
16 16 $ hg ci -m1 -u bar
17 17 $ hg mv a b
18 18 $ hg ci -m2
19 19 $ hg cp b c
20 20 $ hg ci -m3 -u baz
21 21 $ echo b > d
22 22 $ echo f > e
23 23 $ hg ci -m4
24 24 $ hg up -q 3
25 25 $ echo b > e
26 26 $ hg branch -q stable
27 27 $ hg ci -m5
28 28 $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4
29 29 $ hg branch -q default
30 30 $ hg ci -m6
31 31 $ hg phase --public 3
32 32 $ hg phase --force --secret 6
33 33
34 34 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
35 35 @ test@6.secret: 6
36 36 |\
37 37 | o test@5.draft: 5
38 38 | |
39 39 o | test@4.draft: 4
40 40 |/
41 41 o baz@3.public: 3
42 42 |
43 43 o test@2.public: 2
44 44 |
45 45 o bar@1.public: 1
46 46 |
47 47 o test@0.public: 0
48 48
49 49 Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d
50 50
51 51 $ hg up -cqr 3
52 52 $ hg graft -r 6 --base 5
53 53 grafting 6:25a2b029d3ae "6" (tip)
54 54 merging e
55 55 $ hg st --change .
56 56 M d
57 57
58 58 $ hg -q strip . --config extensions.strip=
59 59
60 60 Test --base for collapsing changesets 2 and 3, thus getting both b and c
61 61
62 62 $ hg up -cqr 0
63 63 $ hg graft -r 3 --base 1
64 64 grafting 3:4c60f11aa304 "3"
65 65 merging a and b to b
66 66 merging a and c to c
67 67 $ hg st --change .
68 68 A b
69 69 A c
70 70 R a
71 71
72 72 $ hg -q strip . --config extensions.strip=
73 73
74 74 Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent)
75 75
76 76 $ hg graft -r 2 --base 3
77 77 grafting 2:5c095ad7e90f "2"
78 78 note: graft of 2:5c095ad7e90f created no changes to commit
79 79
80 80 Can't continue without starting:
81 81
82 82 $ hg -q up -cr tip
83 83 $ hg rm -q e
84 84 $ hg graft --continue
85 85 abort: no graft in progress
86 86 [255]
87 87 $ hg revert -r . -q e
88 88
89 89 Need to specify a rev:
90 90
91 91 $ hg graft
92 92 abort: no revisions specified
93 93 [255]
94 94
95 95 Can't graft ancestor:
96 96
97 97 $ hg graft 1 2
98 98 skipping ancestor revision 1:5d205f8b35b6
99 99 skipping ancestor revision 2:5c095ad7e90f
100 100 [255]
101 101
102 102 Specify revisions with -r:
103 103
104 104 $ hg graft -r 1 -r 2
105 105 skipping ancestor revision 1:5d205f8b35b6
106 106 skipping ancestor revision 2:5c095ad7e90f
107 107 [255]
108 108
109 109 $ hg graft -r 1 2
110 110 warning: inconsistent use of --rev might give unexpected revision ordering!
111 111 skipping ancestor revision 2:5c095ad7e90f
112 112 skipping ancestor revision 1:5d205f8b35b6
113 113 [255]
114 114
115 115 Conflicting date/user options:
116 116
117 117 $ hg up -q 0
118 118 $ hg graft -U --user foo 2
119 119 abort: --user and --currentuser are mutually exclusive
120 120 [255]
121 121 $ hg graft -D --date '0 0' 2
122 122 abort: --date and --currentdate are mutually exclusive
123 123 [255]
124 124
125 125 Can't graft with dirty wd:
126 126
127 127 $ hg up -q 0
128 128 $ echo foo > a
129 129 $ hg graft 1
130 130 abort: uncommitted changes
131 131 [255]
132 132 $ hg revert a
133 133
134 134 Graft a rename:
135 135 (this also tests that editor is invoked if '--edit' is specified)
136 136
137 137 $ hg status --rev "2^1" --rev 2
138 138 A b
139 139 R a
140 140 $ HGEDITOR=cat hg graft 2 -u foo --edit
141 141 grafting 2:5c095ad7e90f "2"
142 142 merging a and b to b
143 143 2
144 144
145 145
146 146 HG: Enter commit message. Lines beginning with 'HG:' are removed.
147 147 HG: Leave message empty to abort commit.
148 148 HG: --
149 149 HG: user: foo
150 150 HG: branch 'default'
151 151 HG: added b
152 152 HG: removed a
153 153 $ hg export tip --git
154 154 # HG changeset patch
155 155 # User foo
156 156 # Date 0 0
157 157 # Thu Jan 01 00:00:00 1970 +0000
158 158 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
159 159 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
160 160 2
161 161
162 162 diff --git a/a b/b
163 163 rename from a
164 164 rename to b
165 165
166 166 Look for extra:source
167 167
168 168 $ hg log --debug -r tip
169 169 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
170 170 tag: tip
171 171 phase: draft
172 172 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
173 173 parent: -1:0000000000000000000000000000000000000000
174 174 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
175 175 user: foo
176 176 date: Thu Jan 01 00:00:00 1970 +0000
177 177 files+: b
178 178 files-: a
179 179 extra: branch=default
180 180 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
181 181 description:
182 182 2
183 183
184 184
185 185
186 186 Graft out of order, skipping a merge and a duplicate
187 187 (this also tests that editor is not invoked if '--edit' is not specified)
188 188
189 189 $ hg graft 1 5 4 3 'merge()' 2 -n
190 190 skipping ungraftable merge revision 6
191 191 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
192 192 grafting 1:5d205f8b35b6 "1"
193 193 grafting 5:97f8bfe72746 "5"
194 194 grafting 4:9c233e8e184d "4"
195 195 grafting 3:4c60f11aa304 "3"
196 196
197 197 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
198 198 skipping ungraftable merge revision 6
199 199 scanning for duplicate grafts
200 200 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
201 201 grafting 1:5d205f8b35b6 "1"
202 202 searching for copies back to rev 1
203 203 unmatched files in local:
204 204 b
205 205 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
206 206 src: 'a' -> dst: 'b' *
207 207 checking for directory renames
208 208 resolving manifests
209 209 branchmerge: True, force: True, partial: False
210 210 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
211 211 preserving b for resolve of b
212 212 starting 4 threads for background file closing (?)
213 213 b: local copied/moved from a -> m (premerge)
214 214 picked tool ':merge' for b (binary False symlink False changedelete False)
215 215 merging b and a to b
216 216 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
217 217 premerge successful
218 218 committing files:
219 219 b
220 220 committing manifest
221 221 committing changelog
222 222 updating the branch cache
223 223 grafting 5:97f8bfe72746 "5"
224 224 searching for copies back to rev 1
225 225 unmatched files in other (from topological common ancestor):
226 226 c
227 227 resolving manifests
228 228 branchmerge: True, force: True, partial: False
229 229 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
230 230 e: remote is newer -> g
231 231 getting e
232 232 committing files:
233 233 e
234 234 committing manifest
235 235 committing changelog
236 236 updating the branch cache
237 237 $ HGEDITOR=cat hg graft 4 3 --log --debug
238 238 scanning for duplicate grafts
239 239 grafting 4:9c233e8e184d "4"
240 240 searching for copies back to rev 1
241 241 unmatched files in other (from topological common ancestor):
242 242 c
243 243 resolving manifests
244 244 branchmerge: True, force: True, partial: False
245 245 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
246 246 preserving e for resolve of e
247 247 d: remote is newer -> g
248 248 getting d
249 249 e: versions differ -> m (premerge)
250 250 picked tool ':merge' for e (binary False symlink False changedelete False)
251 251 merging e
252 252 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
253 253 e: versions differ -> m (merge)
254 254 picked tool ':merge' for e (binary False symlink False changedelete False)
255 255 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
256 256 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
257 257 abort: unresolved conflicts, can't continue
258 258 (use 'hg resolve' and 'hg graft --continue')
259 259 [255]
260 260
261 261 Summary should mention graft:
262 262
263 263 $ hg summary |grep graft
264 264 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
265 265
266 266 Using status to get more context
267 267
268 268 $ hg status --verbose
269 269 M d
270 270 M e
271 271 ? a.orig
272 272 ? e.orig
273 273 # The repository is in an unfinished *graft* state.
274 274
275 275 # Unresolved merge conflicts:
276 276 #
277 277 # e
278 278 #
279 279 # To mark files as resolved: hg resolve --mark FILE
280 280
281 281 # To continue: hg graft --continue
282 282 # To abort: hg graft --abort
283 283
284 284
285 285 Commit while interrupted should fail:
286 286
287 287 $ hg ci -m 'commit interrupted graft'
288 288 abort: graft in progress
289 289 (use 'hg graft --continue' or 'hg graft --stop' to stop)
290 290 [255]
291 291
292 292 Abort the graft and try committing:
293 293
294 294 $ hg up -C .
295 295 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 296 $ echo c >> e
297 297 $ hg ci -mtest
298 298
299 299 $ hg strip . --config extensions.strip=
300 300 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
301 301 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
302 302
303 303 Graft again:
304 304
305 305 $ hg graft 1 5 4 3 'merge()' 2
306 306 skipping ungraftable merge revision 6
307 307 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
308 308 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
309 309 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
310 310 grafting 4:9c233e8e184d "4"
311 311 merging e
312 312 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
313 313 abort: unresolved conflicts, can't continue
314 314 (use 'hg resolve' and 'hg graft --continue')
315 315 [255]
316 316
317 317 Continue without resolve should fail:
318 318
319 319 $ hg graft -c
320 320 grafting 4:9c233e8e184d "4"
321 321 abort: unresolved merge conflicts (see 'hg help resolve')
322 322 [255]
323 323
324 324 Fix up:
325 325
326 326 $ echo b > e
327 327 $ hg resolve -m e
328 328 (no more unresolved files)
329 329 continue: hg graft --continue
330 330
331 331 Continue with a revision should fail:
332 332
333 333 $ hg graft -c 6
334 334 abort: can't specify --continue and revisions
335 335 [255]
336 336
337 337 $ hg graft -c -r 6
338 338 abort: can't specify --continue and revisions
339 339 [255]
340 340
341 341 Continue for real, clobber usernames
342 342
343 343 $ hg graft -c -U
344 344 grafting 4:9c233e8e184d "4"
345 345 grafting 3:4c60f11aa304 "3"
346 346
347 347 Compare with original:
348 348
349 349 $ hg diff -r 6
350 350 $ hg status --rev 0:. -C
351 351 M d
352 352 M e
353 353 A b
354 354 a
355 355 A c
356 356 a
357 357 R a
358 358
359 359 View graph:
360 360
361 361 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
362 362 @ test@11.draft: 3
363 363 |
364 364 o test@10.draft: 4
365 365 |
366 366 o test@9.draft: 5
367 367 |
368 368 o bar@8.draft: 1
369 369 |
370 370 o foo@7.draft: 2
371 371 |
372 372 | o test@6.secret: 6
373 373 | |\
374 374 | | o test@5.draft: 5
375 375 | | |
376 376 | o | test@4.draft: 4
377 377 | |/
378 378 | o baz@3.public: 3
379 379 | |
380 380 | o test@2.public: 2
381 381 | |
382 382 | o bar@1.public: 1
383 383 |/
384 384 o test@0.public: 0
385 385
386 386 Graft again onto another branch should preserve the original source
387 387 $ hg up -q 0
388 388 $ echo 'g'>g
389 389 $ hg add g
390 390 $ hg ci -m 7
391 391 created new head
392 392 $ hg graft 7
393 393 grafting 7:ef0ef43d49e7 "2"
394 394
395 395 $ hg log -r 7 --template '{rev}:{node}\n'
396 396 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
397 397 $ hg log -r 2 --template '{rev}:{node}\n'
398 398 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
399 399
400 400 $ hg log --debug -r tip
401 401 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
402 402 tag: tip
403 403 phase: draft
404 404 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
405 405 parent: -1:0000000000000000000000000000000000000000
406 406 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
407 407 user: foo
408 408 date: Thu Jan 01 00:00:00 1970 +0000
409 409 files+: b
410 410 files-: a
411 411 extra: branch=default
412 412 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
413 413 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
414 414 description:
415 415 2
416 416
417 417
418 418 Disallow grafting an already grafted cset onto its original branch
419 419 $ hg up -q 6
420 420 $ hg graft 7
421 421 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
422 422 [255]
423 423
424 424 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
425 425 --- */hg-5c095ad7e90f.patch * (glob)
426 426 +++ */hg-7a4785234d87.patch * (glob)
427 427 @@ -1,18 +1,18 @@
428 428 # HG changeset patch
429 429 -# User test
430 430 +# User foo
431 431 # Date 0 0
432 432 # Thu Jan 01 00:00:00 1970 +0000
433 433 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
434 434 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
435 435 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
436 436 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
437 437 2
438 438
439 439 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
440 440 +diff -r b592ea63bb0c -r 7a4785234d87 a
441 441 --- a/a Thu Jan 01 00:00:00 1970 +0000
442 442 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
443 443 @@ -1,1 +0,0 @@
444 444 --b
445 445 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
446 446 +-a
447 447 +diff -r b592ea63bb0c -r 7a4785234d87 b
448 448 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
449 449 +++ b/b Thu Jan 01 00:00:00 1970 +0000
450 450 @@ -0,0 +1,1 @@
451 451 -+b
452 452 ++a
453 453 [1]
454 454
455 455 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
456 456 --- */hg-5c095ad7e90f.patch * (glob)
457 457 +++ */hg-7a4785234d87.patch * (glob)
458 458 @@ -1,8 +1,8 @@
459 459 # HG changeset patch
460 460 -# User test
461 461 +# User foo
462 462 # Date 0 0
463 463 # Thu Jan 01 00:00:00 1970 +0000
464 464 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
465 465 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
466 466 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
467 467 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
468 468 2
469 469
470 470 [1]
471 471
472 472 Disallow grafting already grafted csets with the same origin onto each other
473 473 $ hg up -q 13
474 474 $ hg graft 2
475 475 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
476 476 [255]
477 477 $ hg graft 7
478 478 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
479 479 [255]
480 480
481 481 $ hg up -q 7
482 482 $ hg graft 2
483 483 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
484 484 [255]
485 485 $ hg graft tip
486 486 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
487 487 [255]
488 488
489 489 Graft with --log
490 490
491 491 $ hg up -Cq 1
492 492 $ hg graft 3 --log -u foo
493 493 grafting 3:4c60f11aa304 "3"
494 494 warning: can't find ancestor for 'c' copied from 'b'!
495 495 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
496 496 14:0c921c65ef1e 1:5d205f8b35b6 3
497 497 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
498 498
499 499 Resolve conflicted graft
500 500 $ hg up -q 0
501 501 $ echo b > a
502 502 $ hg ci -m 8
503 503 created new head
504 504 $ echo c > a
505 505 $ hg ci -m 9
506 506 $ hg graft 1 --tool internal:fail
507 507 grafting 1:5d205f8b35b6 "1"
508 508 abort: unresolved conflicts, can't continue
509 509 (use 'hg resolve' and 'hg graft --continue')
510 510 [255]
511 511 $ hg resolve --all
512 512 merging a
513 513 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
514 514 [1]
515 515 $ cat a
516 516 <<<<<<< local: aaa4406d4f0a - test: 9
517 517 c
518 518 =======
519 519 b
520 520 >>>>>>> graft: 5d205f8b35b6 - bar: 1
521 521 $ echo b > a
522 522 $ hg resolve -m a
523 523 (no more unresolved files)
524 524 continue: hg graft --continue
525 525 $ hg graft -c
526 526 grafting 1:5d205f8b35b6 "1"
527 527 $ hg export tip --git
528 528 # HG changeset patch
529 529 # User bar
530 530 # Date 0 0
531 531 # Thu Jan 01 00:00:00 1970 +0000
532 532 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
533 533 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
534 534 1
535 535
536 536 diff --git a/a b/a
537 537 --- a/a
538 538 +++ b/a
539 539 @@ -1,1 +1,1 @@
540 540 -c
541 541 +b
542 542
543 543 Resolve conflicted graft with rename
544 544 $ echo c > a
545 545 $ hg ci -m 10
546 546 $ hg graft 2 --tool internal:fail
547 547 grafting 2:5c095ad7e90f "2"
548 548 abort: unresolved conflicts, can't continue
549 549 (use 'hg resolve' and 'hg graft --continue')
550 550 [255]
551 551 $ hg resolve --all
552 552 merging a and b to b
553 553 (no more unresolved files)
554 554 continue: hg graft --continue
555 555 $ hg graft -c
556 556 grafting 2:5c095ad7e90f "2"
557 557 $ hg export tip --git
558 558 # HG changeset patch
559 559 # User test
560 560 # Date 0 0
561 561 # Thu Jan 01 00:00:00 1970 +0000
562 562 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
563 563 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
564 564 2
565 565
566 566 diff --git a/a b/b
567 567 rename from a
568 568 rename to b
569 569
570 570 Test simple origin(), with and without args
571 571 $ hg log -r 'origin()'
572 572 changeset: 1:5d205f8b35b6
573 573 user: bar
574 574 date: Thu Jan 01 00:00:00 1970 +0000
575 575 summary: 1
576 576
577 577 changeset: 2:5c095ad7e90f
578 578 user: test
579 579 date: Thu Jan 01 00:00:00 1970 +0000
580 580 summary: 2
581 581
582 582 changeset: 3:4c60f11aa304
583 583 user: baz
584 584 date: Thu Jan 01 00:00:00 1970 +0000
585 585 summary: 3
586 586
587 587 changeset: 4:9c233e8e184d
588 588 user: test
589 589 date: Thu Jan 01 00:00:00 1970 +0000
590 590 summary: 4
591 591
592 592 changeset: 5:97f8bfe72746
593 593 branch: stable
594 594 parent: 3:4c60f11aa304
595 595 user: test
596 596 date: Thu Jan 01 00:00:00 1970 +0000
597 597 summary: 5
598 598
599 599 $ hg log -r 'origin(7)'
600 600 changeset: 2:5c095ad7e90f
601 601 user: test
602 602 date: Thu Jan 01 00:00:00 1970 +0000
603 603 summary: 2
604 604
605 605 Now transplant a graft to test following through copies
606 606 $ hg up -q 0
607 607 $ hg branch -q dev
608 608 $ hg ci -qm "dev branch"
609 609 $ hg --config extensions.transplant= transplant -q 7
610 610 $ hg log -r 'origin(.)'
611 611 changeset: 2:5c095ad7e90f
612 612 user: test
613 613 date: Thu Jan 01 00:00:00 1970 +0000
614 614 summary: 2
615 615
616 616 Test that the graft and transplant markers in extra are converted, allowing
617 617 origin() to still work. Note that these recheck the immediately preceeding two
618 618 tests.
619 619 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
620 620
621 621 The graft case
622 622 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
623 623 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
624 624 branch=default
625 625 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
626 626 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
627 627 $ hg -R ../converted log -r 'origin(7)'
628 628 changeset: 2:e0213322b2c1
629 629 user: test
630 630 date: Thu Jan 01 00:00:00 1970 +0000
631 631 summary: 2
632 632
633 633 Test that template correctly expands more than one 'extra' (issue4362), and that
634 634 'intermediate-source' is converted.
635 635 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
636 636 Extra: branch=default
637 637 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
638 638 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
639 639 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
640 640
641 641 The transplant case
642 642 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
643 643 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
644 644 branch=dev
645 645 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
646 646 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
647 647 $ hg -R ../converted log -r 'origin(tip)'
648 648 changeset: 2:e0213322b2c1
649 649 user: test
650 650 date: Thu Jan 01 00:00:00 1970 +0000
651 651 summary: 2
652 652
653 653
654 654 Test simple destination
655 655 $ hg log -r 'destination()'
656 656 changeset: 7:ef0ef43d49e7
657 657 parent: 0:68795b066622
658 658 user: foo
659 659 date: Thu Jan 01 00:00:00 1970 +0000
660 660 summary: 2
661 661
662 662 changeset: 8:6b9e5368ca4e
663 663 user: bar
664 664 date: Thu Jan 01 00:00:00 1970 +0000
665 665 summary: 1
666 666
667 667 changeset: 9:1905859650ec
668 668 user: test
669 669 date: Thu Jan 01 00:00:00 1970 +0000
670 670 summary: 5
671 671
672 672 changeset: 10:52dc0b4c6907
673 673 user: test
674 674 date: Thu Jan 01 00:00:00 1970 +0000
675 675 summary: 4
676 676
677 677 changeset: 11:882b35362a6b
678 678 user: test
679 679 date: Thu Jan 01 00:00:00 1970 +0000
680 680 summary: 3
681 681
682 682 changeset: 13:7a4785234d87
683 683 user: foo
684 684 date: Thu Jan 01 00:00:00 1970 +0000
685 685 summary: 2
686 686
687 687 changeset: 14:0c921c65ef1e
688 688 parent: 1:5d205f8b35b6
689 689 user: foo
690 690 date: Thu Jan 01 00:00:00 1970 +0000
691 691 summary: 3
692 692
693 693 changeset: 17:f67661df0c48
694 694 user: bar
695 695 date: Thu Jan 01 00:00:00 1970 +0000
696 696 summary: 1
697 697
698 698 changeset: 19:9627f653b421
699 699 user: test
700 700 date: Thu Jan 01 00:00:00 1970 +0000
701 701 summary: 2
702 702
703 703 changeset: 21:7e61b508e709
704 704 branch: dev
705 705 tag: tip
706 706 user: foo
707 707 date: Thu Jan 01 00:00:00 1970 +0000
708 708 summary: 2
709 709
710 710 $ hg log -r 'destination(2)'
711 711 changeset: 7:ef0ef43d49e7
712 712 parent: 0:68795b066622
713 713 user: foo
714 714 date: Thu Jan 01 00:00:00 1970 +0000
715 715 summary: 2
716 716
717 717 changeset: 13:7a4785234d87
718 718 user: foo
719 719 date: Thu Jan 01 00:00:00 1970 +0000
720 720 summary: 2
721 721
722 722 changeset: 19:9627f653b421
723 723 user: test
724 724 date: Thu Jan 01 00:00:00 1970 +0000
725 725 summary: 2
726 726
727 727 changeset: 21:7e61b508e709
728 728 branch: dev
729 729 tag: tip
730 730 user: foo
731 731 date: Thu Jan 01 00:00:00 1970 +0000
732 732 summary: 2
733 733
734 734 Transplants of grafts can find a destination...
735 735 $ hg log -r 'destination(7)'
736 736 changeset: 21:7e61b508e709
737 737 branch: dev
738 738 tag: tip
739 739 user: foo
740 740 date: Thu Jan 01 00:00:00 1970 +0000
741 741 summary: 2
742 742
743 743 ... grafts of grafts unfortunately can't
744 744 $ hg graft -q 13 --debug
745 745 scanning for duplicate grafts
746 746 grafting 13:7a4785234d87 "2"
747 747 searching for copies back to rev 12
748 748 unmatched files in other (from topological common ancestor):
749 749 g
750 750 unmatched files new in both:
751 751 b
752 752 resolving manifests
753 753 branchmerge: True, force: True, partial: False
754 754 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
755 755 starting 4 threads for background file closing (?)
756 756 committing files:
757 757 b
758 758 warning: can't find ancestor for 'b' copied from 'a'!
759 759 reusing manifest form p1 (listed files actually unchanged)
760 760 committing changelog
761 761 updating the branch cache
762 762 $ hg log -r 'destination(13)'
763 763 All copies of a cset
764 764 $ hg log -r 'origin(13) or destination(origin(13))'
765 765 changeset: 2:5c095ad7e90f
766 766 user: test
767 767 date: Thu Jan 01 00:00:00 1970 +0000
768 768 summary: 2
769 769
770 770 changeset: 7:ef0ef43d49e7
771 771 parent: 0:68795b066622
772 772 user: foo
773 773 date: Thu Jan 01 00:00:00 1970 +0000
774 774 summary: 2
775 775
776 776 changeset: 13:7a4785234d87
777 777 user: foo
778 778 date: Thu Jan 01 00:00:00 1970 +0000
779 779 summary: 2
780 780
781 781 changeset: 19:9627f653b421
782 782 user: test
783 783 date: Thu Jan 01 00:00:00 1970 +0000
784 784 summary: 2
785 785
786 786 changeset: 21:7e61b508e709
787 787 branch: dev
788 788 user: foo
789 789 date: Thu Jan 01 00:00:00 1970 +0000
790 790 summary: 2
791 791
792 792 changeset: 22:3a4e92d81b97
793 793 branch: dev
794 794 tag: tip
795 795 user: foo
796 796 date: Thu Jan 01 00:00:00 1970 +0000
797 797 summary: 2
798 798
799 799
800 800 graft works on complex revset
801 801
802 802 $ hg graft 'origin(13) or destination(origin(13))'
803 803 skipping ancestor revision 21:7e61b508e709
804 804 skipping ancestor revision 22:3a4e92d81b97
805 805 skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97)
806 806 grafting 7:ef0ef43d49e7 "2"
807 807 warning: can't find ancestor for 'b' copied from 'a'!
808 808 grafting 13:7a4785234d87 "2"
809 809 warning: can't find ancestor for 'b' copied from 'a'!
810 810 grafting 19:9627f653b421 "2"
811 811 merging b
812 812 warning: can't find ancestor for 'b' copied from 'a'!
813 813
814 814 graft with --force (still doesn't graft merges)
815 815
816 816 $ hg graft 19 0 6
817 817 skipping ungraftable merge revision 6
818 818 skipping ancestor revision 0:68795b066622
819 819 skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f)
820 820 [255]
821 821 $ hg graft 19 0 6 --force
822 822 skipping ungraftable merge revision 6
823 823 grafting 19:9627f653b421 "2"
824 824 merging b
825 825 warning: can't find ancestor for 'b' copied from 'a'!
826 826 grafting 0:68795b066622 "0"
827 827
828 828 graft --force after backout
829 829
830 830 $ echo abc > a
831 831 $ hg ci -m 28
832 832 $ hg backout 28
833 833 reverting a
834 834 changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d
835 835 $ hg graft 28
836 836 skipping ancestor revision 28:cc20d29aec8d
837 837 [255]
838 838 $ hg graft 28 --force
839 839 grafting 28:cc20d29aec8d "28"
840 840 merging a
841 841 $ cat a
842 842 abc
843 843
844 844 graft --continue after --force
845 845
846 846 $ echo def > a
847 847 $ hg ci -m 31
848 848 $ hg graft 28 --force --tool internal:fail
849 849 grafting 28:cc20d29aec8d "28"
850 850 abort: unresolved conflicts, can't continue
851 851 (use 'hg resolve' and 'hg graft --continue')
852 852 [255]
853 853 $ hg resolve --all
854 854 merging a
855 855 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
856 856 [1]
857 857 $ echo abc > a
858 858 $ hg resolve -m a
859 859 (no more unresolved files)
860 860 continue: hg graft --continue
861 861 $ hg graft -c
862 862 grafting 28:cc20d29aec8d "28"
863 863 $ cat a
864 864 abc
865 865
866 866 Continue testing same origin policy, using revision numbers from test above
867 867 but do some destructive editing of the repo:
868 868
869 869 $ hg up -qC 7
870 870 $ hg tag -l -r 13 tmp
871 871 $ hg --config extensions.strip= strip 2
872 872 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
873 873 $ hg graft tmp
874 874 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
875 875 [255]
876 876
877 877 Empty graft
878 878
879 879 $ hg up -qr 26
880 880 $ hg tag -f something
881 881 $ hg graft -qr 27
882 882 $ hg graft -f 27
883 883 grafting 27:17d42b8f5d50 "28"
884 884 note: graft of 27:17d42b8f5d50 created no changes to commit
885 885
886 886 $ cd ..
887 887
888 888 Graft to duplicate a commit
889 889
890 890 $ hg init graftsibling
891 891 $ cd graftsibling
892 892 $ touch a
893 893 $ hg commit -qAm a
894 894 $ touch b
895 895 $ hg commit -qAm b
896 896 $ hg log -G -T '{rev}\n'
897 897 @ 1
898 898 |
899 899 o 0
900 900
901 901 $ hg up -q 0
902 902 $ hg graft -r 1
903 903 grafting 1:0e067c57feba "b" (tip)
904 904 $ hg log -G -T '{rev}\n'
905 905 @ 2
906 906 |
907 907 | o 1
908 908 |/
909 909 o 0
910 910
911 911 Graft to duplicate a commit twice
912 912
913 913 $ hg up -q 0
914 914 $ hg graft -r 2
915 915 grafting 2:044ec77f6389 "b" (tip)
916 916 $ hg log -G -T '{rev}\n'
917 917 @ 3
918 918 |
919 919 | o 2
920 920 |/
921 921 | o 1
922 922 |/
923 923 o 0
924 924
925 925 Graft from behind a move or rename
926 926 ==================================
927 927
928 928 NOTE: This is affected by issue5343, and will need updating when it's fixed
929 929
930 Possible cases during a regular graft (when ca is between cta and c2):
930 Consider this topology for a regular graft:
931
932 o c1
933 |
934 | o c2
935 | |
936 | o ca # stands for "common ancestor"
937 |/
938 o cta # stands for "common topological ancestor"
939
940 Note that in issue5343, ca==cta.
941
942 The following table shows the possible cases. Here, "x->y" and, equivalently,
943 "y<-x", where x is an ancestor of y, means that some copy happened from x to y.
931 944
932 945 name | c1<-cta | cta<->ca | ca->c2
933 946 A.0 | | |
934 947 A.1 | X | |
935 948 A.2 | | X |
936 949 A.3 | | | X
937 950 A.4 | X | X |
938 951 A.5 | X | | X
939 952 A.6 | | X | X
940 953 A.7 | X | X | X
941 954
942 955 A.0 is trivial, and doesn't need copy tracking.
943 956 For A.1, a forward rename is recorded in the c1 pass, to be followed later.
944 957 In A.2, the rename is recorded in the c2 pass and followed backwards.
945 958 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target.
946 959 In A.4, both passes of checkcopies record incomplete renames, which are
947 960 then joined in mergecopies to record a rename to be followed.
948 961 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass
949 962 records an incomplete divergence. The incomplete rename is then joined to the
950 963 appropriate side of the incomplete divergence, and the result is recorded as a
951 964 divergence. The code doesn't distinguish at all between these two cases, since
952 965 the end result of them is the same: an incomplete divergence joined with an
953 966 incomplete rename into a divergence.
954 967 Finally, A.6 records a divergence entirely in the c2 pass.
955 968
956 969 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all.
957 970 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge.
971 A.5 has issue5343 as a special case.
972 TODO: add test coverage for A.5
958 973 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious
959 974 incomplete divergence, which is in fact complete. This is handled later in
960 975 mergecopies.
961 976 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b,
962 977 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting,
963 978 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base
964 979 case, a<-b<-c->a is treated the same as a<-b<-b->a).
965 980
966 981 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the
967 982 same name on both branches, then the rename is backed out on one branch, and
968 983 the backout is grafted to the other branch. This creates a challenging rename
969 984 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft
970 985 source, respectively. Since rename detection will run on the c1 side for such a
971 986 sequence (as for technical reasons, we split the c1 and c2 sides not at the
972 987 graft CA, but rather at the topological CA), it will pick up a false rename,
973 988 and cause a spurious merge conflict. This false rename is always exactly the
974 989 reverse of the true rename that would be detected on the c2 side, so we can
975 990 correct for it by detecting this condition and reversing as necessary.
976 991
977 992 First, set up the repository with commits to be grafted
978 993
979 994 $ hg init ../graftmove
980 995 $ cd ../graftmove
981 996 $ echo c1a > f1a
982 997 $ echo c2a > f2a
983 998 $ echo c3a > f3a
984 999 $ echo c4a > f4a
985 1000 $ echo c5a > f5a
986 1001 $ hg ci -qAm A0
987 1002 $ hg mv f1a f1b
988 1003 $ hg mv f3a f3b
989 1004 $ hg mv f5a f5b
990 1005 $ hg ci -qAm B0
991 1006 $ echo c1c > f1b
992 1007 $ hg mv f2a f2c
993 1008 $ hg mv f5b f5a
994 1009 $ echo c5c > f5a
995 1010 $ hg ci -qAm C0
996 1011 $ hg mv f3b f3d
997 1012 $ echo c4d > f4a
998 1013 $ hg ci -qAm D0
999 1014 $ hg log -G
1000 1015 @ changeset: 3:b69f5839d2d9
1001 1016 | tag: tip
1002 1017 | user: test
1003 1018 | date: Thu Jan 01 00:00:00 1970 +0000
1004 1019 | summary: D0
1005 1020 |
1006 1021 o changeset: 2:f58c7e2b28fa
1007 1022 | user: test
1008 1023 | date: Thu Jan 01 00:00:00 1970 +0000
1009 1024 | summary: C0
1010 1025 |
1011 1026 o changeset: 1:3d7bba921b5d
1012 1027 | user: test
1013 1028 | date: Thu Jan 01 00:00:00 1970 +0000
1014 1029 | summary: B0
1015 1030 |
1016 1031 o changeset: 0:11f7a1b56675
1017 1032 user: test
1018 1033 date: Thu Jan 01 00:00:00 1970 +0000
1019 1034 summary: A0
1020 1035
1021 1036
1022 1037 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the
1023 1038 two renames actually converge to the same name (thus no actual divergence).
1024 1039
1025 1040 $ hg up -q 'desc("A0")'
1026 1041 $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit
1027 1042 grafting 2:f58c7e2b28fa "C0"
1028 1043 merging f1a and f1b to f1a
1029 1044 merging f5a
1030 1045 warning: can't find ancestor for 'f5a' copied from 'f5b'!
1031 1046 $ hg status --change .
1032 1047 M f1a
1033 1048 M f5a
1034 1049 A f2c
1035 1050 R f2a
1036 1051 $ hg cat f1a
1037 1052 c1c
1038 1053 $ hg cat f1b
1039 1054 f1b: no such file in rev c9763722f9bd
1040 1055 [1]
1041 1056
1042 1057 Test the cases A.0 (f4x) and A.6 (f3x)
1043 1058
1044 1059 $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit
1045 1060 grafting 3:b69f5839d2d9 "D0"
1046 1061 note: possible conflict - f3b was renamed multiple times to:
1047 1062 f3d
1048 1063 f3a
1049 1064 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1050 1065
1051 1066 Set up the repository for some further tests
1052 1067
1053 1068 $ hg up -q "min(desc("A0"))"
1054 1069 $ hg mv f1a f1e
1055 1070 $ echo c2e > f2a
1056 1071 $ hg mv f3a f3e
1057 1072 $ hg mv f4a f4e
1058 1073 $ hg mv f5a f5b
1059 1074 $ hg ci -qAm "E0"
1060 1075 $ hg log -G
1061 1076 @ changeset: 6:6bd1736cab86
1062 1077 | tag: tip
1063 1078 | parent: 0:11f7a1b56675
1064 1079 | user: test
1065 1080 | date: Thu Jan 01 00:00:00 1970 +0000
1066 1081 | summary: E0
1067 1082 |
1068 1083 | o changeset: 5:560daee679da
1069 1084 | | user: test
1070 1085 | | date: Thu Jan 01 00:00:00 1970 +0000
1071 1086 | | summary: D1
1072 1087 | |
1073 1088 | o changeset: 4:c9763722f9bd
1074 1089 |/ parent: 0:11f7a1b56675
1075 1090 | user: test
1076 1091 | date: Thu Jan 01 00:00:00 1970 +0000
1077 1092 | summary: C1
1078 1093 |
1079 1094 | o changeset: 3:b69f5839d2d9
1080 1095 | | user: test
1081 1096 | | date: Thu Jan 01 00:00:00 1970 +0000
1082 1097 | | summary: D0
1083 1098 | |
1084 1099 | o changeset: 2:f58c7e2b28fa
1085 1100 | | user: test
1086 1101 | | date: Thu Jan 01 00:00:00 1970 +0000
1087 1102 | | summary: C0
1088 1103 | |
1089 1104 | o changeset: 1:3d7bba921b5d
1090 1105 |/ user: test
1091 1106 | date: Thu Jan 01 00:00:00 1970 +0000
1092 1107 | summary: B0
1093 1108 |
1094 1109 o changeset: 0:11f7a1b56675
1095 1110 user: test
1096 1111 date: Thu Jan 01 00:00:00 1970 +0000
1097 1112 summary: A0
1098 1113
1099 1114
1100 1115 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x),
1101 1116 and A.3 with a local content change to be preserved (f2x).
1102 1117
1103 1118 $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit
1104 1119 grafting 2:f58c7e2b28fa "C0"
1105 1120 merging f1e and f1b to f1e
1106 1121 merging f2a and f2c to f2c
1107 1122 merging f5b and f5a to f5a
1108 1123
1109 1124 Test the cases A.1 (f4x) and A.7 (f3x).
1110 1125
1111 1126 $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit
1112 1127 grafting 3:b69f5839d2d9 "D0"
1113 1128 note: possible conflict - f3b was renamed multiple times to:
1114 1129 f3e
1115 1130 f3d
1116 1131 merging f4e and f4a to f4e
1117 1132 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1118 1133
1119 1134 Check the results of the grafts tested
1120 1135
1121 1136 $ hg log -CGv --patch --git
1122 1137 @ changeset: 8:93ee502e8b0a
1123 1138 | tag: tip
1124 1139 | user: test
1125 1140 | date: Thu Jan 01 00:00:00 1970 +0000
1126 1141 | files: f3d f4e
1127 1142 | description:
1128 1143 | D2
1129 1144 |
1130 1145 |
1131 1146 | diff --git a/f3d b/f3d
1132 1147 | new file mode 100644
1133 1148 | --- /dev/null
1134 1149 | +++ b/f3d
1135 1150 | @@ -0,0 +1,1 @@
1136 1151 | +c3a
1137 1152 | diff --git a/f4e b/f4e
1138 1153 | --- a/f4e
1139 1154 | +++ b/f4e
1140 1155 | @@ -1,1 +1,1 @@
1141 1156 | -c4a
1142 1157 | +c4d
1143 1158 |
1144 1159 o changeset: 7:539cf145f496
1145 1160 | user: test
1146 1161 | date: Thu Jan 01 00:00:00 1970 +0000
1147 1162 | files: f1e f2a f2c f5a f5b
1148 1163 | copies: f2c (f2a) f5a (f5b)
1149 1164 | description:
1150 1165 | C2
1151 1166 |
1152 1167 |
1153 1168 | diff --git a/f1e b/f1e
1154 1169 | --- a/f1e
1155 1170 | +++ b/f1e
1156 1171 | @@ -1,1 +1,1 @@
1157 1172 | -c1a
1158 1173 | +c1c
1159 1174 | diff --git a/f2a b/f2c
1160 1175 | rename from f2a
1161 1176 | rename to f2c
1162 1177 | diff --git a/f5b b/f5a
1163 1178 | rename from f5b
1164 1179 | rename to f5a
1165 1180 | --- a/f5b
1166 1181 | +++ b/f5a
1167 1182 | @@ -1,1 +1,1 @@
1168 1183 | -c5a
1169 1184 | +c5c
1170 1185 |
1171 1186 o changeset: 6:6bd1736cab86
1172 1187 | parent: 0:11f7a1b56675
1173 1188 | user: test
1174 1189 | date: Thu Jan 01 00:00:00 1970 +0000
1175 1190 | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b
1176 1191 | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a)
1177 1192 | description:
1178 1193 | E0
1179 1194 |
1180 1195 |
1181 1196 | diff --git a/f1a b/f1e
1182 1197 | rename from f1a
1183 1198 | rename to f1e
1184 1199 | diff --git a/f2a b/f2a
1185 1200 | --- a/f2a
1186 1201 | +++ b/f2a
1187 1202 | @@ -1,1 +1,1 @@
1188 1203 | -c2a
1189 1204 | +c2e
1190 1205 | diff --git a/f3a b/f3e
1191 1206 | rename from f3a
1192 1207 | rename to f3e
1193 1208 | diff --git a/f4a b/f4e
1194 1209 | rename from f4a
1195 1210 | rename to f4e
1196 1211 | diff --git a/f5a b/f5b
1197 1212 | rename from f5a
1198 1213 | rename to f5b
1199 1214 |
1200 1215 | o changeset: 5:560daee679da
1201 1216 | | user: test
1202 1217 | | date: Thu Jan 01 00:00:00 1970 +0000
1203 1218 | | files: f3d f4a
1204 1219 | | description:
1205 1220 | | D1
1206 1221 | |
1207 1222 | |
1208 1223 | | diff --git a/f3d b/f3d
1209 1224 | | new file mode 100644
1210 1225 | | --- /dev/null
1211 1226 | | +++ b/f3d
1212 1227 | | @@ -0,0 +1,1 @@
1213 1228 | | +c3a
1214 1229 | | diff --git a/f4a b/f4a
1215 1230 | | --- a/f4a
1216 1231 | | +++ b/f4a
1217 1232 | | @@ -1,1 +1,1 @@
1218 1233 | | -c4a
1219 1234 | | +c4d
1220 1235 | |
1221 1236 | o changeset: 4:c9763722f9bd
1222 1237 |/ parent: 0:11f7a1b56675
1223 1238 | user: test
1224 1239 | date: Thu Jan 01 00:00:00 1970 +0000
1225 1240 | files: f1a f2a f2c f5a
1226 1241 | copies: f2c (f2a)
1227 1242 | description:
1228 1243 | C1
1229 1244 |
1230 1245 |
1231 1246 | diff --git a/f1a b/f1a
1232 1247 | --- a/f1a
1233 1248 | +++ b/f1a
1234 1249 | @@ -1,1 +1,1 @@
1235 1250 | -c1a
1236 1251 | +c1c
1237 1252 | diff --git a/f2a b/f2c
1238 1253 | rename from f2a
1239 1254 | rename to f2c
1240 1255 | diff --git a/f5a b/f5a
1241 1256 | --- a/f5a
1242 1257 | +++ b/f5a
1243 1258 | @@ -1,1 +1,1 @@
1244 1259 | -c5a
1245 1260 | +c5c
1246 1261 |
1247 1262 | o changeset: 3:b69f5839d2d9
1248 1263 | | user: test
1249 1264 | | date: Thu Jan 01 00:00:00 1970 +0000
1250 1265 | | files: f3b f3d f4a
1251 1266 | | copies: f3d (f3b)
1252 1267 | | description:
1253 1268 | | D0
1254 1269 | |
1255 1270 | |
1256 1271 | | diff --git a/f3b b/f3d
1257 1272 | | rename from f3b
1258 1273 | | rename to f3d
1259 1274 | | diff --git a/f4a b/f4a
1260 1275 | | --- a/f4a
1261 1276 | | +++ b/f4a
1262 1277 | | @@ -1,1 +1,1 @@
1263 1278 | | -c4a
1264 1279 | | +c4d
1265 1280 | |
1266 1281 | o changeset: 2:f58c7e2b28fa
1267 1282 | | user: test
1268 1283 | | date: Thu Jan 01 00:00:00 1970 +0000
1269 1284 | | files: f1b f2a f2c f5a f5b
1270 1285 | | copies: f2c (f2a) f5a (f5b)
1271 1286 | | description:
1272 1287 | | C0
1273 1288 | |
1274 1289 | |
1275 1290 | | diff --git a/f1b b/f1b
1276 1291 | | --- a/f1b
1277 1292 | | +++ b/f1b
1278 1293 | | @@ -1,1 +1,1 @@
1279 1294 | | -c1a
1280 1295 | | +c1c
1281 1296 | | diff --git a/f2a b/f2c
1282 1297 | | rename from f2a
1283 1298 | | rename to f2c
1284 1299 | | diff --git a/f5b b/f5a
1285 1300 | | rename from f5b
1286 1301 | | rename to f5a
1287 1302 | | --- a/f5b
1288 1303 | | +++ b/f5a
1289 1304 | | @@ -1,1 +1,1 @@
1290 1305 | | -c5a
1291 1306 | | +c5c
1292 1307 | |
1293 1308 | o changeset: 1:3d7bba921b5d
1294 1309 |/ user: test
1295 1310 | date: Thu Jan 01 00:00:00 1970 +0000
1296 1311 | files: f1a f1b f3a f3b f5a f5b
1297 1312 | copies: f1b (f1a) f3b (f3a) f5b (f5a)
1298 1313 | description:
1299 1314 | B0
1300 1315 |
1301 1316 |
1302 1317 | diff --git a/f1a b/f1b
1303 1318 | rename from f1a
1304 1319 | rename to f1b
1305 1320 | diff --git a/f3a b/f3b
1306 1321 | rename from f3a
1307 1322 | rename to f3b
1308 1323 | diff --git a/f5a b/f5b
1309 1324 | rename from f5a
1310 1325 | rename to f5b
1311 1326 |
1312 1327 o changeset: 0:11f7a1b56675
1313 1328 user: test
1314 1329 date: Thu Jan 01 00:00:00 1970 +0000
1315 1330 files: f1a f2a f3a f4a f5a
1316 1331 description:
1317 1332 A0
1318 1333
1319 1334
1320 1335 diff --git a/f1a b/f1a
1321 1336 new file mode 100644
1322 1337 --- /dev/null
1323 1338 +++ b/f1a
1324 1339 @@ -0,0 +1,1 @@
1325 1340 +c1a
1326 1341 diff --git a/f2a b/f2a
1327 1342 new file mode 100644
1328 1343 --- /dev/null
1329 1344 +++ b/f2a
1330 1345 @@ -0,0 +1,1 @@
1331 1346 +c2a
1332 1347 diff --git a/f3a b/f3a
1333 1348 new file mode 100644
1334 1349 --- /dev/null
1335 1350 +++ b/f3a
1336 1351 @@ -0,0 +1,1 @@
1337 1352 +c3a
1338 1353 diff --git a/f4a b/f4a
1339 1354 new file mode 100644
1340 1355 --- /dev/null
1341 1356 +++ b/f4a
1342 1357 @@ -0,0 +1,1 @@
1343 1358 +c4a
1344 1359 diff --git a/f5a b/f5a
1345 1360 new file mode 100644
1346 1361 --- /dev/null
1347 1362 +++ b/f5a
1348 1363 @@ -0,0 +1,1 @@
1349 1364 +c5a
1350 1365
1351 1366 $ hg cat f2c
1352 1367 c2e
1353 1368
1354 1369 Check superfluous filemerge of files renamed in the past but untouched by graft
1355 1370
1356 1371 $ echo a > a
1357 1372 $ hg ci -qAma
1358 1373 $ hg mv a b
1359 1374 $ echo b > b
1360 1375 $ hg ci -qAmb
1361 1376 $ echo c > c
1362 1377 $ hg ci -qAmc
1363 1378 $ hg up -q .~2
1364 1379 $ hg graft tip -qt:fail
1365 1380
1366 1381 $ cd ..
1367 1382
1368 1383 Graft a change into a new file previously grafted into a renamed directory
1369 1384
1370 1385 $ hg init dirmovenewfile
1371 1386 $ cd dirmovenewfile
1372 1387 $ mkdir a
1373 1388 $ echo a > a/a
1374 1389 $ hg ci -qAma
1375 1390 $ echo x > a/x
1376 1391 $ hg ci -qAmx
1377 1392 $ hg up -q 0
1378 1393 $ hg mv -q a b
1379 1394 $ hg ci -qAmb
1380 1395 $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
1381 1396 $ hg up -q 1
1382 1397 $ echo y > a/x
1383 1398 $ hg ci -qAmy
1384 1399 $ hg up -q 3
1385 1400 $ hg graft -q 4
1386 1401 $ hg status --change .
1387 1402 M b/x
1388 1403
1389 1404 Prepare for test of skipped changesets and how merges can influence it:
1390 1405
1391 1406 $ hg merge -q -r 1 --tool :local
1392 1407 $ hg ci -m m
1393 1408 $ echo xx >> b/x
1394 1409 $ hg ci -m xx
1395 1410
1396 1411 $ hg log -G -T '{rev} {desc|firstline}'
1397 1412 @ 7 xx
1398 1413 |
1399 1414 o 6 m
1400 1415 |\
1401 1416 | o 5 y
1402 1417 | |
1403 1418 +---o 4 y
1404 1419 | |
1405 1420 | o 3 x
1406 1421 | |
1407 1422 | o 2 b
1408 1423 | |
1409 1424 o | 1 x
1410 1425 |/
1411 1426 o 0 a
1412 1427
1413 1428 Grafting of plain changes correctly detects that 3 and 5 should be skipped:
1414 1429
1415 1430 $ hg up -qCr 4
1416 1431 $ hg graft --tool :local -r 2::5
1417 1432 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1418 1433 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1419 1434 grafting 2:42127f193bcd "b"
1420 1435
1421 1436 Extending the graft range to include a (skipped) merge of 3 will not prevent us from
1422 1437 also detecting that both 3 and 5 should be skipped:
1423 1438
1424 1439 $ hg up -qCr 4
1425 1440 $ hg graft --tool :local -r 2::7
1426 1441 skipping ungraftable merge revision 6
1427 1442 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1428 1443 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1429 1444 grafting 2:42127f193bcd "b"
1430 1445 grafting 7:d3c3f2b38ecc "xx"
1431 1446 note: graft of 7:d3c3f2b38ecc created no changes to commit
1432 1447
1433 1448 $ cd ..
1434 1449
1435 1450 Grafted revision should be warned and skipped only once. (issue6024)
1436 1451
1437 1452 $ mkdir issue6024
1438 1453 $ cd issue6024
1439 1454
1440 1455 $ hg init base
1441 1456 $ cd base
1442 1457 $ touch x
1443 1458 $ hg commit -qAminit
1444 1459 $ echo a > x
1445 1460 $ hg commit -mchange
1446 1461 $ hg update -q 0
1447 1462 $ hg graft -r 1
1448 1463 grafting 1:a0b923c546aa "change" (tip)
1449 1464 $ cd ..
1450 1465
1451 1466 $ hg clone -qr 2 base clone
1452 1467 $ cd clone
1453 1468 $ hg pull -q
1454 1469 $ hg merge -q 2
1455 1470 $ hg commit -mmerge
1456 1471 $ hg update -q 0
1457 1472 $ hg graft -r 1
1458 1473 grafting 1:04fc6d444368 "change"
1459 1474 $ hg update -q 3
1460 1475 $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n'
1461 1476 o 4:4e16 <- a0b9
1462 1477 |
1463 1478 | @ 3:f0ac <-
1464 1479 | |\
1465 1480 +---o 2:a0b9 <-
1466 1481 | |
1467 1482 | o 1:04fc <- a0b9
1468 1483 |/
1469 1484 o 0:7848 <-
1470 1485
1471 1486
1472 1487 the source of rev 4 is an ancestor of the working parent, and was also
1473 1488 grafted as rev 1. it should be stripped from the target revisions only once.
1474 1489
1475 1490 $ hg graft -r 4
1476 1491 skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa)
1477 1492 [255]
1478 1493
1479 1494 $ cd ../..
1480 1495
1481 1496 Testing the reading of old format graftstate file with newer mercurial
1482 1497
1483 1498 $ hg init oldgraft
1484 1499 $ cd oldgraft
1485 1500 $ for ch in a b c; do echo foo > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1486 1501 $ hg log -GT "{rev}:{node|short} {desc}\n"
1487 1502 @ 2:8be98ac1a569 added c
1488 1503 |
1489 1504 o 1:80e6d2c47cfe added b
1490 1505 |
1491 1506 o 0:f7ad41964313 added a
1492 1507
1493 1508 $ hg up 0
1494 1509 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1495 1510 $ echo bar > b
1496 1511 $ hg add b
1497 1512 $ hg ci -m "bar to b"
1498 1513 created new head
1499 1514 $ hg graft -r 1 -r 2
1500 1515 grafting 1:80e6d2c47cfe "added b"
1501 1516 merging b
1502 1517 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1503 1518 abort: unresolved conflicts, can't continue
1504 1519 (use 'hg resolve' and 'hg graft --continue')
1505 1520 [255]
1506 1521
1507 1522 Writing the nodes in old format to graftstate
1508 1523
1509 1524 $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate
1510 1525 $ echo foo > b
1511 1526 $ hg resolve -m
1512 1527 (no more unresolved files)
1513 1528 continue: hg graft --continue
1514 1529 $ hg graft --continue
1515 1530 grafting 1:80e6d2c47cfe "added b"
1516 1531 grafting 2:8be98ac1a569 "added c"
1517 1532
1518 1533 Testing that --user is preserved during conflicts and value is reused while
1519 1534 running `hg graft --continue`
1520 1535
1521 1536 $ hg log -G
1522 1537 @ changeset: 5:711e9fa999f1
1523 1538 | tag: tip
1524 1539 | user: test
1525 1540 | date: Thu Jan 01 00:00:00 1970 +0000
1526 1541 | summary: added c
1527 1542 |
1528 1543 o changeset: 4:e5ad7353b408
1529 1544 | user: test
1530 1545 | date: Thu Jan 01 00:00:00 1970 +0000
1531 1546 | summary: added b
1532 1547 |
1533 1548 o changeset: 3:9e887f7a939c
1534 1549 | parent: 0:f7ad41964313
1535 1550 | user: test
1536 1551 | date: Thu Jan 01 00:00:00 1970 +0000
1537 1552 | summary: bar to b
1538 1553 |
1539 1554 | o changeset: 2:8be98ac1a569
1540 1555 | | user: test
1541 1556 | | date: Thu Jan 01 00:00:00 1970 +0000
1542 1557 | | summary: added c
1543 1558 | |
1544 1559 | o changeset: 1:80e6d2c47cfe
1545 1560 |/ user: test
1546 1561 | date: Thu Jan 01 00:00:00 1970 +0000
1547 1562 | summary: added b
1548 1563 |
1549 1564 o changeset: 0:f7ad41964313
1550 1565 user: test
1551 1566 date: Thu Jan 01 00:00:00 1970 +0000
1552 1567 summary: added a
1553 1568
1554 1569
1555 1570 $ hg up '.^^'
1556 1571 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1557 1572
1558 1573 $ hg graft -r 1 -r 2 --user batman
1559 1574 grafting 1:80e6d2c47cfe "added b"
1560 1575 merging b
1561 1576 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1562 1577 abort: unresolved conflicts, can't continue
1563 1578 (use 'hg resolve' and 'hg graft --continue')
1564 1579 [255]
1565 1580
1566 1581 $ echo wat > b
1567 1582 $ hg resolve -m
1568 1583 (no more unresolved files)
1569 1584 continue: hg graft --continue
1570 1585
1571 1586 $ hg graft --continue
1572 1587 grafting 1:80e6d2c47cfe "added b"
1573 1588 grafting 2:8be98ac1a569 "added c"
1574 1589
1575 1590 $ hg log -Gr 3::
1576 1591 @ changeset: 7:11a36ffaacf2
1577 1592 | tag: tip
1578 1593 | user: batman
1579 1594 | date: Thu Jan 01 00:00:00 1970 +0000
1580 1595 | summary: added c
1581 1596 |
1582 1597 o changeset: 6:76803afc6511
1583 1598 | parent: 3:9e887f7a939c
1584 1599 | user: batman
1585 1600 | date: Thu Jan 01 00:00:00 1970 +0000
1586 1601 | summary: added b
1587 1602 |
1588 1603 | o changeset: 5:711e9fa999f1
1589 1604 | | user: test
1590 1605 | | date: Thu Jan 01 00:00:00 1970 +0000
1591 1606 | | summary: added c
1592 1607 | |
1593 1608 | o changeset: 4:e5ad7353b408
1594 1609 |/ user: test
1595 1610 | date: Thu Jan 01 00:00:00 1970 +0000
1596 1611 | summary: added b
1597 1612 |
1598 1613 o changeset: 3:9e887f7a939c
1599 1614 | parent: 0:f7ad41964313
1600 1615 ~ user: test
1601 1616 date: Thu Jan 01 00:00:00 1970 +0000
1602 1617 summary: bar to b
1603 1618
1604 1619 Test that --date is preserved and reused in `hg graft --continue`
1605 1620
1606 1621 $ hg up '.^^'
1607 1622 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1608 1623 $ hg graft -r 1 -r 2 --date '1234560000 120'
1609 1624 grafting 1:80e6d2c47cfe "added b"
1610 1625 merging b
1611 1626 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1612 1627 abort: unresolved conflicts, can't continue
1613 1628 (use 'hg resolve' and 'hg graft --continue')
1614 1629 [255]
1615 1630
1616 1631 $ echo foobar > b
1617 1632 $ hg resolve -m
1618 1633 (no more unresolved files)
1619 1634 continue: hg graft --continue
1620 1635 $ hg graft --continue
1621 1636 grafting 1:80e6d2c47cfe "added b"
1622 1637 grafting 2:8be98ac1a569 "added c"
1623 1638
1624 1639 $ hg log -Gr '.^^::.'
1625 1640 @ changeset: 9:1896b76e007a
1626 1641 | tag: tip
1627 1642 | user: test
1628 1643 | date: Fri Feb 13 21:18:00 2009 -0002
1629 1644 | summary: added c
1630 1645 |
1631 1646 o changeset: 8:ce2b4f1632af
1632 1647 | parent: 3:9e887f7a939c
1633 1648 | user: test
1634 1649 | date: Fri Feb 13 21:18:00 2009 -0002
1635 1650 | summary: added b
1636 1651 |
1637 1652 o changeset: 3:9e887f7a939c
1638 1653 | parent: 0:f7ad41964313
1639 1654 ~ user: test
1640 1655 date: Thu Jan 01 00:00:00 1970 +0000
1641 1656 summary: bar to b
1642 1657
1643 1658 Test that --log is preserved and reused in `hg graft --continue`
1644 1659
1645 1660 $ hg up '.^^'
1646 1661 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1647 1662 $ hg graft -r 1 -r 2 --log
1648 1663 grafting 1:80e6d2c47cfe "added b"
1649 1664 merging b
1650 1665 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1651 1666 abort: unresolved conflicts, can't continue
1652 1667 (use 'hg resolve' and 'hg graft --continue')
1653 1668 [255]
1654 1669
1655 1670 $ echo foobar > b
1656 1671 $ hg resolve -m
1657 1672 (no more unresolved files)
1658 1673 continue: hg graft --continue
1659 1674
1660 1675 $ hg graft --continue
1661 1676 grafting 1:80e6d2c47cfe "added b"
1662 1677 grafting 2:8be98ac1a569 "added c"
1663 1678
1664 1679 $ hg log -GT "{rev}:{node|short} {desc}" -r '.^^::.'
1665 1680 @ 11:30c1050a58b2 added c
1666 1681 | (grafted from 8be98ac1a56990c2d9ca6861041b8390af7bd6f3)
1667 1682 o 10:ec7eda2313e2 added b
1668 1683 | (grafted from 80e6d2c47cfe5b3185519568327a17a061c7efb6)
1669 1684 o 3:9e887f7a939c bar to b
1670 1685 |
1671 1686 ~
1672 1687
1673 1688 $ cd ..
1674 1689
1675 1690 Testing the --stop flag of `hg graft` which stops the interrupted graft
1676 1691
1677 1692 $ hg init stopgraft
1678 1693 $ cd stopgraft
1679 1694 $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1680 1695
1681 1696 $ hg log -G
1682 1697 @ changeset: 3:9150fe93bec6
1683 1698 | tag: tip
1684 1699 | user: test
1685 1700 | date: Thu Jan 01 00:00:00 1970 +0000
1686 1701 | summary: added d
1687 1702 |
1688 1703 o changeset: 2:155349b645be
1689 1704 | user: test
1690 1705 | date: Thu Jan 01 00:00:00 1970 +0000
1691 1706 | summary: added c
1692 1707 |
1693 1708 o changeset: 1:5f6d8a4bf34a
1694 1709 | user: test
1695 1710 | date: Thu Jan 01 00:00:00 1970 +0000
1696 1711 | summary: added b
1697 1712 |
1698 1713 o changeset: 0:9092f1db7931
1699 1714 user: test
1700 1715 date: Thu Jan 01 00:00:00 1970 +0000
1701 1716 summary: added a
1702 1717
1703 1718 $ hg up '.^^'
1704 1719 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1705 1720
1706 1721 $ echo foo > d
1707 1722 $ hg ci -Aqm "added foo to d"
1708 1723
1709 1724 $ hg graft --stop
1710 1725 abort: no interrupted graft found
1711 1726 [255]
1712 1727
1713 1728 $ hg graft -r 3
1714 1729 grafting 3:9150fe93bec6 "added d"
1715 1730 merging d
1716 1731 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1717 1732 abort: unresolved conflicts, can't continue
1718 1733 (use 'hg resolve' and 'hg graft --continue')
1719 1734 [255]
1720 1735
1721 1736 $ hg graft --stop --continue
1722 1737 abort: cannot use '--continue' and '--stop' together
1723 1738 [255]
1724 1739
1725 1740 $ hg graft --stop -U
1726 1741 abort: cannot specify any other flag with '--stop'
1727 1742 [255]
1728 1743 $ hg graft --stop --rev 4
1729 1744 abort: cannot specify any other flag with '--stop'
1730 1745 [255]
1731 1746 $ hg graft --stop --log
1732 1747 abort: cannot specify any other flag with '--stop'
1733 1748 [255]
1734 1749
1735 1750 $ hg graft --stop
1736 1751 stopped the interrupted graft
1737 1752 working directory is now at a0deacecd59d
1738 1753
1739 1754 $ hg diff
1740 1755
1741 1756 $ hg log -Gr '.'
1742 1757 @ changeset: 4:a0deacecd59d
1743 1758 | tag: tip
1744 1759 ~ parent: 1:5f6d8a4bf34a
1745 1760 user: test
1746 1761 date: Thu Jan 01 00:00:00 1970 +0000
1747 1762 summary: added foo to d
1748 1763
1749 1764 $ hg graft -r 2 -r 3
1750 1765 grafting 2:155349b645be "added c"
1751 1766 grafting 3:9150fe93bec6 "added d"
1752 1767 merging d
1753 1768 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1754 1769 abort: unresolved conflicts, can't continue
1755 1770 (use 'hg resolve' and 'hg graft --continue')
1756 1771 [255]
1757 1772
1758 1773 $ hg graft --stop
1759 1774 stopped the interrupted graft
1760 1775 working directory is now at 75b447541a9e
1761 1776
1762 1777 $ hg diff
1763 1778
1764 1779 $ hg log -G -T "{rev}:{node|short} {desc}"
1765 1780 @ 5:75b447541a9e added c
1766 1781 |
1767 1782 o 4:a0deacecd59d added foo to d
1768 1783 |
1769 1784 | o 3:9150fe93bec6 added d
1770 1785 | |
1771 1786 | o 2:155349b645be added c
1772 1787 |/
1773 1788 o 1:5f6d8a4bf34a added b
1774 1789 |
1775 1790 o 0:9092f1db7931 added a
1776 1791
1777 1792 $ cd ..
1778 1793
1779 1794 Testing the --abort flag for `hg graft` which aborts and rollback to state
1780 1795 before the graft
1781 1796
1782 1797 $ hg init abortgraft
1783 1798 $ cd abortgraft
1784 1799 $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1785 1800
1786 1801 $ hg up '.^^'
1787 1802 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1788 1803
1789 1804 $ echo x > x
1790 1805 $ hg ci -Aqm "added x"
1791 1806 $ hg up '.^'
1792 1807 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1793 1808 $ echo foo > c
1794 1809 $ hg ci -Aqm "added foo to c"
1795 1810
1796 1811 $ hg log -GT "{rev}:{node|short} {desc}"
1797 1812 @ 5:36b793615f78 added foo to c
1798 1813 |
1799 1814 | o 4:863a25e1a9ea added x
1800 1815 |/
1801 1816 | o 3:9150fe93bec6 added d
1802 1817 | |
1803 1818 | o 2:155349b645be added c
1804 1819 |/
1805 1820 o 1:5f6d8a4bf34a added b
1806 1821 |
1807 1822 o 0:9092f1db7931 added a
1808 1823
1809 1824 $ hg up 9150fe93bec6
1810 1825 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1811 1826
1812 1827 $ hg graft --abort
1813 1828 abort: no interrupted graft to abort
1814 1829 [255]
1815 1830
1816 1831 when stripping is required
1817 1832 $ hg graft -r 4 -r 5
1818 1833 grafting 4:863a25e1a9ea "added x"
1819 1834 grafting 5:36b793615f78 "added foo to c" (tip)
1820 1835 merging c
1821 1836 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
1822 1837 abort: unresolved conflicts, can't continue
1823 1838 (use 'hg resolve' and 'hg graft --continue')
1824 1839 [255]
1825 1840
1826 1841 $ hg graft --continue --abort
1827 1842 abort: cannot use '--continue' and '--abort' together
1828 1843 [255]
1829 1844
1830 1845 $ hg graft --abort --stop
1831 1846 abort: cannot use '--abort' and '--stop' together
1832 1847 [255]
1833 1848
1834 1849 $ hg graft --abort --currentuser
1835 1850 abort: cannot specify any other flag with '--abort'
1836 1851 [255]
1837 1852
1838 1853 $ hg graft --abort --edit
1839 1854 abort: cannot specify any other flag with '--abort'
1840 1855 [255]
1841 1856
1842 1857 $ hg graft --abort
1843 1858 graft aborted
1844 1859 working directory is now at 9150fe93bec6
1845 1860 $ hg log -GT "{rev}:{node|short} {desc}"
1846 1861 o 5:36b793615f78 added foo to c
1847 1862 |
1848 1863 | o 4:863a25e1a9ea added x
1849 1864 |/
1850 1865 | @ 3:9150fe93bec6 added d
1851 1866 | |
1852 1867 | o 2:155349b645be added c
1853 1868 |/
1854 1869 o 1:5f6d8a4bf34a added b
1855 1870 |
1856 1871 o 0:9092f1db7931 added a
1857 1872
1858 1873 when stripping is not required
1859 1874 $ hg graft -r 5
1860 1875 grafting 5:36b793615f78 "added foo to c" (tip)
1861 1876 merging c
1862 1877 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
1863 1878 abort: unresolved conflicts, can't continue
1864 1879 (use 'hg resolve' and 'hg graft --continue')
1865 1880 [255]
1866 1881
1867 1882 $ hg graft --abort
1868 1883 graft aborted
1869 1884 working directory is now at 9150fe93bec6
1870 1885 $ hg log -GT "{rev}:{node|short} {desc}"
1871 1886 o 5:36b793615f78 added foo to c
1872 1887 |
1873 1888 | o 4:863a25e1a9ea added x
1874 1889 |/
1875 1890 | @ 3:9150fe93bec6 added d
1876 1891 | |
1877 1892 | o 2:155349b645be added c
1878 1893 |/
1879 1894 o 1:5f6d8a4bf34a added b
1880 1895 |
1881 1896 o 0:9092f1db7931 added a
1882 1897
1883 1898 when some of the changesets became public
1884 1899
1885 1900 $ hg graft -r 4 -r 5
1886 1901 grafting 4:863a25e1a9ea "added x"
1887 1902 grafting 5:36b793615f78 "added foo to c" (tip)
1888 1903 merging c
1889 1904 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
1890 1905 abort: unresolved conflicts, can't continue
1891 1906 (use 'hg resolve' and 'hg graft --continue')
1892 1907 [255]
1893 1908
1894 1909 $ hg log -GT "{rev}:{node|short} {desc}"
1895 1910 @ 6:6ec71c037d94 added x
1896 1911 |
1897 1912 | o 5:36b793615f78 added foo to c
1898 1913 | |
1899 1914 | | o 4:863a25e1a9ea added x
1900 1915 | |/
1901 1916 o | 3:9150fe93bec6 added d
1902 1917 | |
1903 1918 o | 2:155349b645be added c
1904 1919 |/
1905 1920 o 1:5f6d8a4bf34a added b
1906 1921 |
1907 1922 o 0:9092f1db7931 added a
1908 1923
1909 1924 $ hg phase -r 6 --public
1910 1925
1911 1926 $ hg graft --abort
1912 1927 cannot clean up public changesets 6ec71c037d94
1913 1928 graft aborted
1914 1929 working directory is now at 6ec71c037d94
1915 1930
1916 1931 when we created new changesets on top of existing one
1917 1932
1918 1933 $ hg up '.^^'
1919 1934 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1920 1935 $ echo y > y
1921 1936 $ hg ci -Aqm "added y"
1922 1937 $ echo z > z
1923 1938 $ hg ci -Aqm "added z"
1924 1939
1925 1940 $ hg up 3
1926 1941 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
1927 1942 $ hg log -GT "{rev}:{node|short} {desc}"
1928 1943 o 8:637f9e9bbfd4 added z
1929 1944 |
1930 1945 o 7:123221671fd4 added y
1931 1946 |
1932 1947 | o 6:6ec71c037d94 added x
1933 1948 | |
1934 1949 | | o 5:36b793615f78 added foo to c
1935 1950 | | |
1936 1951 | | | o 4:863a25e1a9ea added x
1937 1952 | | |/
1938 1953 | @ | 3:9150fe93bec6 added d
1939 1954 |/ /
1940 1955 o / 2:155349b645be added c
1941 1956 |/
1942 1957 o 1:5f6d8a4bf34a added b
1943 1958 |
1944 1959 o 0:9092f1db7931 added a
1945 1960
1946 1961 $ hg graft -r 8 -r 7 -r 5
1947 1962 grafting 8:637f9e9bbfd4 "added z" (tip)
1948 1963 grafting 7:123221671fd4 "added y"
1949 1964 grafting 5:36b793615f78 "added foo to c"
1950 1965 merging c
1951 1966 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
1952 1967 abort: unresolved conflicts, can't continue
1953 1968 (use 'hg resolve' and 'hg graft --continue')
1954 1969 [255]
1955 1970
1956 1971 $ cd ..
1957 1972 $ hg init pullrepo
1958 1973 $ cd pullrepo
1959 1974 $ cat >> .hg/hgrc <<EOF
1960 1975 > [phases]
1961 1976 > publish=False
1962 1977 > EOF
1963 1978 $ hg pull ../abortgraft --config phases.publish=False
1964 1979 pulling from ../abortgraft
1965 1980 requesting all changes
1966 1981 adding changesets
1967 1982 adding manifests
1968 1983 adding file changes
1969 1984 added 11 changesets with 9 changes to 8 files (+4 heads)
1970 1985 new changesets 9092f1db7931:6b98ff0062dd (6 drafts)
1971 1986 (run 'hg heads' to see heads, 'hg merge' to merge)
1972 1987 $ hg up 9
1973 1988 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1974 1989 $ echo w > w
1975 1990 $ hg ci -Aqm "added w" --config phases.publish=False
1976 1991
1977 1992 $ cd ../abortgraft
1978 1993 $ hg pull ../pullrepo
1979 1994 pulling from ../pullrepo
1980 1995 searching for changes
1981 1996 adding changesets
1982 1997 adding manifests
1983 1998 adding file changes
1984 1999 added 1 changesets with 1 changes to 1 files (+1 heads)
1985 2000 new changesets 311dfc6cf3bf (1 drafts)
1986 2001 (run 'hg heads .' to see heads, 'hg merge' to merge)
1987 2002
1988 2003 $ hg graft --abort
1989 2004 new changesets detected on destination branch, can't strip
1990 2005 graft aborted
1991 2006 working directory is now at 6b98ff0062dd
1992 2007
1993 2008 $ cd ..
1994 2009
1995 2010 ============================
1996 2011 Testing --no-commit option:|
1997 2012 ============================
1998 2013
1999 2014 $ hg init nocommit
2000 2015 $ cd nocommit
2001 2016 $ echo a > a
2002 2017 $ hg ci -qAma
2003 2018 $ echo b > b
2004 2019 $ hg ci -qAmb
2005 2020 $ hg up -q 0
2006 2021 $ echo c > c
2007 2022 $ hg ci -qAmc
2008 2023 $ hg log -GT "{rev}:{node|short} {desc}\n"
2009 2024 @ 2:d36c0562f908 c
2010 2025 |
2011 2026 | o 1:d2ae7f538514 b
2012 2027 |/
2013 2028 o 0:cb9a9f314b8b a
2014 2029
2015 2030
2016 2031 Check reporting when --no-commit used with non-applicable options:
2017 2032
2018 2033 $ hg graft 1 --no-commit -e
2019 2034 abort: cannot specify --no-commit and --edit together
2020 2035 [255]
2021 2036
2022 2037 $ hg graft 1 --no-commit --log
2023 2038 abort: cannot specify --no-commit and --log together
2024 2039 [255]
2025 2040
2026 2041 $ hg graft 1 --no-commit -D
2027 2042 abort: cannot specify --no-commit and --currentdate together
2028 2043 [255]
2029 2044
2030 2045 Test --no-commit is working:
2031 2046 $ hg graft 1 --no-commit
2032 2047 grafting 1:d2ae7f538514 "b"
2033 2048
2034 2049 $ hg log -GT "{rev}:{node|short} {desc}\n"
2035 2050 @ 2:d36c0562f908 c
2036 2051 |
2037 2052 | o 1:d2ae7f538514 b
2038 2053 |/
2039 2054 o 0:cb9a9f314b8b a
2040 2055
2041 2056
2042 2057 $ hg diff
2043 2058 diff -r d36c0562f908 b
2044 2059 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2045 2060 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2046 2061 @@ -0,0 +1,1 @@
2047 2062 +b
2048 2063
2049 2064 Prepare wrdir to check --no-commit is resepected after --continue:
2050 2065
2051 2066 $ hg up -qC
2052 2067 $ echo A>a
2053 2068 $ hg ci -qm "A in file a"
2054 2069 $ hg up -q 1
2055 2070 $ echo B>a
2056 2071 $ hg ci -qm "B in file a"
2057 2072 $ hg log -GT "{rev}:{node|short} {desc}\n"
2058 2073 @ 4:2aa9ad1006ff B in file a
2059 2074 |
2060 2075 | o 3:09e253b87e17 A in file a
2061 2076 | |
2062 2077 | o 2:d36c0562f908 c
2063 2078 | |
2064 2079 o | 1:d2ae7f538514 b
2065 2080 |/
2066 2081 o 0:cb9a9f314b8b a
2067 2082
2068 2083
2069 2084 $ hg graft 3 --no-commit
2070 2085 grafting 3:09e253b87e17 "A in file a"
2071 2086 merging a
2072 2087 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2073 2088 abort: unresolved conflicts, can't continue
2074 2089 (use 'hg resolve' and 'hg graft --continue')
2075 2090 [255]
2076 2091
2077 2092 Resolve conflict:
2078 2093 $ echo A>a
2079 2094 $ hg resolve --mark
2080 2095 (no more unresolved files)
2081 2096 continue: hg graft --continue
2082 2097
2083 2098 $ hg graft --continue
2084 2099 grafting 3:09e253b87e17 "A in file a"
2085 2100 $ hg log -GT "{rev}:{node|short} {desc}\n"
2086 2101 @ 4:2aa9ad1006ff B in file a
2087 2102 |
2088 2103 | o 3:09e253b87e17 A in file a
2089 2104 | |
2090 2105 | o 2:d36c0562f908 c
2091 2106 | |
2092 2107 o | 1:d2ae7f538514 b
2093 2108 |/
2094 2109 o 0:cb9a9f314b8b a
2095 2110
2096 2111 $ hg diff
2097 2112 diff -r 2aa9ad1006ff a
2098 2113 --- a/a Thu Jan 01 00:00:00 1970 +0000
2099 2114 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2100 2115 @@ -1,1 +1,1 @@
2101 2116 -B
2102 2117 +A
2103 2118
2104 2119 $ hg up -qC
2105 2120
2106 2121 Check --no-commit is resepected when passed with --continue:
2107 2122
2108 2123 $ hg graft 3
2109 2124 grafting 3:09e253b87e17 "A in file a"
2110 2125 merging a
2111 2126 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2112 2127 abort: unresolved conflicts, can't continue
2113 2128 (use 'hg resolve' and 'hg graft --continue')
2114 2129 [255]
2115 2130
2116 2131 Resolve conflict:
2117 2132 $ echo A>a
2118 2133 $ hg resolve --mark
2119 2134 (no more unresolved files)
2120 2135 continue: hg graft --continue
2121 2136
2122 2137 $ hg graft --continue --no-commit
2123 2138 grafting 3:09e253b87e17 "A in file a"
2124 2139 $ hg diff
2125 2140 diff -r 2aa9ad1006ff a
2126 2141 --- a/a Thu Jan 01 00:00:00 1970 +0000
2127 2142 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2128 2143 @@ -1,1 +1,1 @@
2129 2144 -B
2130 2145 +A
2131 2146
2132 2147 $ hg log -GT "{rev}:{node|short} {desc}\n"
2133 2148 @ 4:2aa9ad1006ff B in file a
2134 2149 |
2135 2150 | o 3:09e253b87e17 A in file a
2136 2151 | |
2137 2152 | o 2:d36c0562f908 c
2138 2153 | |
2139 2154 o | 1:d2ae7f538514 b
2140 2155 |/
2141 2156 o 0:cb9a9f314b8b a
2142 2157
2143 2158 $ hg up -qC
2144 2159
2145 2160 Test --no-commit when graft multiple revisions:
2146 2161 When there is conflict:
2147 2162 $ hg graft -r "2::3" --no-commit
2148 2163 grafting 2:d36c0562f908 "c"
2149 2164 grafting 3:09e253b87e17 "A in file a"
2150 2165 merging a
2151 2166 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2152 2167 abort: unresolved conflicts, can't continue
2153 2168 (use 'hg resolve' and 'hg graft --continue')
2154 2169 [255]
2155 2170
2156 2171 $ echo A>a
2157 2172 $ hg resolve --mark
2158 2173 (no more unresolved files)
2159 2174 continue: hg graft --continue
2160 2175 $ hg graft --continue
2161 2176 grafting 3:09e253b87e17 "A in file a"
2162 2177 $ hg diff
2163 2178 diff -r 2aa9ad1006ff a
2164 2179 --- a/a Thu Jan 01 00:00:00 1970 +0000
2165 2180 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2166 2181 @@ -1,1 +1,1 @@
2167 2182 -B
2168 2183 +A
2169 2184 diff -r 2aa9ad1006ff c
2170 2185 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2171 2186 +++ b/c Thu Jan 01 00:00:00 1970 +0000
2172 2187 @@ -0,0 +1,1 @@
2173 2188 +c
2174 2189
2175 2190 $ hg log -GT "{rev}:{node|short} {desc}\n"
2176 2191 @ 4:2aa9ad1006ff B in file a
2177 2192 |
2178 2193 | o 3:09e253b87e17 A in file a
2179 2194 | |
2180 2195 | o 2:d36c0562f908 c
2181 2196 | |
2182 2197 o | 1:d2ae7f538514 b
2183 2198 |/
2184 2199 o 0:cb9a9f314b8b a
2185 2200
2186 2201 $ hg up -qC
2187 2202
2188 2203 When there is no conflict:
2189 2204 $ echo d>d
2190 2205 $ hg add d -q
2191 2206 $ hg ci -qmd
2192 2207 $ hg up 3 -q
2193 2208 $ hg log -GT "{rev}:{node|short} {desc}\n"
2194 2209 o 5:baefa8927fc0 d
2195 2210 |
2196 2211 o 4:2aa9ad1006ff B in file a
2197 2212 |
2198 2213 | @ 3:09e253b87e17 A in file a
2199 2214 | |
2200 2215 | o 2:d36c0562f908 c
2201 2216 | |
2202 2217 o | 1:d2ae7f538514 b
2203 2218 |/
2204 2219 o 0:cb9a9f314b8b a
2205 2220
2206 2221
2207 2222 $ hg graft -r 1 -r 5 --no-commit
2208 2223 grafting 1:d2ae7f538514 "b"
2209 2224 grafting 5:baefa8927fc0 "d" (tip)
2210 2225 $ hg diff
2211 2226 diff -r 09e253b87e17 b
2212 2227 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2213 2228 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2214 2229 @@ -0,0 +1,1 @@
2215 2230 +b
2216 2231 diff -r 09e253b87e17 d
2217 2232 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2218 2233 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2219 2234 @@ -0,0 +1,1 @@
2220 2235 +d
2221 2236 $ hg log -GT "{rev}:{node|short} {desc}\n"
2222 2237 o 5:baefa8927fc0 d
2223 2238 |
2224 2239 o 4:2aa9ad1006ff B in file a
2225 2240 |
2226 2241 | @ 3:09e253b87e17 A in file a
2227 2242 | |
2228 2243 | o 2:d36c0562f908 c
2229 2244 | |
2230 2245 o | 1:d2ae7f538514 b
2231 2246 |/
2232 2247 o 0:cb9a9f314b8b a
2233 2248
2234 2249 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now