# HG changeset patch # User Laurent Charignon # Date 2015-03-30 19:48:15 # Node ID de3acfabaddcf1e9f3d6a4bd9ed8579fe3b9f870 # Parent dd5e56f08d13d9147d9f0f69c423432460ae5e79 phases: move pure phase computation in a function diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -179,22 +179,25 @@ class phasecache(object): nativeroots.append(map(repo.changelog.rev, self.phaseroots[phase])) return repo.changelog.computephases(nativeroots) + def computephaserevspure(self, repo): + repo = repo.unfiltered() + revs = [public] * len(repo.changelog) + self._phaserevs = revs + self._populatephaseroots(repo) + for phase in trackedphases: + roots = map(repo.changelog.rev, self.phaseroots[phase]) + if roots: + for rev in roots: + revs[rev] = phase + for rev in repo.changelog.descendants(roots): + revs[rev] = phase + def getphaserevs(self, repo): if self._phaserevs is None: try: self._phaserevs = self.getphaserevsnative(repo) except AttributeError: - repo = repo.unfiltered() - revs = [public] * len(repo.changelog) - self._phaserevs = revs - self._populatephaseroots(repo) - for phase in trackedphases: - roots = map(repo.changelog.rev, self.phaseroots[phase]) - if roots: - for rev in roots: - revs[rev] = phase - for rev in repo.changelog.descendants(roots): - revs[rev] = phase + self.computephaserevspure(repo) return self._phaserevs def invalidate(self):