[PATCH 6 of 8] context: add private _dirstatestatus method

Sean Farley sean.michael.farley at gmail.com
Tue May 6 18:33:23 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1398190491 18000
#      Tue Apr 22 13:14:51 2014 -0500
# Node ID d556bbc7a4a12f0c644be280a95c649f0d113437
# Parent  2bb99e94978f9da3a6eb50bbddcbbfec28f399a1
context: add private _dirstatestatus method

This method is mostly a copy from workingctx.status. The custom status method
of workingctx will eventually be absorbed by the refactoring of
localrepo.status to context.status but unfortunately we can't do it in one
step.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1213,10 +1213,33 @@ class workingctx(committablectx):
                     wlock.release()
             except error.LockError:
                 pass
         return modified, fixup
 
+    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())
+        subrepos = []
+        if '.hgsub' in self:
+            subrepos = sorted(self.substate)
+        s = self._repo.dirstate.status(match, subrepos, listignored,
+                                       listclean, listunknown)
+        cmp, modified, added, removed, deleted, unknown, ignored, clean = s
+
+        # check for any possibly clean files
+        if cmp:
+            modified2, fixup = self._checklookup(cmp)
+            modified += modified2
+
+            # update dirstate for files that are actually clean
+            if fixup and listclean:
+                clean += fixup
+
+        return [modified, added, removed, deleted, unknown, ignored, clean]
+
     def status(self, ignored=False, clean=False, unknown=False):
         """Explicit status query
         Unless this method is used to query the working copy status, the
         _status property will implicitly read the status using its default
         arguments."""


More information about the Mercurial-devel mailing list