Patchwork [04,of,19] localrepo: factor out _manifestmatch logic for workingctx

login
register
mail settings
Submitter Sean Farley
Date May 15, 2014, 9:16 p.m.
Message ID <2390fc12ef1cbbad4f80.1400188582@laptop.local>
Download mbox | patch
Permalink /patch/4763/
State Accepted
Commit 870ddcf24291f5a0f666552c600c3234c3fd1e65
Headers show

Comments

Sean Farley - May 15, 2014, 9:16 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1397594610 18000
#      Tue Apr 15 15:43:30 2014 -0500
# Node ID 2390fc12ef1cbbad4f80f18a80ab38305b4fd2b9
# Parent  92f56bf667e28d86f35448852f482cf4085b46f9
localrepo: factor out _manifestmatch logic for workingctx

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1222,10 +1222,27 @@  class workingctx(committablectx):
                     wlock.release()
             except error.LockError:
                 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.'''
         listignored, listclean, listunknown = ignored, clean, unknown
         match = match or matchmod.always(self._repo.root, self._repo.getcwd())