manifestmerge: have manifest do matching before diffing
authorAugie Fackler <augie@google.com>
Mon, 14 Dec 2015 20:57:21 -0500
changeset 27429 2e31a17ad1bf
parent 27428 71d0fd3c2e24
child 27431 8f016345e6b0
manifestmerge: have manifest do matching before diffing This means that the diff code does less work, potentially significantly less in the case of treemanifests. It also should ease implementation with narrowed clone cases (such as narrowhg) when we don't always have the entire set of treemanifest revlogs locally. As far as I can tell, this codepath is currently only used by record, so it'll probably die in the near future, and then narrowhg won't have to worry about composing with some unknown matching system.
mercurial/merge.py
--- a/mercurial/merge.py	Thu Dec 17 14:57:20 2015 +0000
+++ b/mercurial/merge.py	Mon Dec 14 20:57:21 2015 -0500
@@ -722,12 +722,13 @@
                 break
 
     # Compare manifests
+    if matcher is not None:
+        m1 = m1.matches(matcher)
+        m2 = m2.matches(matcher)
     diff = m1.diff(m2)
 
     actions = {}
     for f, ((n1, fl1), (n2, fl2)) in diff.iteritems():
-        if matcher and not matcher(f):
-            continue
         if n1 and n2: # file exists on both local and remote side
             if f not in ma:
                 fa = copy.get(f, None)