##// END OF EJS Templates
tests: split out another ~1/2 of test-graft.t...
Martin von Zweigbergk -
r44493:fa808e65 default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (927 lines changed) Show them Hide them
@@ -1,927 +1,4 b''
1 $ cat >> $HGRCPATH <<EOF
2 > [extdiff]
3 > # for portability:
4 > pdiff = sh "$RUNTESTDIR/pdiff"
5 > EOF
6
1
7 Create a repo with some stuff in it:
8
9 $ hg init a
10 $ cd a
11 $ echo a > a
12 $ echo a > d
13 $ echo a > e
14 $ hg ci -qAm0
15 $ echo b > a
16 $ hg ci -m1 -u bar
17 $ hg mv a b
18 $ hg ci -m2
19 $ hg cp b c
20 $ hg ci -m3 -u baz
21 $ echo b > d
22 $ echo f > e
23 $ hg ci -m4
24 $ hg up -q 3
25 $ echo b > e
26 $ hg branch -q stable
27 $ hg ci -m5
28 $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4
29 $ hg branch -q default
30 $ hg ci -m6
31 $ hg phase --public 3
32 $ hg phase --force --secret 6
33
34 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
35 @ test@6.secret: 6
36 |\
37 | o test@5.draft: 5
38 | |
39 o | test@4.draft: 4
40 |/
41 o baz@3.public: 3
42 |
43 o test@2.public: 2
44 |
45 o bar@1.public: 1
46 |
47 o test@0.public: 0
48
49 Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d
50
51 $ hg up -cqr 3
52 $ hg graft -r 6 --base 5
53 grafting 6:25a2b029d3ae "6" (tip)
54 merging e
55 $ hg st --change .
56 M d
57
58 $ hg -q strip . --config extensions.strip=
59
60 Test --base for collapsing changesets 2 and 3, thus getting both b and c
61
62 $ hg up -cqr 0
63 $ hg graft -r 3 --base 1
64 grafting 3:4c60f11aa304 "3"
65 merging a and b to b
66 merging a and c to c
67 $ hg st --change .
68 A b
69 A c
70 R a
71
72 $ hg -q strip . --config extensions.strip=
73
74 Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent)
75
76 $ hg graft -r 2 --base 3
77 grafting 2:5c095ad7e90f "2"
78 note: possible conflict - c was deleted and renamed to:
79 a
80 note: graft of 2:5c095ad7e90f created no changes to commit
81
82 Can't continue without starting:
83
84 $ hg -q up -cr tip
85 $ hg rm -q e
86 $ hg graft --continue
87 abort: no graft in progress
88 [255]
89 $ hg revert -r . -q e
90
91 Need to specify a rev:
92
93 $ hg graft
94 abort: no revisions specified
95 [255]
96
97 Can't graft ancestor:
98
99 $ hg graft 1 2
100 skipping ancestor revision 1:5d205f8b35b6
101 skipping ancestor revision 2:5c095ad7e90f
102 [255]
103
104 Specify revisions with -r:
105
106 $ hg graft -r 1 -r 2
107 skipping ancestor revision 1:5d205f8b35b6
108 skipping ancestor revision 2:5c095ad7e90f
109 [255]
110
111 $ hg graft -r 1 2
112 warning: inconsistent use of --rev might give unexpected revision ordering!
113 skipping ancestor revision 2:5c095ad7e90f
114 skipping ancestor revision 1:5d205f8b35b6
115 [255]
116
117 Conflicting date/user options:
118
119 $ hg up -q 0
120 $ hg graft -U --user foo 2
121 abort: cannot specify both --user and --currentuser
122 [255]
123 $ hg graft -D --date '0 0' 2
124 abort: cannot specify both --date and --currentdate
125 [255]
126
127 Can't graft with dirty wd:
128
129 $ hg up -q 0
130 $ echo foo > a
131 $ hg graft 1
132 abort: uncommitted changes
133 [255]
134 $ hg revert a
135
136 Graft a rename:
137 (this also tests that editor is invoked if '--edit' is specified)
138
139 $ hg status --rev "2^1" --rev 2
140 A b
141 R a
142 $ HGEDITOR=cat hg graft 2 -u foo --edit
143 grafting 2:5c095ad7e90f "2"
144 merging a and b to b
145 2
146
147
148 HG: Enter commit message. Lines beginning with 'HG:' are removed.
149 HG: Leave message empty to abort commit.
150 HG: --
151 HG: user: foo
152 HG: branch 'default'
153 HG: added b
154 HG: removed a
155 $ hg export tip --git
156 # HG changeset patch
157 # User foo
158 # Date 0 0
159 # Thu Jan 01 00:00:00 1970 +0000
160 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
161 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
162 2
163
164 diff --git a/a b/b
165 rename from a
166 rename to b
167
168 Look for extra:source
169
170 $ hg log --debug -r tip
171 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
172 tag: tip
173 phase: draft
174 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
175 parent: -1:0000000000000000000000000000000000000000
176 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
177 user: foo
178 date: Thu Jan 01 00:00:00 1970 +0000
179 files+: b
180 files-: a
181 extra: branch=default
182 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
183 description:
184 2
185
186
187
188 Graft out of order, skipping a merge and a duplicate
189 (this also tests that editor is not invoked if '--edit' is not specified)
190
191 $ hg graft 1 5 4 3 'merge()' 2 -n
192 skipping ungraftable merge revision 6
193 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
194 grafting 1:5d205f8b35b6 "1"
195 grafting 5:97f8bfe72746 "5"
196 grafting 4:9c233e8e184d "4"
197 grafting 3:4c60f11aa304 "3"
198
199 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
200 skipping ungraftable merge revision 6
201 scanning for duplicate grafts
202 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
203 grafting 1:5d205f8b35b6 "1"
204 unmatched files in local:
205 b
206 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
207 src: 'a' -> dst: 'b' *
208 checking for directory renames
209 resolving manifests
210 branchmerge: True, force: True, partial: False
211 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
212 preserving b for resolve of b
213 starting 4 threads for background file closing (?)
214 b: local copied/moved from a -> m (premerge)
215 picked tool ':merge' for b (binary False symlink False changedelete False)
216 merging b and a to b
217 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
218 premerge successful
219 committing files:
220 b
221 committing manifest
222 committing changelog
223 updating the branch cache
224 grafting 5:97f8bfe72746 "5"
225 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
226 src: 'c' -> dst: 'b'
227 checking for directory renames
228 resolving manifests
229 branchmerge: True, force: True, partial: False
230 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
231 e: remote is newer -> g
232 getting e
233 committing files:
234 e
235 committing manifest
236 committing changelog
237 updating the branch cache
238 $ HGEDITOR=cat hg graft 4 3 --log --debug
239 scanning for duplicate grafts
240 grafting 4:9c233e8e184d "4"
241 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
242 src: 'c' -> dst: 'b'
243 checking for directory renames
244 resolving manifests
245 branchmerge: True, force: True, partial: False
246 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
247 preserving e for resolve of e
248 d: remote is newer -> g
249 getting d
250 e: versions differ -> m (premerge)
251 picked tool ':merge' for e (binary False symlink False changedelete False)
252 merging e
253 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
254 e: versions differ -> m (merge)
255 picked tool ':merge' for e (binary False symlink False changedelete False)
256 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
257 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
258 abort: unresolved conflicts, can't continue
259 (use 'hg resolve' and 'hg graft --continue')
260 [255]
261
262 Summary should mention graft:
263
264 $ hg summary |grep graft
265 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
266
267 Using status to get more context
268
269 $ hg status --verbose
270 M d
271 M e
272 ? a.orig
273 ? e.orig
274 # The repository is in an unfinished *graft* state.
275
276 # Unresolved merge conflicts:
277 #
278 # e
279 #
280 # To mark files as resolved: hg resolve --mark FILE
281
282 # To continue: hg graft --continue
283 # To abort: hg graft --abort
284 # To stop: hg graft --stop
285
286
287 Commit while interrupted should fail:
288
289 $ hg ci -m 'commit interrupted graft'
290 abort: graft in progress
291 (use 'hg graft --continue' or 'hg graft --stop' to stop)
292 [255]
293
294 Abort the graft and try committing:
295
296 $ hg up -C .
297 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 $ echo c >> e
299 $ hg ci -mtest
300
301 $ hg strip . --config extensions.strip=
302 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
303 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
304
305 Graft again:
306
307 $ hg graft 1 5 4 3 'merge()' 2
308 skipping ungraftable merge revision 6
309 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
310 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
311 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
312 grafting 4:9c233e8e184d "4"
313 merging e
314 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
315 abort: unresolved conflicts, can't continue
316 (use 'hg resolve' and 'hg graft --continue')
317 [255]
318
319 Continue without resolve should fail:
320
321 $ hg graft -c
322 grafting 4:9c233e8e184d "4"
323 abort: unresolved merge conflicts (see 'hg help resolve')
324 [255]
325
326 Fix up:
327
328 $ echo b > e
329 $ hg resolve -m e
330 (no more unresolved files)
331 continue: hg graft --continue
332
333 Continue with a revision should fail:
334
335 $ hg graft -c 6
336 abort: can't specify --continue and revisions
337 [255]
338
339 $ hg graft -c -r 6
340 abort: can't specify --continue and revisions
341 [255]
342
343 Continue for real, clobber usernames
344
345 $ hg graft -c -U
346 grafting 4:9c233e8e184d "4"
347 grafting 3:4c60f11aa304 "3"
348
349 Compare with original:
350
351 $ hg diff -r 6
352 $ hg status --rev 0:. -C
353 M d
354 M e
355 A b
356 a
357 A c
358 a
359 R a
360
361 View graph:
362
363 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
364 @ test@11.draft: 3
365 |
366 o test@10.draft: 4
367 |
368 o test@9.draft: 5
369 |
370 o bar@8.draft: 1
371 |
372 o foo@7.draft: 2
373 |
374 | o test@6.secret: 6
375 | |\
376 | | o test@5.draft: 5
377 | | |
378 | o | test@4.draft: 4
379 | |/
380 | o baz@3.public: 3
381 | |
382 | o test@2.public: 2
383 | |
384 | o bar@1.public: 1
385 |/
386 o test@0.public: 0
387
388 Graft again onto another branch should preserve the original source
389 $ hg up -q 0
390 $ echo 'g'>g
391 $ hg add g
392 $ hg ci -m 7
393 created new head
394 $ hg graft 7
395 grafting 7:ef0ef43d49e7 "2"
396
397 $ hg log -r 7 --template '{rev}:{node}\n'
398 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
399 $ hg log -r 2 --template '{rev}:{node}\n'
400 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
401
402 $ hg log --debug -r tip
403 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
404 tag: tip
405 phase: draft
406 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
407 parent: -1:0000000000000000000000000000000000000000
408 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
409 user: foo
410 date: Thu Jan 01 00:00:00 1970 +0000
411 files+: b
412 files-: a
413 extra: branch=default
414 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
415 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
416 description:
417 2
418
419
420 Disallow grafting an already grafted cset onto its original branch
421 $ hg up -q 6
422 $ hg graft 7
423 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
424 [255]
425
426 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
427 --- */hg-5c095ad7e90f.patch * (glob)
428 +++ */hg-7a4785234d87.patch * (glob)
429 @@ -1,18 +1,18 @@
430 # HG changeset patch
431 -# User test
432 +# User foo
433 # Date 0 0
434 # Thu Jan 01 00:00:00 1970 +0000
435 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
436 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
437 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
438 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
439 2
440
441 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
442 +diff -r b592ea63bb0c -r 7a4785234d87 a
443 --- a/a Thu Jan 01 00:00:00 1970 +0000
444 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
445 @@ -1,1 +0,0 @@
446 --b
447 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
448 +-a
449 +diff -r b592ea63bb0c -r 7a4785234d87 b
450 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
451 +++ b/b Thu Jan 01 00:00:00 1970 +0000
452 @@ -0,0 +1,1 @@
453 -+b
454 ++a
455 [1]
456
457 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
458 --- */hg-5c095ad7e90f.patch * (glob)
459 +++ */hg-7a4785234d87.patch * (glob)
460 @@ -1,8 +1,8 @@
461 # HG changeset patch
462 -# User test
463 +# User foo
464 # Date 0 0
465 # Thu Jan 01 00:00:00 1970 +0000
466 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
467 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
468 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
469 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
470 2
471
472 [1]
473
474 Disallow grafting already grafted csets with the same origin onto each other
475 $ hg up -q 13
476 $ hg graft 2
477 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
478 [255]
479 $ hg graft 7
480 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
481 [255]
482
483 $ hg up -q 7
484 $ hg graft 2
485 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
486 [255]
487 $ hg graft tip
488 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
489 [255]
490
491 Graft with --log
492
493 $ hg up -Cq 1
494 $ hg graft 3 --log -u foo
495 grafting 3:4c60f11aa304 "3"
496 warning: can't find ancestor for 'c' copied from 'b'!
497 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
498 14:0c921c65ef1e 1:5d205f8b35b6 3
499 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
500
501 Resolve conflicted graft
502 $ hg up -q 0
503 $ echo b > a
504 $ hg ci -m 8
505 created new head
506 $ echo c > a
507 $ hg ci -m 9
508 $ hg graft 1 --tool internal:fail
509 grafting 1:5d205f8b35b6 "1"
510 abort: unresolved conflicts, can't continue
511 (use 'hg resolve' and 'hg graft --continue')
512 [255]
513 $ hg resolve --all
514 merging a
515 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
516 [1]
517 $ cat a
518 <<<<<<< local: aaa4406d4f0a - test: 9
519 c
520 =======
521 b
522 >>>>>>> graft: 5d205f8b35b6 - bar: 1
523 $ echo b > a
524 $ hg resolve -m a
525 (no more unresolved files)
526 continue: hg graft --continue
527 $ hg graft -c
528 grafting 1:5d205f8b35b6 "1"
529 $ hg export tip --git
530 # HG changeset patch
531 # User bar
532 # Date 0 0
533 # Thu Jan 01 00:00:00 1970 +0000
534 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
535 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
536 1
537
538 diff --git a/a b/a
539 --- a/a
540 +++ b/a
541 @@ -1,1 +1,1 @@
542 -c
543 +b
544
545 Resolve conflicted graft with rename
546 $ echo c > a
547 $ hg ci -m 10
548 $ hg graft 2 --tool internal:fail
549 grafting 2:5c095ad7e90f "2"
550 abort: unresolved conflicts, can't continue
551 (use 'hg resolve' and 'hg graft --continue')
552 [255]
553 $ hg resolve --all
554 merging a and b to b
555 (no more unresolved files)
556 continue: hg graft --continue
557 $ hg graft -c
558 grafting 2:5c095ad7e90f "2"
559 $ hg export tip --git
560 # HG changeset patch
561 # User test
562 # Date 0 0
563 # Thu Jan 01 00:00:00 1970 +0000
564 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
565 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
566 2
567
568 diff --git a/a b/b
569 rename from a
570 rename to b
571
572 Test simple origin(), with and without args
573 $ hg log -r 'origin()'
574 changeset: 1:5d205f8b35b6
575 user: bar
576 date: Thu Jan 01 00:00:00 1970 +0000
577 summary: 1
578
579 changeset: 2:5c095ad7e90f
580 user: test
581 date: Thu Jan 01 00:00:00 1970 +0000
582 summary: 2
583
584 changeset: 3:4c60f11aa304
585 user: baz
586 date: Thu Jan 01 00:00:00 1970 +0000
587 summary: 3
588
589 changeset: 4:9c233e8e184d
590 user: test
591 date: Thu Jan 01 00:00:00 1970 +0000
592 summary: 4
593
594 changeset: 5:97f8bfe72746
595 branch: stable
596 parent: 3:4c60f11aa304
597 user: test
598 date: Thu Jan 01 00:00:00 1970 +0000
599 summary: 5
600
601 $ hg log -r 'origin(7)'
602 changeset: 2:5c095ad7e90f
603 user: test
604 date: Thu Jan 01 00:00:00 1970 +0000
605 summary: 2
606
607 Now transplant a graft to test following through copies
608 $ hg up -q 0
609 $ hg branch -q dev
610 $ hg ci -qm "dev branch"
611 $ hg --config extensions.transplant= transplant -q 7
612 $ hg log -r 'origin(.)'
613 changeset: 2:5c095ad7e90f
614 user: test
615 date: Thu Jan 01 00:00:00 1970 +0000
616 summary: 2
617
618 Test that the graft and transplant markers in extra are converted, allowing
619 origin() to still work. Note that these recheck the immediately preceeding two
620 tests.
621 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
622
623 The graft case
624 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
625 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
626 branch=default
627 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
628 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
629 $ hg -R ../converted log -r 'origin(7)'
630 changeset: 2:e0213322b2c1
631 user: test
632 date: Thu Jan 01 00:00:00 1970 +0000
633 summary: 2
634
635 Test that template correctly expands more than one 'extra' (issue4362), and that
636 'intermediate-source' is converted.
637 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
638 Extra: branch=default
639 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
640 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
641 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
642
643 The transplant case
644 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
645 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
646 branch=dev
647 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
648 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
649 $ hg -R ../converted log -r 'origin(tip)'
650 changeset: 2:e0213322b2c1
651 user: test
652 date: Thu Jan 01 00:00:00 1970 +0000
653 summary: 2
654
655
656 Test simple destination
657 $ hg log -r 'destination()'
658 changeset: 7:ef0ef43d49e7
659 parent: 0:68795b066622
660 user: foo
661 date: Thu Jan 01 00:00:00 1970 +0000
662 summary: 2
663
664 changeset: 8:6b9e5368ca4e
665 user: bar
666 date: Thu Jan 01 00:00:00 1970 +0000
667 summary: 1
668
669 changeset: 9:1905859650ec
670 user: test
671 date: Thu Jan 01 00:00:00 1970 +0000
672 summary: 5
673
674 changeset: 10:52dc0b4c6907
675 user: test
676 date: Thu Jan 01 00:00:00 1970 +0000
677 summary: 4
678
679 changeset: 11:882b35362a6b
680 user: test
681 date: Thu Jan 01 00:00:00 1970 +0000
682 summary: 3
683
684 changeset: 13:7a4785234d87
685 user: foo
686 date: Thu Jan 01 00:00:00 1970 +0000
687 summary: 2
688
689 changeset: 14:0c921c65ef1e
690 parent: 1:5d205f8b35b6
691 user: foo
692 date: Thu Jan 01 00:00:00 1970 +0000
693 summary: 3
694
695 changeset: 17:f67661df0c48
696 user: bar
697 date: Thu Jan 01 00:00:00 1970 +0000
698 summary: 1
699
700 changeset: 19:9627f653b421
701 user: test
702 date: Thu Jan 01 00:00:00 1970 +0000
703 summary: 2
704
705 changeset: 21:7e61b508e709
706 branch: dev
707 tag: tip
708 user: foo
709 date: Thu Jan 01 00:00:00 1970 +0000
710 summary: 2
711
712 $ hg log -r 'destination(2)'
713 changeset: 7:ef0ef43d49e7
714 parent: 0:68795b066622
715 user: foo
716 date: Thu Jan 01 00:00:00 1970 +0000
717 summary: 2
718
719 changeset: 13:7a4785234d87
720 user: foo
721 date: Thu Jan 01 00:00:00 1970 +0000
722 summary: 2
723
724 changeset: 19:9627f653b421
725 user: test
726 date: Thu Jan 01 00:00:00 1970 +0000
727 summary: 2
728
729 changeset: 21:7e61b508e709
730 branch: dev
731 tag: tip
732 user: foo
733 date: Thu Jan 01 00:00:00 1970 +0000
734 summary: 2
735
736 Transplants of grafts can find a destination...
737 $ hg log -r 'destination(7)'
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 ... grafts of grafts unfortunately can't
746 $ hg graft -q 13 --debug
747 scanning for duplicate grafts
748 grafting 13:7a4785234d87 "2"
749 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
750 src: 'a' -> dst: 'b' *
751 checking for directory renames
752 resolving manifests
753 branchmerge: True, force: True, partial: False
754 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
755 starting 4 threads for background file closing (?)
756 committing files:
757 b
758 warning: can't find ancestor for 'b' copied from 'a'!
759 reusing manifest from p1 (listed files actually unchanged)
760 committing changelog
761 updating the branch cache
762 $ hg log -r 'destination(13)'
763 All copies of a cset
764 $ hg log -r 'origin(13) or destination(origin(13))'
765 changeset: 2:5c095ad7e90f
766 user: test
767 date: Thu Jan 01 00:00:00 1970 +0000
768 summary: 2
769
770 changeset: 7:ef0ef43d49e7
771 parent: 0:68795b066622
772 user: foo
773 date: Thu Jan 01 00:00:00 1970 +0000
774 summary: 2
775
776 changeset: 13:7a4785234d87
777 user: foo
778 date: Thu Jan 01 00:00:00 1970 +0000
779 summary: 2
780
781 changeset: 19:9627f653b421
782 user: test
783 date: Thu Jan 01 00:00:00 1970 +0000
784 summary: 2
785
786 changeset: 21:7e61b508e709
787 branch: dev
788 user: foo
789 date: Thu Jan 01 00:00:00 1970 +0000
790 summary: 2
791
792 changeset: 22:3a4e92d81b97
793 branch: dev
794 tag: tip
795 user: foo
796 date: Thu Jan 01 00:00:00 1970 +0000
797 summary: 2
798
799
800 graft works on complex revset
801
802 $ hg graft 'origin(13) or destination(origin(13))'
803 skipping ancestor revision 21:7e61b508e709
804 skipping ancestor revision 22:3a4e92d81b97
805 skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97)
806 grafting 7:ef0ef43d49e7 "2"
807 warning: can't find ancestor for 'b' copied from 'a'!
808 grafting 13:7a4785234d87 "2"
809 warning: can't find ancestor for 'b' copied from 'a'!
810 grafting 19:9627f653b421 "2"
811 merging b
812 warning: can't find ancestor for 'b' copied from 'a'!
813
814 graft with --force (still doesn't graft merges)
815
816 $ hg graft 19 0 6
817 skipping ungraftable merge revision 6
818 skipping ancestor revision 0:68795b066622
819 skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f)
820 [255]
821 $ hg graft 19 0 6 --force
822 skipping ungraftable merge revision 6
823 grafting 19:9627f653b421 "2"
824 merging b
825 warning: can't find ancestor for 'b' copied from 'a'!
826 grafting 0:68795b066622 "0"
827
828 graft --force after backout
829
830 $ echo abc > a
831 $ hg ci -m 28
832 $ hg backout 28
833 reverting a
834 changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d
835 $ hg graft 28
836 skipping ancestor revision 28:cc20d29aec8d
837 [255]
838 $ hg graft 28 --force
839 grafting 28:cc20d29aec8d "28"
840 merging a
841 $ cat a
842 abc
843
844 graft --continue after --force
845
846 $ echo def > a
847 $ hg ci -m 31
848 $ hg graft 28 --force --tool internal:fail
849 grafting 28:cc20d29aec8d "28"
850 abort: unresolved conflicts, can't continue
851 (use 'hg resolve' and 'hg graft --continue')
852 [255]
853 $ hg resolve --all
854 merging a
855 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
856 [1]
857 $ echo abc > a
858 $ hg resolve -m a
859 (no more unresolved files)
860 continue: hg graft --continue
861 $ hg graft -c
862 grafting 28:cc20d29aec8d "28"
863 $ cat a
864 abc
865
866 Continue testing same origin policy, using revision numbers from test above
867 but do some destructive editing of the repo:
868
869 $ hg up -qC 7
870 $ hg tag -l -r 13 tmp
871 $ hg --config extensions.strip= strip 2
872 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
873 $ hg graft tmp
874 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
875 [255]
876
877 Empty graft
878
879 $ hg up -qr 26
880 $ hg tag -f something
881 $ hg graft -qr 27
882 $ hg graft -f 27
883 grafting 27:17d42b8f5d50 "28"
884 note: graft of 27:17d42b8f5d50 created no changes to commit
885
886 $ cd ..
887
888 Graft to duplicate a commit
889
890 $ hg init graftsibling
891 $ cd graftsibling
892 $ touch a
893 $ hg commit -qAm a
894 $ touch b
895 $ hg commit -qAm b
896 $ hg log -G -T '{rev}\n'
897 @ 1
898 |
899 o 0
900
901 $ hg up -q 0
902 $ hg graft -r 1
903 grafting 1:0e067c57feba "b" (tip)
904 $ hg log -G -T '{rev}\n'
905 @ 2
906 |
907 | o 1
908 |/
909 o 0
910
911 Graft to duplicate a commit twice
912
913 $ hg up -q 0
914 $ hg graft -r 2
915 grafting 2:044ec77f6389 "b" (tip)
916 $ hg log -G -T '{rev}\n'
917 @ 3
918 |
919 | o 2
920 |/
921 | o 1
922 |/
923 o 0
924
925 Graft from behind a move or rename
2 Graft from behind a move or rename
926 ==================================
3 ==================================
927
4
@@ -990,8 +67,8 b' correct for it by detecting this conditi'
990
67
991 First, set up the repository with commits to be grafted
68 First, set up the repository with commits to be grafted
992
69
993 $ hg init ../graftmove
70 $ hg init graftmove
994 $ cd ../graftmove
71 $ cd graftmove
995 $ echo c1a > f1a
72 $ echo c1a > f1a
996 $ echo c2a > f2a
73 $ echo c2a > f2a
997 $ echo c3a > f3a
74 $ echo c3a > f3a
This diff has been collapsed as it changes many lines, (732 lines changed) Show them Hide them
@@ -922,735 +922,3 b' Graft to duplicate a commit twice'
922 |/
922 |/
923 o 0
923 o 0
924
924
925 Graft from behind a move or rename
926 ==================================
927
928 NOTE: This is affected by issue5343, and will need updating when it's fixed
929
930 Consider this topology for a regular graft:
931
932 o c1
933 |
934 | o c2
935 | |
936 | o ca # stands for "common ancestor"
937 |/
938 o cta # stands for "common topological ancestor"
939
940 Note that in issue5343, ca==cta.
941
942 The following table shows the possible cases. Here, "x->y" and, equivalently,
943 "y<-x", where x is an ancestor of y, means that some copy happened from x to y.
944
945 name | c1<-cta | cta<->ca | ca->c2
946 A.0 | | |
947 A.1 | X | |
948 A.2 | | X |
949 A.3 | | | X
950 A.4 | X | X |
951 A.5 | X | | X
952 A.6 | | X | X
953 A.7 | X | X | X
954
955 A.0 is trivial, and doesn't need copy tracking.
956 For A.1, a forward rename is recorded in the c1 pass, to be followed later.
957 In A.2, the rename is recorded in the c2 pass and followed backwards.
958 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target.
959 In A.4, both passes of checkcopies record incomplete renames, which are
960 then joined in mergecopies to record a rename to be followed.
961 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass
962 records an incomplete divergence. The incomplete rename is then joined to the
963 appropriate side of the incomplete divergence, and the result is recorded as a
964 divergence. The code doesn't distinguish at all between these two cases, since
965 the end result of them is the same: an incomplete divergence joined with an
966 incomplete rename into a divergence.
967 Finally, A.6 records a divergence entirely in the c2 pass.
968
969 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all.
970 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge.
971 A.5 has issue5343 as a special case.
972 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious
973 incomplete divergence, which is in fact complete. This is handled later in
974 mergecopies.
975 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b,
976 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting,
977 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base
978 case, a<-b<-c->a is treated the same as a<-b<-b->a).
979
980 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the
981 same name on both branches, then the rename is backed out on one branch, and
982 the backout is grafted to the other branch. This creates a challenging rename
983 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft
984 source, respectively. Since rename detection will run on the c1 side for such a
985 sequence (as for technical reasons, we split the c1 and c2 sides not at the
986 graft CA, but rather at the topological CA), it will pick up a false rename,
987 and cause a spurious merge conflict. This false rename is always exactly the
988 reverse of the true rename that would be detected on the c2 side, so we can
989 correct for it by detecting this condition and reversing as necessary.
990
991 First, set up the repository with commits to be grafted
992
993 $ hg init ../graftmove
994 $ cd ../graftmove
995 $ echo c1a > f1a
996 $ echo c2a > f2a
997 $ echo c3a > f3a
998 $ echo c4a > f4a
999 $ echo c5a > f5a
1000 $ hg ci -qAm A0
1001 $ hg mv f1a f1b
1002 $ hg mv f3a f3b
1003 $ hg mv f5a f5b
1004 $ hg ci -qAm B0
1005 $ echo c1c > f1b
1006 $ hg mv f2a f2c
1007 $ hg mv f5b f5a
1008 $ echo c5c > f5a
1009 $ hg ci -qAm C0
1010 $ hg mv f3b f3d
1011 $ echo c4d > f4a
1012 $ hg ci -qAm D0
1013 $ hg log -G
1014 @ changeset: 3:b69f5839d2d9
1015 | tag: tip
1016 | user: test
1017 | date: Thu Jan 01 00:00:00 1970 +0000
1018 | summary: D0
1019 |
1020 o changeset: 2:f58c7e2b28fa
1021 | user: test
1022 | date: Thu Jan 01 00:00:00 1970 +0000
1023 | summary: C0
1024 |
1025 o changeset: 1:3d7bba921b5d
1026 | user: test
1027 | date: Thu Jan 01 00:00:00 1970 +0000
1028 | summary: B0
1029 |
1030 o changeset: 0:11f7a1b56675
1031 user: test
1032 date: Thu Jan 01 00:00:00 1970 +0000
1033 summary: A0
1034
1035
1036 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the
1037 two renames actually converge to the same name (thus no actual divergence).
1038
1039 $ hg up -q 'desc("A0")'
1040 $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit
1041 grafting 2:f58c7e2b28fa "C0"
1042 merging f1a and f1b to f1a
1043 merging f5a
1044 warning: can't find ancestor for 'f5a' copied from 'f5b'!
1045 $ hg status --change .
1046 M f1a
1047 M f5a
1048 A f2c
1049 R f2a
1050 $ hg cat f1a
1051 c1c
1052 $ hg cat f1b
1053 f1b: no such file in rev c9763722f9bd
1054 [1]
1055
1056 Test the cases A.0 (f4x) and A.6 (f3x)
1057
1058 $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit
1059 grafting 3:b69f5839d2d9 "D0"
1060 note: possible conflict - f3b was renamed multiple times to:
1061 f3a
1062 f3d
1063 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1064
1065 Set up the repository for some further tests
1066
1067 $ hg up -q "min(desc("A0"))"
1068 $ hg mv f1a f1e
1069 $ echo c2e > f2a
1070 $ hg mv f3a f3e
1071 $ hg mv f4a f4e
1072 $ hg mv f5a f5b
1073 $ hg ci -qAm "E0"
1074 $ hg up -q "min(desc("A0"))"
1075 $ hg cp f1a f1f
1076 $ hg ci -qAm "F0"
1077 $ hg up -q "min(desc("A0"))"
1078 $ hg cp f1a f1g
1079 $ echo c1g > f1g
1080 $ hg ci -qAm "G0"
1081 $ hg log -G
1082 @ changeset: 8:ba67f08fb15a
1083 | tag: tip
1084 | parent: 0:11f7a1b56675
1085 | user: test
1086 | date: Thu Jan 01 00:00:00 1970 +0000
1087 | summary: G0
1088 |
1089 | o changeset: 7:d376ab0d7fda
1090 |/ parent: 0:11f7a1b56675
1091 | user: test
1092 | date: Thu Jan 01 00:00:00 1970 +0000
1093 | summary: F0
1094 |
1095 | o changeset: 6:6bd1736cab86
1096 |/ parent: 0:11f7a1b56675
1097 | user: test
1098 | date: Thu Jan 01 00:00:00 1970 +0000
1099 | summary: E0
1100 |
1101 | o changeset: 5:560daee679da
1102 | | user: test
1103 | | date: Thu Jan 01 00:00:00 1970 +0000
1104 | | summary: D1
1105 | |
1106 | o changeset: 4:c9763722f9bd
1107 |/ parent: 0:11f7a1b56675
1108 | user: test
1109 | date: Thu Jan 01 00:00:00 1970 +0000
1110 | summary: C1
1111 |
1112 | o changeset: 3:b69f5839d2d9
1113 | | user: test
1114 | | date: Thu Jan 01 00:00:00 1970 +0000
1115 | | summary: D0
1116 | |
1117 | o changeset: 2:f58c7e2b28fa
1118 | | user: test
1119 | | date: Thu Jan 01 00:00:00 1970 +0000
1120 | | summary: C0
1121 | |
1122 | o changeset: 1:3d7bba921b5d
1123 |/ user: test
1124 | date: Thu Jan 01 00:00:00 1970 +0000
1125 | summary: B0
1126 |
1127 o changeset: 0:11f7a1b56675
1128 user: test
1129 date: Thu Jan 01 00:00:00 1970 +0000
1130 summary: A0
1131
1132
1133 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x),
1134 and A.3 with a local content change to be preserved (f2x).
1135
1136 $ hg up -q "desc("E0")"
1137 $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit
1138 grafting 2:f58c7e2b28fa "C0"
1139 merging f1e and f1b to f1e
1140 merging f2a and f2c to f2c
1141
1142 Test the cases A.1 (f4x) and A.7 (f3x).
1143
1144 $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit
1145 grafting 3:b69f5839d2d9 "D0"
1146 note: possible conflict - f3b was renamed multiple times to:
1147 f3d
1148 f3e
1149 merging f4e and f4a to f4e
1150 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1151
1152 $ hg cat f2c
1153 c2e
1154
1155 Test the case A.5 (move case, f1x).
1156
1157 $ hg up -q "desc("C0")"
1158 BROKEN: Shouldn't get the warning about missing ancestor
1159 $ HGEDITOR="echo E1 >" hg graft -r 'desc("E0")' --edit
1160 grafting 6:6bd1736cab86 "E0"
1161 note: possible conflict - f1a was renamed multiple times to:
1162 f1b
1163 f1e
1164 note: possible conflict - f3a was renamed multiple times to:
1165 f3b
1166 f3e
1167 merging f2c and f2a to f2c
1168 merging f5a and f5b to f5b
1169 warning: can't find ancestor for 'f1e' copied from 'f1a'!
1170 warning: can't find ancestor for 'f3e' copied from 'f3a'!
1171 $ cat f1e
1172 c1a
1173
1174 Test the case A.5 (copy case, f1x).
1175
1176 $ hg up -q "desc("C0")"
1177 BROKEN: Shouldn't get the warning about missing ancestor
1178 $ HGEDITOR="echo F1 >" hg graft -r 'desc("F0")' --edit
1179 grafting 7:d376ab0d7fda "F0"
1180 warning: can't find ancestor for 'f1f' copied from 'f1a'!
1181 BROKEN: f1f should be marked a copy from f1b
1182 $ hg st --copies --change .
1183 A f1f
1184 BROKEN: f1f should have the new content from f1b (i.e. "c1c")
1185 $ cat f1f
1186 c1a
1187
1188 Test the case A.5 (copy+modify case, f1x).
1189
1190 $ hg up -q "desc("C0")"
1191 BROKEN: We should get a merge conflict from the 3-way merge between f1b in C0
1192 (content "c1c") and f1g in G0 (content "c1g") with f1a in A0 as base (content
1193 "c1a")
1194 $ HGEDITOR="echo G1 >" hg graft -r 'desc("G0")' --edit
1195 grafting 8:ba67f08fb15a "G0"
1196 warning: can't find ancestor for 'f1g' copied from 'f1a'!
1197
1198 Check the results of the grafts tested
1199
1200 $ hg log -CGv --patch --git
1201 @ changeset: 13:ef3adf6c20a4
1202 | tag: tip
1203 | parent: 2:f58c7e2b28fa
1204 | user: test
1205 | date: Thu Jan 01 00:00:00 1970 +0000
1206 | files: f1g
1207 | description:
1208 | G1
1209 |
1210 |
1211 | diff --git a/f1g b/f1g
1212 | new file mode 100644
1213 | --- /dev/null
1214 | +++ b/f1g
1215 | @@ -0,0 +1,1 @@
1216 | +c1g
1217 |
1218 | o changeset: 12:b5542d755b54
1219 |/ parent: 2:f58c7e2b28fa
1220 | user: test
1221 | date: Thu Jan 01 00:00:00 1970 +0000
1222 | files: f1f
1223 | description:
1224 | F1
1225 |
1226 |
1227 | diff --git a/f1f b/f1f
1228 | new file mode 100644
1229 | --- /dev/null
1230 | +++ b/f1f
1231 | @@ -0,0 +1,1 @@
1232 | +c1a
1233 |
1234 | o changeset: 11:f8a162271246
1235 |/ parent: 2:f58c7e2b28fa
1236 | user: test
1237 | date: Thu Jan 01 00:00:00 1970 +0000
1238 | files: f1e f2c f3e f4a f4e f5a f5b
1239 | copies: f4e (f4a) f5b (f5a)
1240 | description:
1241 | E1
1242 |
1243 |
1244 | diff --git a/f1e b/f1e
1245 | new file mode 100644
1246 | --- /dev/null
1247 | +++ b/f1e
1248 | @@ -0,0 +1,1 @@
1249 | +c1a
1250 | diff --git a/f2c b/f2c
1251 | --- a/f2c
1252 | +++ b/f2c
1253 | @@ -1,1 +1,1 @@
1254 | -c2a
1255 | +c2e
1256 | diff --git a/f3e b/f3e
1257 | new file mode 100644
1258 | --- /dev/null
1259 | +++ b/f3e
1260 | @@ -0,0 +1,1 @@
1261 | +c3a
1262 | diff --git a/f4a b/f4e
1263 | rename from f4a
1264 | rename to f4e
1265 | diff --git a/f5a b/f5b
1266 | rename from f5a
1267 | rename to f5b
1268 |
1269 | o changeset: 10:93ee502e8b0a
1270 | | user: test
1271 | | date: Thu Jan 01 00:00:00 1970 +0000
1272 | | files: f3d f4e
1273 | | description:
1274 | | D2
1275 | |
1276 | |
1277 | | diff --git a/f3d b/f3d
1278 | | new file mode 100644
1279 | | --- /dev/null
1280 | | +++ b/f3d
1281 | | @@ -0,0 +1,1 @@
1282 | | +c3a
1283 | | diff --git a/f4e b/f4e
1284 | | --- a/f4e
1285 | | +++ b/f4e
1286 | | @@ -1,1 +1,1 @@
1287 | | -c4a
1288 | | +c4d
1289 | |
1290 | o changeset: 9:539cf145f496
1291 | | parent: 6:6bd1736cab86
1292 | | user: test
1293 | | date: Thu Jan 01 00:00:00 1970 +0000
1294 | | files: f1e f2a f2c f5a f5b
1295 | | copies: f2c (f2a) f5a (f5b)
1296 | | description:
1297 | | C2
1298 | |
1299 | |
1300 | | diff --git a/f1e b/f1e
1301 | | --- a/f1e
1302 | | +++ b/f1e
1303 | | @@ -1,1 +1,1 @@
1304 | | -c1a
1305 | | +c1c
1306 | | diff --git a/f2a b/f2c
1307 | | rename from f2a
1308 | | rename to f2c
1309 | | diff --git a/f5b b/f5a
1310 | | rename from f5b
1311 | | rename to f5a
1312 | | --- a/f5b
1313 | | +++ b/f5a
1314 | | @@ -1,1 +1,1 @@
1315 | | -c5a
1316 | | +c5c
1317 | |
1318 | | o changeset: 8:ba67f08fb15a
1319 | | | parent: 0:11f7a1b56675
1320 | | | user: test
1321 | | | date: Thu Jan 01 00:00:00 1970 +0000
1322 | | | files: f1g
1323 | | | copies: f1g (f1a)
1324 | | | description:
1325 | | | G0
1326 | | |
1327 | | |
1328 | | | diff --git a/f1a b/f1g
1329 | | | copy from f1a
1330 | | | copy to f1g
1331 | | | --- a/f1a
1332 | | | +++ b/f1g
1333 | | | @@ -1,1 +1,1 @@
1334 | | | -c1a
1335 | | | +c1g
1336 | | |
1337 | | | o changeset: 7:d376ab0d7fda
1338 | | |/ parent: 0:11f7a1b56675
1339 | | | user: test
1340 | | | date: Thu Jan 01 00:00:00 1970 +0000
1341 | | | files: f1f
1342 | | | copies: f1f (f1a)
1343 | | | description:
1344 | | | F0
1345 | | |
1346 | | |
1347 | | | diff --git a/f1a b/f1f
1348 | | | copy from f1a
1349 | | | copy to f1f
1350 | | |
1351 | o | changeset: 6:6bd1736cab86
1352 | |/ parent: 0:11f7a1b56675
1353 | | user: test
1354 | | date: Thu Jan 01 00:00:00 1970 +0000
1355 | | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b
1356 | | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a)
1357 | | description:
1358 | | E0
1359 | |
1360 | |
1361 | | diff --git a/f1a b/f1e
1362 | | rename from f1a
1363 | | rename to f1e
1364 | | diff --git a/f2a b/f2a
1365 | | --- a/f2a
1366 | | +++ b/f2a
1367 | | @@ -1,1 +1,1 @@
1368 | | -c2a
1369 | | +c2e
1370 | | diff --git a/f3a b/f3e
1371 | | rename from f3a
1372 | | rename to f3e
1373 | | diff --git a/f4a b/f4e
1374 | | rename from f4a
1375 | | rename to f4e
1376 | | diff --git a/f5a b/f5b
1377 | | rename from f5a
1378 | | rename to f5b
1379 | |
1380 | | o changeset: 5:560daee679da
1381 | | | user: test
1382 | | | date: Thu Jan 01 00:00:00 1970 +0000
1383 | | | files: f3d f4a
1384 | | | description:
1385 | | | D1
1386 | | |
1387 | | |
1388 | | | diff --git a/f3d b/f3d
1389 | | | new file mode 100644
1390 | | | --- /dev/null
1391 | | | +++ b/f3d
1392 | | | @@ -0,0 +1,1 @@
1393 | | | +c3a
1394 | | | diff --git a/f4a b/f4a
1395 | | | --- a/f4a
1396 | | | +++ b/f4a
1397 | | | @@ -1,1 +1,1 @@
1398 | | | -c4a
1399 | | | +c4d
1400 | | |
1401 | | o changeset: 4:c9763722f9bd
1402 | |/ parent: 0:11f7a1b56675
1403 | | user: test
1404 | | date: Thu Jan 01 00:00:00 1970 +0000
1405 | | files: f1a f2a f2c f5a
1406 | | copies: f2c (f2a)
1407 | | description:
1408 | | C1
1409 | |
1410 | |
1411 | | diff --git a/f1a b/f1a
1412 | | --- a/f1a
1413 | | +++ b/f1a
1414 | | @@ -1,1 +1,1 @@
1415 | | -c1a
1416 | | +c1c
1417 | | diff --git a/f2a b/f2c
1418 | | rename from f2a
1419 | | rename to f2c
1420 | | diff --git a/f5a b/f5a
1421 | | --- a/f5a
1422 | | +++ b/f5a
1423 | | @@ -1,1 +1,1 @@
1424 | | -c5a
1425 | | +c5c
1426 | |
1427 +---o changeset: 3:b69f5839d2d9
1428 | | user: test
1429 | | date: Thu Jan 01 00:00:00 1970 +0000
1430 | | files: f3b f3d f4a
1431 | | copies: f3d (f3b)
1432 | | description:
1433 | | D0
1434 | |
1435 | |
1436 | | diff --git a/f3b b/f3d
1437 | | rename from f3b
1438 | | rename to f3d
1439 | | diff --git a/f4a b/f4a
1440 | | --- a/f4a
1441 | | +++ b/f4a
1442 | | @@ -1,1 +1,1 @@
1443 | | -c4a
1444 | | +c4d
1445 | |
1446 o | changeset: 2:f58c7e2b28fa
1447 | | user: test
1448 | | date: Thu Jan 01 00:00:00 1970 +0000
1449 | | files: f1b f2a f2c f5a f5b
1450 | | copies: f2c (f2a) f5a (f5b)
1451 | | description:
1452 | | C0
1453 | |
1454 | |
1455 | | diff --git a/f1b b/f1b
1456 | | --- a/f1b
1457 | | +++ b/f1b
1458 | | @@ -1,1 +1,1 @@
1459 | | -c1a
1460 | | +c1c
1461 | | diff --git a/f2a b/f2c
1462 | | rename from f2a
1463 | | rename to f2c
1464 | | diff --git a/f5b b/f5a
1465 | | rename from f5b
1466 | | rename to f5a
1467 | | --- a/f5b
1468 | | +++ b/f5a
1469 | | @@ -1,1 +1,1 @@
1470 | | -c5a
1471 | | +c5c
1472 | |
1473 o | changeset: 1:3d7bba921b5d
1474 |/ user: test
1475 | date: Thu Jan 01 00:00:00 1970 +0000
1476 | files: f1a f1b f3a f3b f5a f5b
1477 | copies: f1b (f1a) f3b (f3a) f5b (f5a)
1478 | description:
1479 | B0
1480 |
1481 |
1482 | diff --git a/f1a b/f1b
1483 | rename from f1a
1484 | rename to f1b
1485 | diff --git a/f3a b/f3b
1486 | rename from f3a
1487 | rename to f3b
1488 | diff --git a/f5a b/f5b
1489 | rename from f5a
1490 | rename to f5b
1491 |
1492 o changeset: 0:11f7a1b56675
1493 user: test
1494 date: Thu Jan 01 00:00:00 1970 +0000
1495 files: f1a f2a f3a f4a f5a
1496 description:
1497 A0
1498
1499
1500 diff --git a/f1a b/f1a
1501 new file mode 100644
1502 --- /dev/null
1503 +++ b/f1a
1504 @@ -0,0 +1,1 @@
1505 +c1a
1506 diff --git a/f2a b/f2a
1507 new file mode 100644
1508 --- /dev/null
1509 +++ b/f2a
1510 @@ -0,0 +1,1 @@
1511 +c2a
1512 diff --git a/f3a b/f3a
1513 new file mode 100644
1514 --- /dev/null
1515 +++ b/f3a
1516 @@ -0,0 +1,1 @@
1517 +c3a
1518 diff --git a/f4a b/f4a
1519 new file mode 100644
1520 --- /dev/null
1521 +++ b/f4a
1522 @@ -0,0 +1,1 @@
1523 +c4a
1524 diff --git a/f5a b/f5a
1525 new file mode 100644
1526 --- /dev/null
1527 +++ b/f5a
1528 @@ -0,0 +1,1 @@
1529 +c5a
1530
1531 Check superfluous filemerge of files renamed in the past but untouched by graft
1532
1533 $ echo a > a
1534 $ hg ci -qAma
1535 $ hg mv a b
1536 $ echo b > b
1537 $ hg ci -qAmb
1538 $ echo c > c
1539 $ hg ci -qAmc
1540 $ hg up -q .~2
1541 $ hg graft tip -qt:fail
1542
1543 $ cd ..
1544
1545 Graft a change into a new file previously grafted into a renamed directory
1546
1547 $ hg init dirmovenewfile
1548 $ cd dirmovenewfile
1549 $ mkdir a
1550 $ echo a > a/a
1551 $ hg ci -qAma
1552 $ echo x > a/x
1553 $ hg ci -qAmx
1554 $ hg up -q 0
1555 $ hg mv -q a b
1556 $ hg ci -qAmb
1557 $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
1558 $ hg up -q 1
1559 $ echo y > a/x
1560 $ hg ci -qAmy
1561 $ hg up -q 3
1562 $ hg graft -q 4
1563 $ hg status --change .
1564 M b/x
1565
1566 Prepare for test of skipped changesets and how merges can influence it:
1567
1568 $ hg merge -q -r 1 --tool :local
1569 $ hg ci -m m
1570 $ echo xx >> b/x
1571 $ hg ci -m xx
1572
1573 $ hg log -G -T '{rev} {desc|firstline}'
1574 @ 7 xx
1575 |
1576 o 6 m
1577 |\
1578 | o 5 y
1579 | |
1580 +---o 4 y
1581 | |
1582 | o 3 x
1583 | |
1584 | o 2 b
1585 | |
1586 o | 1 x
1587 |/
1588 o 0 a
1589
1590 Grafting of plain changes correctly detects that 3 and 5 should be skipped:
1591
1592 $ hg up -qCr 4
1593 $ hg graft --tool :local -r 2::5
1594 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1595 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1596 grafting 2:42127f193bcd "b"
1597
1598 Extending the graft range to include a (skipped) merge of 3 will not prevent us from
1599 also detecting that both 3 and 5 should be skipped:
1600
1601 $ hg up -qCr 4
1602 $ hg graft --tool :local -r 2::7
1603 skipping ungraftable merge revision 6
1604 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1605 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1606 grafting 2:42127f193bcd "b"
1607 grafting 7:d3c3f2b38ecc "xx"
1608 note: graft of 7:d3c3f2b38ecc created no changes to commit
1609
1610 $ cd ..
1611
1612 Grafted revision should be warned and skipped only once. (issue6024)
1613
1614 $ mkdir issue6024
1615 $ cd issue6024
1616
1617 $ hg init base
1618 $ cd base
1619 $ touch x
1620 $ hg commit -qAminit
1621 $ echo a > x
1622 $ hg commit -mchange
1623 $ hg update -q 0
1624 $ hg graft -r 1
1625 grafting 1:a0b923c546aa "change" (tip)
1626 $ cd ..
1627
1628 $ hg clone -qr 2 base clone
1629 $ cd clone
1630 $ hg pull -q
1631 $ hg merge -q 2
1632 $ hg commit -mmerge
1633 $ hg update -q 0
1634 $ hg graft -r 1
1635 grafting 1:04fc6d444368 "change"
1636 $ hg update -q 3
1637 $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n'
1638 o 4:4e16 <- a0b9
1639 |
1640 | @ 3:f0ac <-
1641 | |\
1642 +---o 2:a0b9 <-
1643 | |
1644 | o 1:04fc <- a0b9
1645 |/
1646 o 0:7848 <-
1647
1648
1649 the source of rev 4 is an ancestor of the working parent, and was also
1650 grafted as rev 1. it should be stripped from the target revisions only once.
1651
1652 $ hg graft -r 4
1653 skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa)
1654 [255]
1655
1656 $ cd ../..
General Comments 0
You need to be logged in to leave comments. Login now