##// END OF EJS Templates
copytrace: use the full copytracing method if only drafts are involved...
Pulkit Goyal -
r34289:fc3b8483 default
parent child Browse files
Show More
@@ -15,6 +15,7 b' from . import ('
15 match as matchmod,
15 match as matchmod,
16 node,
16 node,
17 pathutil,
17 pathutil,
18 phases,
18 scmutil,
19 scmutil,
19 util,
20 util,
20 )
21 )
@@ -367,10 +368,27 b' def mergecopies(repo, c1, c2, base):'
367 if copytracing == 'off':
368 if copytracing == 'off':
368 return {}, {}, {}, {}, {}
369 return {}, {}, {}, {}, {}
369 elif copytracing == 'heuristics':
370 elif copytracing == 'heuristics':
371 # Do full copytracing if only drafts are involved as that will be fast
372 # enough and will also cover the copies which can be missed by
373 # heuristics
374 if _isfullcopytraceable(c1, base):
375 return _fullcopytracing(repo, c1, c2, base)
370 return _heuristicscopytracing(repo, c1, c2, base)
376 return _heuristicscopytracing(repo, c1, c2, base)
371 else:
377 else:
372 return _fullcopytracing(repo, c1, c2, base)
378 return _fullcopytracing(repo, c1, c2, base)
373
379
380 def _isfullcopytraceable(c1, base):
381 """ Checks that if base, source and destination are all draft branches, if
382 yes let's use the full copytrace algorithm for increased capabilities since
383 it will be fast enough.
384 """
385
386 nonpublicphases = set([phases.draft, phases.secret])
387
388 if (c1.phase() in nonpublicphases) and (base.phase() in nonpublicphases):
389 return True
390 return False
391
374 def _fullcopytracing(repo, c1, c2, base):
392 def _fullcopytracing(repo, c1, c2, base):
375 """ The full copytracing algorithm which finds all the new files that were
393 """ The full copytracing algorithm which finds all the new files that were
376 added from merge base up to the top commit and for each file it checks if
394 added from merge base up to the top commit and for each file it checks if
@@ -589,3 +589,79 b' Test shelve/unshelve'
589 $ cd ..
589 $ cd ..
590 $ rm -rf server
590 $ rm -rf server
591 $ rm -rf repo
591 $ rm -rf repo
592
593 Test full copytrace ability on draft branch
594 -------------------------------------------
595
596 File directory and base name changed in same move
597 $ hg init repo
598 $ initclient repo
599 $ mkdir repo/dir1
600 $ cd repo/dir1
601 $ echo a > a
602 $ hg add a
603 $ hg ci -qm initial
604 $ cd ..
605 $ hg mv -q dir1 dir2
606 $ hg mv dir2/a dir2/b
607 $ hg ci -qm 'mv a b; mv dir1 dir2'
608 $ hg up -q '.^'
609 $ cd dir1
610 $ echo b >> a
611 $ cd ..
612 $ hg ci -qm 'mod a'
613
614 $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
615 @ changeset 6207d2d318e710b882e3d5ada2a89770efc42c96
616 | desc mod a, phase: draft
617 | o changeset abffdd4e3dfc04bc375034b970299b2a309a1cce
618 |/ desc mv a b; mv dir1 dir2, phase: draft
619 o changeset 81973cd24b58db2fdf18ce3d64fb2cc3284e9ab3
620 desc initial, phase: draft
621
622 $ hg rebase -s . -d 1
623 rebasing 2:6207d2d318e7 "mod a" (tip)
624 merging dir2/b and dir1/a to dir2/b
625 saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/6207d2d318e7-1c9779ad-rebase.hg (glob)
626 $ cat dir2/b
627 a
628 b
629 $ cd ..
630 $ rm -rf server
631 $ rm -rf repo
632
633 Move directory in one merge parent, while adding file to original directory
634 in other merge parent. File moved on rebase.
635 $ hg init repo
636 $ initclient repo
637 $ mkdir repo/dir1
638 $ cd repo/dir1
639 $ echo dummy > dummy
640 $ hg add dummy
641 $ cd ..
642 $ hg ci -qm initial
643 $ cd dir1
644 $ echo a > a
645 $ hg add a
646 $ cd ..
647 $ hg ci -qm 'hg add dir1/a'
648 $ hg up -q '.^'
649 $ hg mv -q dir1 dir2
650 $ hg ci -qm 'mv dir1 dir2'
651
652 $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
653 @ changeset e8919e7df8d036e07b906045eddcd4a42ff1915f
654 | desc mv dir1 dir2, phase: draft
655 | o changeset 7c7c6f339be00f849c3cb2df738ca91db78b32c8
656 |/ desc hg add dir1/a, phase: draft
657 o changeset a235dcce55dcf42034c4e374cb200662d0bb4a13
658 desc initial, phase: draft
659
660 $ hg rebase -s . -d 1
661 rebasing 2:e8919e7df8d0 "mv dir1 dir2" (tip)
662 saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/e8919e7df8d0-f62fab62-rebase.hg (glob)
663 $ ls dir2
664 a
665 dummy
666 $ rm -rf server
667 $ rm -rf repo
General Comments 0
You need to be logged in to leave comments. Login now