Mercurial > public > mercurial-scm > hg-stable
diff mercurial/context.py @ 16657:b6081c2c4647
phases: introduce phasecache
The original motivation was changectx.phase() had special logic to
correctly lookup in repo._phaserev, including invalidating it when
necessary. And at other places, repo._phaserev was accessed directly.
This led to the discovery that phases state including _phaseroots,
_phaserev and _dirtyphase was manipulated in localrepository.py,
phases.py, repair.py, etc. phasecache helps encapsulating that.
This patch replaces all phase state in localrepo with phasecache and
adjust related code except for advance/retractboundary() in phases.
These still access to phasecache internals directly. This will be
addressed in a followup.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sat, 12 May 2012 00:24:07 +0200 |
parents | f1745323a567 |
children | 525fdb738975 |
line wrap: on
line diff
--- a/mercurial/context.py Sat May 12 00:19:30 2012 +0200 +++ b/mercurial/context.py Sat May 12 00:24:07 2012 +0200 @@ -191,12 +191,7 @@ def bookmarks(self): return self._repo.nodebookmarks(self._node) def phase(self): - if self._rev == -1: - return phases.public - if self._rev >= len(self._repo._phaserev): - # outdated cache - del self._repo._phaserev - return self._repo._phaserev[self._rev] + return self._repo._phasecache.phase(self._repo, self._rev) def phasestr(self): return phases.phasenames[self.phase()] def mutable(self):