workingctx: have status method call super instead of customized code.
authorSean Farley <sean.michael.farley@gmail.com>
Tue, 27 May 2014 15:55:35 -0700
changeset 21595 aca692aa0712
parent 21594 9e4567829129
child 21596 83bbfb23cb24
workingctx: have status method call super instead of customized code. The old code is unneeded now that basectx has the ability to calculate the status between two context objects. Now, we use the objected oriented pattern called 'super'.
mercurial/context.py
--- a/mercurial/context.py	Thu Apr 24 18:07:42 2014 -0500
+++ b/mercurial/context.py	Tue May 27 15:55:35 2014 -0700
@@ -1438,20 +1438,17 @@
             match.bad = bad
         return match
 
-    def status(self, ignored=False, clean=False, unknown=False, match=None):
-        """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."""
-        listignored, listclean, listunknown = ignored, clean, unknown
-        s = self._dirstatestatus(match=match, ignored=listignored,
-                                 clean=listclean, unknown=listunknown)
-
-        s[0] = self._filtersuspectsymlink(s[0])
-        self._status = s
+    def status(self, other='.', match=None, listignored=False,
+               listclean=False, listunknown=False, listsubrepos=False):
+        # yet to be determined: what to do if 'other' is a 'workingctx' or a
+        # 'memctx'?
+        s = super(workingctx, self).status(other, match, listignored, listclean,
+                                           listunknown, listsubrepos)
+        # calling 'super' subtly reveresed the contexts, so we flip the results
+        # (s[1] is 'added' and s[2] is 'removed')
+        s[1], s[2] = s[2], s[1]
         return s
 
-
 class committablefilectx(basefilectx):
     """A committablefilectx provides common functionality for a file context
     that wants the ability to commit, e.g. workingfilectx or memfilectx."""