Mercurial > hg
changeset 21592:16f62b4203b1
committablectx: simplify caching the status
Previously, workingctx had custom variables for the unknown, ignored, and clean
list of files of status. These then got moved to committablectx and, after the
refactoring of localrepo.status, are no longer needed. We, therefore, simplify
the whole mess.
As a bonus, we are able to remove the need for having 'assert'.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Thu, 24 Apr 2014 17:31:20 -0500 |
parents | 660ef8ca8c3c |
children | b2d6bc6f9c3e |
files | mercurial/context.py |
diffstat | 1 files changed, 9 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Wed Apr 23 16:08:20 2014 -0500 +++ b/mercurial/context.py Thu Apr 24 17:31:20 2014 -0500 @@ -892,14 +892,7 @@ if user: self._user = user if changes: - self._status = list(changes[:4]) - self._unknown = changes[4] - self._ignored = changes[5] - self._clean = changes[6] - else: - self._unknown = None - self._ignored = None - self._clean = None + self._status = changes self._extra = {} if extra: @@ -974,7 +967,7 @@ copied = self._repo.dirstate.copies() ff = self._flagfunc - modified, added, removed, deleted = self._status + modified, added, removed, deleted = self._status[:4] for i, l in (("a", added), ("m", modified)): for f in l: orig = copied.get(f, f) @@ -992,7 +985,7 @@ @propertycache def _status(self): - return self._repo.status()[:4] + return self._repo.status() @propertycache def _user(self): @@ -1023,14 +1016,11 @@ def deleted(self): return self._status[3] def unknown(self): - assert self._unknown is not None # must call status first - return self._unknown + return self._status[4] def ignored(self): - assert self._ignored is not None # must call status first - return self._ignored + return self._status[5] def clean(self): - assert self._clean is not None # must call status first - return self._clean + return self._status[6] def branch(self): return encoding.tolocal(self._extra['branch']) def closesbranch(self): @@ -1395,20 +1385,10 @@ listignored, listclean, listunknown = ignored, clean, unknown s = self._dirstatestatus(match=match, ignored=listignored, clean=listclean, unknown=listunknown) - modified, added, removed, deleted, unknown, ignored, clean = s - modified = self._filtersuspectsymlink(modified) - - self._unknown = self._ignored = self._clean = None - if listunknown: - self._unknown = unknown - if listignored: - self._ignored = ignored - if listclean: - self._clean = clean - self._status = modified, added, removed, deleted - - return modified, added, removed, deleted, unknown, ignored, clean + s[0] = self._filtersuspectsymlink(s[0]) + self._status = s + return s class committablefilectx(basefilectx):