Patchwork [04,of,16] mergecopies: rename 'ca' to 'base'

login
register
mail settings
Submitter Gábor Stefanik
Date Oct. 16, 2016, 2:32 p.m.
Message ID <bfb99ef3749757161bf4.1476628358@GSTEFANIK.NavnGo.local>
Download mbox | patch
Permalink /patch/17113/
State Not Applicable
Headers show

Comments

Gábor Stefanik - Oct. 16, 2016, 2:32 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1476315014 -7200
#      Thu Oct 13 01:30:14 2016 +0200
# Node ID bfb99ef3749757161bf439cc0ec678de46e24672
# Parent  92dfc856c6cc25366eb8a7fb9b59d992ad5efc36
mergecopies: rename 'ca' to 'base'

This variable was named after the common ancestor. It is actually the merge
base that might differ from the common ancestor in the graft case. We rename the
variable before a larger refactoring to clarify the situation. Similar rename
was also applied to 'checkcopies' in a prior changeset.
Pierre-Yves David - Oct. 16, 2016, 2:40 p.m.
On 10/16/2016 04:32 PM, Gábor Stefanik wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1476315014 -7200
> #      Thu Oct 13 01:30:14 2016 +0200
> # Node ID bfb99ef3749757161bf439cc0ec678de46e24672
> # Parent  92dfc856c6cc25366eb8a7fb9b59d992ad5efc36
> mergecopies: rename 'ca' to 'base'
>
> This variable was named after the common ancestor. It is actually the merge
> base that might differ from the common ancestor in the graft case. We rename the
> variable before a larger refactoring to clarify the situation. Similar rename
> was also applied to 'checkcopies' in a prior changeset.

Hum I though I already got these one in, but I did not. Let me emails 
these first four myself for clarity.

Cheers,

Patch

diff -r 92dfc856c6cc -r bfb99ef37497 mercurial/copies.py
--- a/mercurial/copies.py	Thu Oct 13 01:26:33 2016 +0200
+++ b/mercurial/copies.py	Thu Oct 13 01:30:14 2016 +0200
@@ -285,14 +285,14 @@ 
         return fctx
     return util.lrucachefunc(makectx)
 
-def mergecopies(repo, c1, c2, ca):
+def mergecopies(repo, c1, c2, base):
     """
     Find moves and copies between context c1 and c2 that are relevant
-    for merging.
+    for merging. 'base' will be used as the merge base.
 
     Returns four dicts: "copy", "movewithdir", "diverge", and
     "renamedelete".
-
+`
     "copy" is a mapping from destination name -> source name,
     where source is in c1 and destination is in c2 or vice-versa.
 
@@ -329,7 +329,7 @@ 
 
     m1 = c1.manifest()
     m2 = c2.manifest()
-    ma = ca.manifest()
+    mb = base.manifest()
 
     # gather data from _checkcopies:
     # - diverge = record all diverges in this dict
@@ -346,17 +346,17 @@ 
             }
 
     # find interesting file sets from manifests
-    addedinm1 = m1.filesnotin(ma)
-    addedinm2 = m2.filesnotin(ma)
+    addedinm1 = m1.filesnotin(mb)
+    addedinm2 = m2.filesnotin(mb)
     u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
     u1u, u2u = u1r, u2r
     bothnew = sorted(addedinm1 & addedinm2)
 
     for f in u1u:
-        _checkcopies(c1, f, m1, m2, ca, limit, data1)
+        _checkcopies(c1, f, m1, m2, base, limit, data1)
 
     for f in u2u:
-        _checkcopies(c2, f, m2, m1, ca, limit, data2)
+        _checkcopies(c2, f, m2, m1, base, limit, data2)
 
     copy = dict(data1['copy'].items() + data2['copy'].items())
     fullcopy = dict(data1['fullcopy'].items() + data2['fullcopy'].items())
@@ -384,8 +384,8 @@ 
                 'diverge': bothdiverge,
                }
     for f in bothnew:
-        _checkcopies(c1, f, m1, m2, ca, limit, bothdata)
-        _checkcopies(c2, f, m2, m1, ca, limit, bothdata)
+        _checkcopies(c1, f, m1, m2, base, limit, bothdata)
+        _checkcopies(c2, f, m2, m1, base, limit, bothdata)
     for of, fl in bothdiverge.items():
         if len(fl) == 2 and fl[0] == fl[1]:
             copy[fl[0]] = of # not actually divergent, just matching renames