diff mercurial/copies.py @ 30197:0accd5a5ad04

mergecopies: invoke _computenonoverlap for both base and tca during merges The algorithm of _checkcopies can only walk backwards in the DAG, never forward. Because of this, the two _checkcopies patches need to run from their respective endpoints to the TCA to cover the entire subgraph where the merge is being performed. However, detection of files new in both endpoints, as well as directory rename detection, need to run with respect to the merge base, so we need lists of new files both from the TCA's and the merge base's viewpoint to correctly detect renames in a graft-like merge scenario. (Series reworked by Pierre-Yves David)
author Gábor Stefanik <gabor.stefanik@nng.com>
date Thu, 13 Oct 2016 02:19:43 +0200
parents d738cda70894
children 856ead835f56
line wrap: on
line diff
--- a/mercurial/copies.py	Tue Oct 18 00:00:43 2016 +0200
+++ b/mercurial/copies.py	Thu Oct 13 02:19:43 2016 +0200
@@ -373,9 +373,21 @@
     # find interesting file sets from manifests
     addedinm1 = m1.filesnotin(mb)
     addedinm2 = m2.filesnotin(mb)
-    u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
-    u1u, u2u = u1r, u2r
     bothnew = sorted(addedinm1 & addedinm2)
+    if tca == base:
+        # unmatched file from base
+        u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
+        u1u, u2u = u1r, u2r
+    else:
+        # unmatched file from base (DAG rotation in the graft case)
+        u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2,
+                                      baselabel='base')
+        # unmatched file from topological common ancestors (no DAG rotation)
+        # need to recompute this for directory move handling when grafting
+        mta = tca.manifest()
+        u1u, u2u = _computenonoverlap(repo, c1, c2, m1.filesnotin(mta),
+                                                    m2.filesnotin(mta),
+                                      baselabel='topological common ancestor')
 
     for f in u1u:
         _checkcopies(c1, f, m1, m2, base, tca, limit, data1)