##// 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,11 +1,5 b''
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]
@@ -13,1656 +7,6 b''
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
This diff has been collapsed as it changes many lines, (771 lines changed) Show them Hide them
@@ -1,18 +1,9 b''
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
@@ -1663,765 +1654,3 b' Grafted revision should be warned and sk'
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