D763: copytrace: add a a new config to limit the number of drafts in heuristics
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Thu Sep 21 12:37:22 EDT 2017
pulkit updated this revision to Diff 1967.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D763?vs=1961&id=1967
REVISION DETAIL
https://phab.mercurial-scm.org/D763
AFFECTED FILES
mercurial/copies.py
CHANGE DETAILS
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -376,22 +376,29 @@
# Do full copytracing if only drafts are involved as that will be fast
# enough and will also cover the copies which can be missed by
# heuristics
- if _isfullcopytraceable(c1, base):
+ if _isfullcopytraceable(repo.ui, c1, base):
return _fullcopytracing(repo, c1, c2, base)
return _heuristicscopytracing(repo, c1, c2, base)
else:
return _fullcopytracing(repo, c1, c2, base)
-def _isfullcopytraceable(c1, base):
+def _isfullcopytraceable(ui, c1, base):
""" Checks that if base, source and destination are all draft branches, if
yes let's use the full copytrace algorithm for increased capabilities since
it will be fast enough.
"""
nonpublicphases = set([phases.draft, phases.secret])
if (c1.phase() in nonpublicphases) and (base.phase() in nonpublicphases):
- return True
+ ctx = c1
+ commits = 0
+ sourcecommitlimit = ui.configint('experimental',
+ 'copytrace.sourcecommitlimit', 100)
+ while ctx != base and commits != sourcecommitlimit:
+ ctx = ctx.p1()
+ commits += 1
+ return commits < sourcecommitlimit
return False
def _fullcopytracing(repo, c1, c2, base):
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list