Patchwork [1,of,3] checkcopies: rename 'ca' to 'base'

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 9, 2016, 2:18 p.m.
Message ID <c06cb63082bf1111571f.1476022726@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/17010/
State Accepted
Headers show

Comments

Pierre-Yves David - Oct. 9, 2016, 2:18 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1475944722 -7200
#      Sat Oct 08 18:38:42 2016 +0200
# Node ID c06cb63082bf1111571fb6fc24bac2e23feefe00
# Parent  2c8ec8c2ddfeb2d229b81eb5b11e3639fb34b0a0
# EXP-Topic checkcopies
checkcopies: rename 'ca' to 'base'

This variable was name 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.
Yuya Nishihara - Oct. 12, 2016, 1:43 p.m.
On Sun, 09 Oct 2016 16:18:46 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1475944722 -7200
> #      Sat Oct 08 18:38:42 2016 +0200
> # Node ID c06cb63082bf1111571fb6fc24bac2e23feefe00
> # Parent  2c8ec8c2ddfeb2d229b81eb5b11e3639fb34b0a0
> # EXP-Topic checkcopies
> checkcopies: rename 'ca' to 'base'

LGTM, queued the series, thanks.

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -454,7 +454,7 @@  def mergecopies(repo, c1, c2, ca):
 
     return copy, movewithdir, diverge, renamedelete
 
-def _checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy):
+def _checkcopies(ctx, f, m1, m2, base, limit, diverge, copy, fullcopy):
     """
     check possible copies of f from m1 to m2
 
@@ -462,7 +462,7 @@  def _checkcopies(ctx, f, m1, m2, ca, lim
     f = the filename to check
     m1 = the source manifest
     m2 = the destination manifest
-    ca = the changectx of the common ancestor
+    base = the changectx used as a merge base
     limit = the rev number to not search beyond
     diverge = record all diverges in this dict
     copy = record all non-divergent copies in this dict
@@ -474,7 +474,7 @@  def _checkcopies(ctx, f, m1, m2, ca, lim
     once it "goes behind a certain revision".
     """
 
-    ma = ca.manifest()
+    mb = base.manifest()
     getfctx = _makegetfctx(ctx)
 
     def _related(f1, f2, limit):
@@ -523,15 +523,15 @@  def _checkcopies(ctx, f, m1, m2, ca, lim
         fullcopy[f] = of # remember for dir rename detection
         if of not in m2:
             continue # no match, keep looking
-        if m2[of] == ma.get(of):
+        if m2[of] == mb.get(of):
             return # no merge needed, quit early
         c2 = getfctx(of, m2[of])
-        cr = _related(oc, c2, ca.rev())
+        cr = _related(oc, c2, base.rev())
         if cr and (of == f or of == c2.path()): # non-divergent
             copy[f] = of
             return
 
-    if of in ma:
+    if of in mb:
         diverge.setdefault(of, []).append(f)
 
 def duplicatecopies(repo, rev, fromrev, skiprev=None):