# HG changeset patch # User Sean Farley # Date 1398378680 18000 # Node ID 16f62b4203b18f01c261501c77fcc738774f43e6 # Parent 660ef8ca8c3c1258087ded07657e6c45aeb03532 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'. diff -r 660ef8ca8c3c -r 16f62b4203b1 mercurial/context.py --- 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):