changeset 41393:dc50121126ae

copies: pass contexts into _findlimit() Just a little refactoring to make the next patch simpler. Differential Revision: https://phab.mercurial-scm.org/D5595
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 15 Jan 2019 16:50:50 -0800
parents b80af0707066
children 75e753a26806
files mercurial/copies.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Tue Jan 15 11:16:42 2019 -0800
+++ b/mercurial/copies.py	Tue Jan 15 16:50:50 2019 -0800
@@ -24,7 +24,7 @@
     stringutil,
 )
 
-def _findlimit(repo, a, b):
+def _findlimit(repo, ctxa, ctxb):
     """
     Find the last revision that needs to be checked to ensure that a full
     transitive closure for file copies can be properly calculated.
@@ -45,6 +45,8 @@
     #   - quit when interesting revs is zero
 
     cl = repo.changelog
+    a = ctxa.rev()
+    b = ctxb.rev()
     if a is None:
         a = node.wdirrev
     if b is None:
@@ -162,7 +164,7 @@
     if debug:
         dbg('debug.copies:    looking into rename from %s to %s\n'
             % (a, b))
-    limit = _findlimit(repo, a.rev(), b.rev())
+    limit = _findlimit(repo, a, b)
     if debug:
         dbg('debug.copies:      search limit: %d\n' % limit)
     am = a.manifest()
@@ -456,7 +458,7 @@
     if graft:
         tca = _c1.ancestor(_c2)
 
-    limit = _findlimit(repo, c1.rev(), c2.rev())
+    limit = _findlimit(repo, c1, c2)
     repo.ui.debug("  searching for copies back to rev %d\n" % limit)
 
     m1 = c1.manifest()