Patchwork D6163: copies: extract function for deciding whether to use changeset-centric algos

login
register
mail settings
Submitter phabricator
Date April 13, 2019, 11:46 a.m.
Message ID <a22ff63b69aa44b21dee2e943a321498@localhost.localdomain>
Download mbox | patch
Permalink /patch/39589/
State Not Applicable
Headers show

Comments

phabricator - April 13, 2019, 11:46 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG27475ae67676: copies: extract function for deciding whether to use changeset-centric algos (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6163?vs=14575&id=14730

REVISION DETAIL
  https://phab.mercurial-scm.org/D6163

AFFECTED FILES
  mercurial/copies.py
  mercurial/scmutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1205,7 +1205,7 @@ 
             wctx.copy(old, new)
 
 def getrenamedfn(repo, endrev=None):
-    if repo.ui.config('experimental', 'copies.read-from') == 'compatibility':
+    if copiesmod.usechangesetcentricalgo(repo):
         def getrenamed(fn, rev):
             ctx = repo[rev]
             p1copies = ctx.p1copies()
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -160,13 +160,18 @@ 
     mb = b.manifest()
     return mb.filesnotin(ma, match=match)
 
+def usechangesetcentricalgo(repo):
+    """Checks if we should use changeset-centric copy algorithms"""
+    return (repo.ui.config('experimental', 'copies.read-from') ==
+            'compatibility')
+
 def _committedforwardcopies(a, b, match):
     """Like _forwardcopies(), but b.rev() cannot be None (working copy)"""
     # files might have to be traced back to the fctx parent of the last
     # one-side-only changeset, but not further back than that
     repo = a._repo
 
-    if repo.ui.config('experimental', 'copies.read-from') == 'compatibility':
+    if usechangesetcentricalgo(repo):
         return _changesetforwardcopies(a, b, match)
 
     debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')