Patchwork [v2,more-matchers] manifestmerge: have manifest do matching before diffing

mail settings
Submitter Augie Fackler
Date Dec. 15, 2015, 11:30 p.m.
Message ID <5420a4baf9a44265cf09.1450222201@imladris.local>
Download mbox | patch
Permalink /patch/12060/
State Accepted
Headers show


Augie Fackler - Dec. 15, 2015, 11:30 p.m.
# HG changeset patch
# User Augie Fackler <>
# Date 1450144641 18000
#      Mon Dec 14 20:57:21 2015 -0500
# Node ID 5420a4baf9a44265cf095f451dd5cccade7b1c68
# Parent  7e8a883da1711008262150bb6f64131812de3e0b
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.


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