localrepo: use _manifestmatches instead of duplicating logic
authorSean Farley <sean.michael.farley@gmail.com>
Tue, 11 Mar 2014 18:38:44 -0500
changeset 21467 6c90a18dd926
parent 21466 3b1ec3d4ece6
child 21468 870ddcf24291
localrepo: use _manifestmatches instead of duplicating logic
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Wed Apr 23 20:52:10 2014 -0500
+++ b/mercurial/localrepo.py	Tue Mar 11 18:38:44 2014 -0500
@@ -1511,15 +1511,6 @@
         If node2 is None, compare node1 with working directory.
         """
 
-        def mfmatches(ctx):
-            mf = ctx.manifest().copy()
-            if match.always():
-                return mf
-            for fn in mf.keys():
-                if not match(fn):
-                    del mf[fn]
-            return mf
-
         ctx1 = self[node1]
         ctx2 = self[node2]
 
@@ -1566,11 +1557,11 @@
         modified, added, removed, deleted, unknown, ignored, clean = r
 
         if not parentworking:
-            mf1 = mfmatches(ctx1)
+            mf1 = ctx1._manifestmatches(match, r)
             if working:
                 # we are comparing working dir against non-parent
                 # generate a pseudo-manifest for the working dir
-                mf2 = mfmatches(self['.'])
+                mf2 = self['.']._manifestmatches(match, r)
                 for f in modified + added:
                     mf2[f] = None
                     mf2.set(f, ctx2.flags(f))
@@ -1580,7 +1571,7 @@
             else:
                 # we are comparing two revisions
                 deleted, unknown, ignored = [], [], []
-                mf2 = mfmatches(ctx2)
+                mf2 = ctx2._manifestmatches(match, r)
 
             modified, added, clean = [], [], []
             withflags = mf1.withflags() | mf2.withflags()