comparison mercurial/copies.py @ 42548:4ebbd7c4a3c5

copies: return only path from _tracefile() since that's all caller needs Differential Revision: https://phab.mercurial-scm.org/D6587
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 28 Jun 2019 16:40:36 -0700
parents 898b36f74f75
children bcb4b5c5964b
comparison
equal deleted inserted replaced
42547:6a3872e34503 42548:4ebbd7c4a3c5
159 def _tracefile(fctx, am, limit): 159 def _tracefile(fctx, am, limit):
160 """return file context that is the ancestor of fctx present in ancestor 160 """return file context that is the ancestor of fctx present in ancestor
161 manifest am, stopping after the first ancestor lower than limit""" 161 manifest am, stopping after the first ancestor lower than limit"""
162 162
163 for f in fctx.ancestors(): 163 for f in fctx.ancestors():
164 if am.get(f.path(), None) == f.filenode(): 164 path = f.path()
165 return f 165 if am.get(path, None) == f.filenode():
166 return path
166 if not f.isintroducedafter(limit): 167 if not f.isintroducedafter(limit):
167 return None 168 return None
168 169
169 def _dirstatecopies(repo, match=None): 170 def _dirstatecopies(repo, match=None):
170 ds = repo.dirstate 171 ds = repo.dirstate
235 fctx = b[f] 236 fctx = b[f]
236 fctx._ancestrycontext = ancestrycontext 237 fctx._ancestrycontext = ancestrycontext
237 238
238 if debug: 239 if debug:
239 start = util.timer() 240 start = util.timer()
240 ofctx = _tracefile(fctx, am, limit) 241 opath = _tracefile(fctx, am, limit)
241 if ofctx: 242 if opath:
242 if debug: 243 if debug:
243 dbg('debug.copies: rename of: %s\n' % ofctx._path) 244 dbg('debug.copies: rename of: %s\n' % opath)
244 cm[f] = ofctx.path() 245 cm[f] = opath
245 if debug: 246 if debug:
246 dbg('debug.copies: time: %f seconds\n' 247 dbg('debug.copies: time: %f seconds\n'
247 % (util.timer() - start)) 248 % (util.timer() - start))
248 return cm 249 return cm
249 250