Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 21595:aca692aa0712
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'.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Tue, 27 May 2014 15:55:35 -0700 |
parents | 9e4567829129 |
children | 0a8e7f81e8ae |
comparison
equal
deleted
inserted
replaced
21594:9e4567829129 | 21595:aca692aa0712 |
---|---|
1436 self._repo.ui.warn('%s: %s\n' % | 1436 self._repo.ui.warn('%s: %s\n' % |
1437 (self._repo.dirstate.pathto(f), msg)) | 1437 (self._repo.dirstate.pathto(f), msg)) |
1438 match.bad = bad | 1438 match.bad = bad |
1439 return match | 1439 return match |
1440 | 1440 |
1441 def status(self, ignored=False, clean=False, unknown=False, match=None): | 1441 def status(self, other='.', match=None, listignored=False, |
1442 """Explicit status query | 1442 listclean=False, listunknown=False, listsubrepos=False): |
1443 Unless this method is used to query the working copy status, the | 1443 # yet to be determined: what to do if 'other' is a 'workingctx' or a |
1444 _status property will implicitly read the status using its default | 1444 # 'memctx'? |
1445 arguments.""" | 1445 s = super(workingctx, self).status(other, match, listignored, listclean, |
1446 listignored, listclean, listunknown = ignored, clean, unknown | 1446 listunknown, listsubrepos) |
1447 s = self._dirstatestatus(match=match, ignored=listignored, | 1447 # calling 'super' subtly reveresed the contexts, so we flip the results |
1448 clean=listclean, unknown=listunknown) | 1448 # (s[1] is 'added' and s[2] is 'removed') |
1449 | 1449 s[1], s[2] = s[2], s[1] |
1450 s[0] = self._filtersuspectsymlink(s[0]) | |
1451 self._status = s | |
1452 return s | 1450 return s |
1453 | |
1454 | 1451 |
1455 class committablefilectx(basefilectx): | 1452 class committablefilectx(basefilectx): |
1456 """A committablefilectx provides common functionality for a file context | 1453 """A committablefilectx provides common functionality for a file context |
1457 that wants the ability to commit, e.g. workingfilectx or memfilectx.""" | 1454 that wants the ability to commit, e.g. workingfilectx or memfilectx.""" |
1458 def __init__(self, repo, path, filelog=None, ctx=None): | 1455 def __init__(self, repo, path, filelog=None, ctx=None): |