Show More
@@ -167,6 +167,8 b' class phasecache(object):' | |||||
167 | if self._phaserevs is None: |
|
167 | if self._phaserevs is None: | |
168 | repo = repo.unfiltered() |
|
168 | repo = repo.unfiltered() | |
169 | revs = [public] * len(repo.changelog) |
|
169 | revs = [public] * len(repo.changelog) | |
|
170 | self._phaserevs = revs | |||
|
171 | self._populatephaseroots(repo) | |||
170 | for phase in trackedphases: |
|
172 | for phase in trackedphases: | |
171 | roots = map(repo.changelog.rev, self.phaseroots[phase]) |
|
173 | roots = map(repo.changelog.rev, self.phaseroots[phase]) | |
172 | if roots: |
|
174 | if roots: | |
@@ -174,11 +176,21 b' class phasecache(object):' | |||||
174 | revs[rev] = phase |
|
176 | revs[rev] = phase | |
175 | for rev in repo.changelog.descendants(roots): |
|
177 | for rev in repo.changelog.descendants(roots): | |
176 | revs[rev] = phase |
|
178 | revs[rev] = phase | |
177 | self._phaserevs = revs |
|
|||
178 | return self._phaserevs |
|
179 | return self._phaserevs | |
|
180 | ||||
179 | def invalidate(self): |
|
181 | def invalidate(self): | |
180 | self._phaserevs = None |
|
182 | self._phaserevs = None | |
181 |
|
183 | |||
|
184 | def _populatephaseroots(self, repo): | |||
|
185 | """Fills the _phaserevs cache with phases for the roots. | |||
|
186 | """ | |||
|
187 | cl = repo.changelog | |||
|
188 | phaserevs = self._phaserevs | |||
|
189 | for phase in trackedphases: | |||
|
190 | roots = map(cl.rev, self.phaseroots[phase]) | |||
|
191 | for root in roots: | |||
|
192 | phaserevs[root] = phase | |||
|
193 | ||||
182 | def phase(self, repo, rev): |
|
194 | def phase(self, repo, rev): | |
183 | # We need a repo argument here to be able to build _phaserevs |
|
195 | # We need a repo argument here to be able to build _phaserevs | |
184 | # if necessary. The repository instance is not stored in |
|
196 | # if necessary. The repository instance is not stored in |
General Comments 0
You need to be logged in to leave comments.
Login now