Patchwork [5,of,7] copies: remove msrc and mdst parameters

login
register
mail settings
Submitter Stanislau Hlebik
Date May 29, 2017, 1:12 p.m.
Message ID <e460d9165b77c5333a02.1496063521@devvm1840.lla2.facebook.com>
Download mbox | patch
Permalink /patch/21036/
State Accepted
Headers show

Comments

Stanislau Hlebik - May 29, 2017, 1:12 p.m.
# HG changeset patch
# User Stanislau Hlebik <stash@fb.com>
# Date 1496062645 25200
#      Mon May 29 05:57:25 2017 -0700
# Node ID e460d9165b77c5333a0288bd423175ad9ac4519a
# Parent  cfdf3dc92e2c9415474cef9b004a002e9b0bc7ff
copies: remove msrc and mdst parameters

This function already has lots of parameters. And we can get manifests from
contexts. So let's get msrc and mdst parameters from srcctx and dstctx.

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -414,10 +414,10 @@ 
                                       baselabel='topological common ancestor')
 
     for f in u1u:
-        _checkcopies(c1, c2, f, m1, m2, base, tca, dirtyc1, limit, data1)
+        _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1)
 
     for f in u2u:
-        _checkcopies(c2, c1, f, m2, m1, base, tca, dirtyc2, limit, data2)
+        _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, data2)
 
     copy = dict(data1['copy'].items() + data2['copy'].items())
     fullcopy = dict(data1['fullcopy'].items() + data2['fullcopy'].items())
@@ -462,8 +462,8 @@ 
              'incompletediverge': bothincompletediverge
             }
     for f in bothnew:
-        _checkcopies(c1, c2, f, m1, m2, base, tca, dirtyc1, limit, both1)
-        _checkcopies(c2, c1, f, m2, m1, base, tca, dirtyc2, limit, both2)
+        _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
+        _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
     if dirtyc1:
         # incomplete copies may only be found on the "dirty" side for bothnew
         assert not both2['incomplete']
@@ -598,16 +598,13 @@ 
     except StopIteration:
         return False
 
-def _checkcopies(srcctx, dstctx, f, msrc, mdst, base, tca, remotebase,
-                 limit, data):
+def _checkcopies(srcctx, dstctx, f, base, tca, remotebase, limit, data):
     """
     check possible copies of f from msrc to mdst
 
     srcctx = starting context for f in msrc
     dstctx = destination context for f in mdst
     f = the filename to check (as in msrc)
-    msrc = the source manifest
-    mdst = the destination manifest
     base = the changectx used as a merge base
     tca = topological common ancestor for graft-like scenarios
     remotebase = True if base is outside tca::srcctx, False otherwise
@@ -620,6 +617,8 @@ 
     once it "goes behind a certain revision".
     """
 
+    msrc = srcctx.manifest()
+    mdst = dstctx.manifest()
     mb = base.manifest()
     mta = tca.manifest()
     # Might be true if this call is about finding backward renames,