[PATCH 11 of 12] workingctx: have status method call super
Sean Farley
sean.michael.farley at gmail.com
Mon May 19 15:32:18 CDT 2014
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1400530871 18000
# Mon May 19 15:21:11 2014 -0500
# Node ID 72fef2b3276cbf1e392ac0f43355fb0437d78f9d
# Parent 29e9974217e33164493bd4fbe7417ae297d410c6
workingctx: have status method call super
Now that basectx.status exists, we use the objected oriented pattern called
'super'.
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1436,10 +1436,20 @@ class workingctx(committablectx):
self._repo.ui.warn('%s: %s\n' %
(self._repo.dirstate.pathto(f), msg))
match.bad = bad
return match
+ 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."""
def __init__(self, repo, path, filelog=None, ctx=None):
More information about the Mercurial-devel
mailing list