changeset 21397:38743c59f3f8

context: add private _dirstatestatus method This patch is a step forward in getting rid of needing to check 'parentworking' throughout the status method. Eventually, we will use the power of inheritance to do the correct thing when comparing the working directory with its parent. This method is mostly a copy from localrepo.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.
author Sean Farley <sean.michael.farley@gmail.com>
date Tue, 22 Apr 2014 13:14:51 -0500
parents 3925d9460d27
children ed608a544719
files mercurial/context.py
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Tue Mar 11 18:28:09 2014 -0500
+++ b/mercurial/context.py	Tue Apr 22 13:14:51 2014 -0500
@@ -1213,6 +1213,29 @@
                 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