##// END OF EJS Templates
copytrace: add a a new config to limit the number of drafts in heuristics...
Pulkit Goyal -
r34312:1826d695 default
parent child Browse files
Show More
@@ -176,6 +176,9 b" coreconfigitem('experimental', 'clientco"
176 176 coreconfigitem('experimental', 'copytrace',
177 177 default='on',
178 178 )
179 coreconfigitem('experimental', 'copytrace.sourcecommitlimit',
180 default=100,
181 )
179 182 coreconfigitem('experimental', 'crecordtest',
180 183 default=None,
181 184 )
@@ -371,22 +371,27 b' def mergecopies(repo, c1, c2, base):'
371 371 # Do full copytracing if only drafts are involved as that will be fast
372 372 # enough and will also cover the copies which can be missed by
373 373 # heuristics
374 if _isfullcopytraceable(c1, base):
374 if _isfullcopytraceable(repo, c1, base):
375 375 return _fullcopytracing(repo, c1, c2, base)
376 376 return _heuristicscopytracing(repo, c1, c2, base)
377 377 else:
378 378 return _fullcopytracing(repo, c1, c2, base)
379 379
380 def _isfullcopytraceable(c1, base):
380 def _isfullcopytraceable(repo, c1, base):
381 381 """ Checks that if base, source and destination are all draft branches, if
382 382 yes let's use the full copytrace algorithm for increased capabilities since
383 383 it will be fast enough.
384 384 """
385 if c1.rev() is None:
386 c1 = c1.p1()
385 387
386 388 nonpublicphases = set([phases.draft, phases.secret])
387 389
388 390 if (c1.phase() in nonpublicphases) and (base.phase() in nonpublicphases):
389 return True
391 sourcecommitlimit = repo.ui.configint('experimental',
392 'copytrace.sourcecommitlimit')
393 commits = len(repo.revs('%d::%d', base.rev(), c1.rev()))
394 return commits < sourcecommitlimit
390 395 return False
391 396
392 397 def _fullcopytracing(repo, c1, c2, base):
@@ -665,3 +665,50 b' in other merge parent. File moved on reb'
665 665 dummy
666 666 $ rm -rf server
667 667 $ rm -rf repo
668
669 Testing the sourcecommitlimit config
670
671 $ hg init repo
672 $ initclient repo
673 $ cd repo
674 $ echo a > a
675 $ hg ci -Aqm "added a"
676 $ echo "more things" >> a
677 $ hg ci -qm "added more things to a"
678 $ hg up 0
679 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
680 $ echo b > b
681 $ hg ci -Aqm "added b"
682 $ mkdir foo
683 $ hg mv a foo/bar
684 $ hg ci -m "Moved a to foo/bar"
685 $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
686 @ changeset b4b0f7880e500b5c364a5f07b4a2b167de7a6fb0
687 | desc Moved a to foo/bar, phase: draft
688 o changeset 5f6d8a4bf34ab274ccc9f631c2536964b8a3666d
689 | desc added b, phase: draft
690 | o changeset 8b6e13696c38e8445a759516474640c2f8dddef6
691 |/ desc added more things to a, phase: draft
692 o changeset 9092f1db7931481f93b37d5c9fbcfc341bcd7318
693 desc added a, phase: draft
694
695 When the sourcecommitlimit is small and we have more drafts, we use heuristics only
696
697 $ hg rebase -s 8b6e13696 -d . --config experimental.copytrace.sourcecommitlimit=0
698 rebasing 1:8b6e13696c38 "added more things to a"
699 other [source] changed a which local [dest] deleted
700 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
701 unresolved conflicts (see hg resolve, then hg rebase --continue)
702 [1]
703
704 But when we have "sourcecommitlimit > (no. of drafts from base to c1)", we do
705 fullcopytracing
706
707 $ hg rebase --abort
708 rebase aborted
709 $ hg rebase -s 8b6e13696 -d .
710 rebasing 1:8b6e13696c38 "added more things to a"
711 merging foo/bar and a to foo/bar
712 saved backup bundle to $TESTTMP/repo/repo/repo/.hg/strip-backup/8b6e13696c38-fc14ac83-rebase.hg (glob)
713 $ cd ..
714 $ rm -rf repo
General Comments 0
You need to be logged in to leave comments. Login now