compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow stable
authorBoris Feld <boris.feld@octobus.net>
Wed, 07 Nov 2018 19:35:48 +0100
branchstable
changeset 4223 4a3d588e5311
parent 4222 b757f06193d0
child 4224 12b026c49fdf
child 4229 a8ed26f01c8d
compat: fix fixedcopytracing compatibility with mercurial 4.8 and narrow Mercurial 4.8 version of _fullcopytracing includes some new narrow code. As https://phab.mercurial-scm.org/D3896 has not yet landed, update fixedcopytracing behind a version detection condition. This was spotted by Augie Fackler.
CHANGELOG
hgext3rd/evolve/compat.py
--- a/CHANGELOG	Thu Nov 01 21:33:15 2018 +0300
+++ b/CHANGELOG	Wed Nov 07 19:35:48 2018 +0100
@@ -6,6 +6,7 @@
 -------------------
 
   * evolve: not longer attempt to translate revision's descriptions (issue6016)
+  * evolve: fix compatibility with mercurial 4.8's narrow extension.
 
 8.3.1 -- 2018-10-25
 -------------------
--- a/hgext3rd/evolve/compat.py	Thu Nov 01 21:33:15 2018 +0300
+++ b/hgext3rd/evolve/compat.py	Wed Nov 07 19:35:48 2018 +0100
@@ -214,6 +214,7 @@
         return bool(upres[-1])
     return bool(upres.unresolvedcount)
 
+hg48 = util.safehasattr(copies, 'stringutil')
 # code imported from Mercurial core at ae17555ef93f + patch
 def fixedcopytracing(repo, c1, c2, base):
     """A complete copy-patse of copies._fullcopytrace with a one line fix to
@@ -280,8 +281,12 @@
             }
 
     # find interesting file sets from manifests
-    addedinm1 = m1.filesnotin(mb)
-    addedinm2 = m2.filesnotin(mb)
+    if hg48:
+        addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
+        addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
+    else:
+        addedinm1 = m1.filesnotin(mb)
+        addedinm2 = m2.filesnotin(mb)
     bothnew = sorted(addedinm1 & addedinm2)
     if tca == base:
         # unmatched file from base
@@ -294,9 +299,16 @@
         # unmatched file from topological common ancestors (no DAG rotation)
         # need to recompute this for directory move handling when grafting
         mta = tca.manifest()
-        u1u, u2u = copies._computenonoverlap(repo, c1, c2, m1.filesnotin(mta),
-                                             m2.filesnotin(mta),
-                                             baselabel='topological common ancestor')
+        if hg48:
+            m1f = m1.filesnotin(mta, repo.narrowmatch())
+            m2f = m2.filesnotin(mta, repo.narrowmatch())
+            baselabel = 'topological common ancestor'
+            u1u, u2u = copies._computenonoverlap(repo, c1, c2, m1f, m2f,
+                                                 baselabel=baselabel)
+        else:
+            u1u, u2u = copies._computenonoverlap(repo, c1, c2, m1.filesnotin(mta),
+                                                 m2.filesnotin(mta),
+                                                 baselabel='topological common ancestor')
 
     for f in u1u:
         copies._checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1)