diff mercurial/copies.py @ 30204:1894c830ee74

copies: make _checkcopies handle copy sequences spanning the TCA (issue4028) When working in a rotated DAG (for a graftlike merge), there can be files that are renamed both between the base and the topological CA, and between the TCA and the endpoint farther from the base. Such renames span the TCA (and thus need both passes of _checkcopies to be fully detected), but may not necessarily be divergent. Make _checkcopies return "incomplete copies" and "incomplete divergences" in this case, and let mergecopies recombine them once data from both passes of _checkcopies is available. With this patch, all known cases involving renames and grafts pass. (Developed together with Pierre-Yves David)
author Gábor Stefanik <gabor.stefanik@nng.com>
date Tue, 11 Oct 2016 04:39:47 +0200
parents b94b92f0c683
children 87a7c0d403ff
line wrap: on
line diff
--- a/mercurial/copies.py	Tue Oct 11 04:25:59 2016 +0200
+++ b/mercurial/copies.py	Tue Oct 11 04:39:47 2016 +0200
@@ -611,6 +611,7 @@
     """
 
     mb = base.manifest()
+    mta = tca.manifest()
     # Might be true if this call is about finding backward renames,
     # This happens in the case of grafts because the DAG is then rotated.
     # If the file exists in both the base and the source, we are not looking
@@ -665,8 +666,17 @@
                         break
             return
 
-    if of in mb:
-        data['diverge'].setdefault(of, []).append(f)
+    if of in mta:
+        if backwards or remotebase:
+            data['incomplete'][of] = f
+        else:
+            for sf in seen:
+                if sf in mb:
+                    if tca == base:
+                        data['diverge'].setdefault(sf, []).append(f)
+                    else:
+                        data['incompletediverge'][sf] = [of, f]
+                    return
 
 def duplicatecopies(repo, rev, fromrev, skiprev=None):
     '''reproduce copies from fromrev to rev in the dirstate