[PATCH 06 of 12 v2] copies: make it possible to distinguish betwen _computenonoverlap invocations

Gábor Stefanik gabor.stefanik at nng.com
Sun Oct 16 11:15:43 EDT 2016


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1476372109 -7200
#      Thu Oct 13 17:21:49 2016 +0200
# Node ID 72b4f2514efd9decffb1115c0f7b8e8f004bdf44
# Parent  48dba8d1f7fab137418bfbb833c3096969eec934
copies: make it possible to distinguish betwen _computenonoverlap invocations

_computenonoverlap needs to be invoked twice during a graft, and debugging
messages should be distinguishable between the two invocations

diff -r 48dba8d1f7fa -r 72b4f2514efd mercurial/copies.py
--- a/mercurial/copies.py	Thu Oct 13 02:03:54 2016 +0200
+++ b/mercurial/copies.py	Thu Oct 13 17:21:49 2016 +0200
@@ -231,23 +231,27 @@
     return _chain(x, y, _backwardrenames(x, a),
                   _forwardcopies(a, y, match=match))
 
-def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2):
+def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, baselabel=''):
     """Computes, based on addedinm1 and addedinm2, the files exclusive to c1
     and c2. This is its own function so extensions can easily wrap this call
     to see what files mergecopies is about to process.
 
     Even though c1 and c2 are not used in this function, they are useful in
     other extensions for being able to read the file nodes of the changed files.
+
+    "baselabel" can be passed to help distinguish the multiple computations
+    done in the graft case.
     """
     u1 = sorted(addedinm1 - addedinm2)
     u2 = sorted(addedinm2 - addedinm1)
 
+    header = "  unmatched files in %s"
+    if baselabel:
+        header += ' (from %s)' % baselabel
     if u1:
-        repo.ui.debug("  unmatched files in local:\n   %s\n"
-                      % "\n   ".join(u1))
+        repo.ui.debug("%s:\n   %s\n" % (header % 'local', "\n   ".join(u1)))
     if u2:
-        repo.ui.debug("  unmatched files in other:\n   %s\n"
-                      % "\n   ".join(u2))
+        repo.ui.debug("%s:\n   %s\n" % (header % 'other', "\n   ".join(u2)))
     return u1, u2
 
 def _makegetfctx(ctx):


More information about the Mercurial-devel mailing list