diff mercurial/copies.py @ 30201:856ead835f56

checkcopies: handle divergences contained entirely in tca::ctx During a graftlike merge, _checkcopies runs from ctx to tca, possibly passing over the merge base. If there is a rename both before and after the base, then we're actually dealing with divergent renames. If there is no rename on the other side of tca, then the divergence is contained entirely in the range of one _checkcopies invocation, and should be detected "in the loop" without having to rely on the other _checkcopies pass.
author Gábor Stefanik <gabor.stefanik@nng.com>
date Wed, 12 Oct 2016 11:54:03 +0200
parents 0accd5a5ad04
children a005c33d0bd7
line wrap: on
line diff
--- a/mercurial/copies.py	Thu Aug 25 22:02:26 2016 +0200
+++ b/mercurial/copies.py	Wed Oct 12 11:54:03 2016 +0200
@@ -564,9 +564,8 @@
     # traversed backwards.
     #
     # In the case there is both backward and forward renames (before and after
-    # the base) this is more complicated as we must detect a divergence. This
-    # is currently broken and hopefully some later code update will make that
-    # work (we use 'backwards = False' in that case)
+    # the base) this is more complicated as we must detect a divergence.
+    # We use 'backwards = False' in that case.
     backwards = base != tca and f in mb
     getfctx = _makegetfctx(ctx)
 
@@ -600,6 +599,12 @@
                 data['copy'][of] = f
             elif of in mb:
                 data['copy'][f] = of
+            else: # divergence w.r.t. graft CA on one side of topological CA
+                for sf in seen:
+                    if sf in mb:
+                        assert sf not in data['diverge']
+                        data['diverge'][sf] = [f, of]
+                        break
             return
 
     if of in mb: