changeset 22916:cfa8d7561938

context: store status class instead of plain tuple in self._status This improves readability a bit by allowing us to refer to statuses by name rather than index.
author Martin von Zweigbergk <martinvonz@gmail.com>
date Sat, 04 Oct 2014 21:05:41 -0700
parents 4d680deb0d9e
children 1c38b4063586
files mercurial/context.py
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Oct 10 10:14:35 2014 -0700
+++ b/mercurial/context.py	Sat Oct 04 21:05:41 2014 -0700
@@ -1051,8 +1051,7 @@
 
         copied = self._repo.dirstate.copies()
         ff = self._flagfunc
-        modified, added, removed, deleted = self._status[:4]
-        for i, l in (("a", added), ("m", modified)):
+        for i, l in (("a", self._status.added), ("m", self._status.modified)):
             for f in l:
                 orig = copied.get(f, f)
                 man[f] = getman(orig).get(orig, nullid) + i
@@ -1061,7 +1060,7 @@
                 except OSError:
                     pass
 
-        for f in deleted + removed:
+        for f in self._status.deleted + self._status.removed:
             if f in man:
                 del man[f]
 
@@ -1089,22 +1088,23 @@
     def description(self):
         return self._text
     def files(self):
-        return sorted(self._status[0] + self._status[1] + self._status[2])
+        return sorted(self._status.modified + self._status.added +
+                      self._status.removed)
 
     def modified(self):
-        return self._status[0]
+        return self._status.modified
     def added(self):
-        return self._status[1]
+        return self._status.added
     def removed(self):
-        return self._status[2]
+        return self._status.removed
     def deleted(self):
-        return self._status[3]
+        return self._status.deleted
     def unknown(self):
-        return self._status[4]
+        return self._status.unknown
     def ignored(self):
-        return self._status[5]
+        return self._status.ignored
     def clean(self):
-        return self._status[6]
+        return self._status.clean
     def branch(self):
         return encoding.tolocal(self._extra['branch'])
     def closesbranch(self):
@@ -1407,7 +1407,7 @@
         susposed to be linking to.
         """
         s[0] = self._filtersuspectsymlink(s[0])
-        self._status = s[:]
+        self._status = scmutil.status(*s)
         return s
 
     def _dirstatestatus(self, match=None, ignored=False, clean=False,
@@ -1613,7 +1613,7 @@
         p1, p2 = parents
         self._parents = [changectx(self._repo, p) for p in (p1, p2)]
         files = sorted(set(files))
-        self._status = [files, [], [], [], []]
+        self._status = scmutil.status(files, [], [], [], [], [], [])
         self._filectxfn = filectxfn
         self.substate = {}