Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 15420:e80d0d3198f0
phases: add a cache allowing to know in which phase a changeset is
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 04 Nov 2011 00:20:20 +0100 |
parents | cf729af26963 |
children | 5a7dde5adec8 |
comparison
equal
deleted
inserted
replaced
15419:ccb7de21625a | 15420:e80d0d3198f0 |
---|---|
171 bookmarks.write(self) | 171 bookmarks.write(self) |
172 | 172 |
173 @filecache('phaseroots') | 173 @filecache('phaseroots') |
174 def _phaseroots(self): | 174 def _phaseroots(self): |
175 return phases.readroots(self) | 175 return phases.readroots(self) |
176 | |
177 @propertycache | |
178 def _phaserev(self): | |
179 cache = [0] * len(self) | |
180 for phase in phases.trackedphases: | |
181 roots = map(self.changelog.rev, self._phaseroots[phase]) | |
182 if roots: | |
183 for rev in roots: | |
184 cache[rev] = phase | |
185 for rev in self.changelog.descendants(*roots): | |
186 cache[rev] = phase | |
187 return cache | |
176 | 188 |
177 @filecache('00changelog.i', True) | 189 @filecache('00changelog.i', True) |
178 def changelog(self): | 190 def changelog(self): |
179 c = changelog.changelog(self.sopener) | 191 c = changelog.changelog(self.sopener) |
180 if 'HG_PENDING' in os.environ: | 192 if 'HG_PENDING' in os.environ: |