[PATCH 4 of 4 more-matchers] manifestmerge: have manifest do matching before diffing

Augie Fackler raf at durin42.com
Mon Dec 14 21:17:20 CST 2015


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1450144641 18000
#      Mon Dec 14 20:57:21 2015 -0500
# Node ID 7048ea9ba5b92e4f582524463a6167039fa44eeb
# Parent  5eee49ed60caa99be140f7f80ac7fb07f1c0324d
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 help
with narrowed clone cases (such as narrowhg) when we don't always have
the entire set of treemanifest revlogs locally.

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -722,12 +722,13 @@ def manifestmerge(repo, wctx, p2, pa, br
                 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)


More information about the Mercurial-devel mailing list