Mercurial > hg
diff mercurial/copies.py @ 42115:27475ae67676
copies: extract function for deciding whether to use changeset-centric algos
We'll eventually have a "experimental.copies.read-from=changeset-only"
option too and I don't want to spread the logic for determining if we
should use changeset-centric of filelog-centric algorithms.
Differential Revision: https://phab.mercurial-scm.org/D6163
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 20 Mar 2019 11:42:02 -0700 |
parents | a791623458ef |
children | 967c098eed33 |
line wrap: on
line diff
--- a/mercurial/copies.py Fri Jan 18 13:13:48 2019 -0800 +++ b/mercurial/copies.py Wed Mar 20 11:42:02 2019 -0700 @@ -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')