[PATCH 1 of 5] copies: rename ctx() to getfctx() for clarity
Matt Mackall
mpm at selenic.com
Wed Sep 23 20:07:07 UTC 2015
# HG changeset patch
# User Matt Mackall <mpm at selenic.com>
# Date 1440007794 18000
# Wed Aug 19 13:09:54 2015 -0500
# Node ID dcad26a3da77b22847b9995aa816dd6290f2db65
# Parent 60558319ce724e8377c56591af3089380753f6de
copies: rename ctx() to getfctx() for clarity
diff -r 60558319ce72 -r dcad26a3da77 mercurial/copies.py
--- a/mercurial/copies.py Tue Sep 22 16:56:34 2015 -0700
+++ b/mercurial/copies.py Wed Aug 19 13:09:54 2015 -0500
@@ -283,7 +283,7 @@
def setupctx(ctx):
- """return a 'makectx' function suitable for checkcopies usage from ctx
+ """return a 'getfctx' function suitable for checkcopies usage
We have to re-setup the function building 'filectx' for each
'checkcopies' to ensure the linkrev adjustement is properly setup for
@@ -328,12 +328,12 @@
u1, u2 = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
for f in u1:
- ctx = setupctx(c1)
- checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy)
+ getfctx = setupctx(c1)
+ checkcopies(getfctx, f, m1, m2, ca, limit, diverge, copy, fullcopy)
for f in u2:
- ctx = setupctx(c2)
- checkcopies(ctx, f, m2, m1, ca, limit, diverge, copy, fullcopy)
+ getfctx = setupctx(c2)
+ checkcopies(getfctx, f, m2, m1, ca, limit, diverge, copy, fullcopy)
renamedelete = {}
renamedelete2 = set()
@@ -355,10 +355,10 @@
% "\n ".join(bothnew))
bothdiverge, _copy, _fullcopy = {}, {}, {}
for f in bothnew:
- ctx = setupctx(c1)
- checkcopies(ctx, f, m1, m2, ca, limit, bothdiverge, _copy, _fullcopy)
- ctx = setupctx(c2)
- checkcopies(ctx, f, m2, m1, ca, limit, bothdiverge, _copy, _fullcopy)
+ getfctx = setupctx(c1)
+ checkcopies(getfctx, f, m1, m2, ca, limit, bothdiverge, _copy, _fullcopy)
+ getfctx = setupctx(c2)
+ checkcopies(getfctx, f, m2, m1, ca, limit, bothdiverge, _copy, _fullcopy)
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
@@ -438,11 +438,11 @@
return copy, movewithdir, diverge, renamedelete
-def checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy):
+def checkcopies(getfctx, f, m1, m2, ca, limit, diverge, copy, fullcopy):
"""
check possible copies of f from m1 to m2
- ctx = function accepting (filename, node) that returns a filectx.
+ getfctx = function accepting (filename, node) that returns a filectx.
f = the filename to check
m1 = the source manifest
m2 = the destination manifest
@@ -488,7 +488,7 @@
of = None
seen = set([f])
- for oc in ctx(f, m1[f]).ancestors():
+ for oc in getfctx(f, m1[f]).ancestors():
ocr = oc.linkrev()
of = oc.path()
if of in seen:
@@ -503,7 +503,7 @@
continue # no match, keep looking
if m2[of] == ma.get(of):
break # no merge needed, quit early
- c2 = ctx(of, m2[of])
+ c2 = getfctx(of, m2[of])
cr = _related(oc, c2, ca.rev())
if cr and (of == f or of == c2.path()): # non-divergent
copy[f] = of
More information about the Mercurial-devel
mailing list