[PATCH 10 of 16] copies: make it possible to distinguish betwen _computenonoverlap invocations

Gábor Stefanik gabor.stefanik at nng.com
Sun Oct 16 10:29:55 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 4bb6c6ac3db22c3c4f947dd69496d895ad083efd
# Parent  1420cffe78a3ef2d0a2d3f125ce780754745ead8
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 1420cffe78a3 -r 4bb6c6ac3db2 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