localrepo: factor out _manifestmatch logic for workingctx
authorSean Farley <sean.michael.farley@gmail.com>
Tue, 15 Apr 2014 15:43:30 -0500
changeset 21468 870ddcf24291
parent 21467 6c90a18dd926
child 21469 65cdc6bab91e
localrepo: factor out _manifestmatch logic for workingctx
mercurial/context.py
--- a/mercurial/context.py	Tue Mar 11 18:38:44 2014 -0500
+++ b/mercurial/context.py	Tue Apr 15 15:43:30 2014 -0500
@@ -1228,6 +1228,23 @@
                 pass
         return modified, fixup
 
+    def _manifestmatches(self, match, s):
+        """Slow path for workingctx
+
+        The fast path is when we compare the working directory to its parent
+        which means this function is comparing with a non-parent; therefore we
+        need to build a manifest and return what matches.
+        """
+        mf = self._repo['.']._manifestmatches(match, s)
+        modified, added, removed = s[0:3]
+        for f in modified + added:
+            mf[f] = None
+            mf.set(f, self.flags(f))
+        for f in removed:
+            if f in mf:
+                del mf[f]
+        return mf
+
     def _dirstatestatus(self, match=None, ignored=False, clean=False,
                         unknown=False):
         '''Gets the status from the dirstate -- internal use only.'''