comparison 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
comparison
equal deleted inserted replaced
42114:aa84bc48c2f7 42115:27475ae67676
158 """ 158 """
159 ma = a.manifest() 159 ma = a.manifest()
160 mb = b.manifest() 160 mb = b.manifest()
161 return mb.filesnotin(ma, match=match) 161 return mb.filesnotin(ma, match=match)
162 162
163 def usechangesetcentricalgo(repo):
164 """Checks if we should use changeset-centric copy algorithms"""
165 return (repo.ui.config('experimental', 'copies.read-from') ==
166 'compatibility')
167
163 def _committedforwardcopies(a, b, match): 168 def _committedforwardcopies(a, b, match):
164 """Like _forwardcopies(), but b.rev() cannot be None (working copy)""" 169 """Like _forwardcopies(), but b.rev() cannot be None (working copy)"""
165 # files might have to be traced back to the fctx parent of the last 170 # files might have to be traced back to the fctx parent of the last
166 # one-side-only changeset, but not further back than that 171 # one-side-only changeset, but not further back than that
167 repo = a._repo 172 repo = a._repo
168 173
169 if repo.ui.config('experimental', 'copies.read-from') == 'compatibility': 174 if usechangesetcentricalgo(repo):
170 return _changesetforwardcopies(a, b, match) 175 return _changesetforwardcopies(a, b, match)
171 176
172 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies') 177 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
173 dbg = repo.ui.debug 178 dbg = repo.ui.debug
174 if debug: 179 if debug: