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