[PATCH 2 of 4 V2] context.status: make _dirstatestatus() return an status tuple

Martin von Zweigbergk martinvonz at google.com
Thu Nov 13 23:37:46 CST 2014


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1415839871 28800
#      Wed Nov 12 16:51:11 2014 -0800
# Node ID 06026f6263e354382375d1c2f8f9141b4275ad4d
# Parent  5a00e3a896a5e57c28fdde2a687297e4ea501c87
context.status: make _dirstatestatus() return an status tuple

Letting _dirstatestatus() return an scmutil.status instance also means
that _buildstatus() will always return such an instance, so we can
remove the conversion from the call sites.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -129,7 +129,8 @@
             unknown = [fn for fn in unknown if fn not in mf1]
             ignored = [fn for fn in ignored if fn not in mf1]
 
-        return [modified, added, removed, deleted, unknown, ignored, clean]
+        return scmutil.status(modified, added, removed, deleted, unknown,
+                              ignored, clean)
 
     @propertycache
     def substate(self):
@@ -304,7 +305,6 @@
         r = ctx2._buildstatus(ctx1, r, match, listignored, listclean,
                               listunknown)
 
-        r = scmutil.status(*r)
         if reversed:
             # Reverse added and removed. Deleted, unknown and ignored make no
             # sense to reverse; use None to prevent users from iterating.
@@ -1420,7 +1420,8 @@
             if fixup and listclean:
                 clean += fixup
 
-        return [modified, added, removed, deleted, unknown, ignored, clean]
+        return scmutil.status(modified, added, removed, deleted, unknown,
+                              ignored, clean)
 
     def _buildstatus(self, other, s, match, listignored, listclean,
                      listunknown):
@@ -1435,12 +1436,12 @@
         # Filter out symlinks that, in the case of FAT32 and NTFS filesytems,
         # might have accidentally ended up with the entire contents of the file
         # they are susposed to be linking to.
-        s[0] = self._filtersuspectsymlink(s[0])
+        s.modified[:] = self._filtersuspectsymlink(s.modified)
         if other != self._repo['.']:
             s = super(workingctx, self)._buildstatus(other, s, match,
                                                      listignored, listclean,
                                                      listunknown)
-        self._status = scmutil.status(*s)
+        self._status = s
         return s
 
     def _matchstatus(self, other, match):


More information about the Mercurial-devel mailing list