comparison mercurial/phases.py @ 39298:fd7376fa60e7

phase: use `trackedphases` in `_getphaserevsnative` Instead of manually listing secret and draft, simply use the `trackedphases` constant. The constant is already used by `_getphaserevsnative`.
author Boris Feld <boris.feld@octobus.net>
date Tue, 05 Jun 2018 18:16:07 +0200
parents 5b9f116104f9
children 160bd45cc6af
comparison
equal deleted inserted replaced
39297:37e56607cbb9 39298:fd7376fa60e7
270 270
271 def _computephaserevspure(self, repo): 271 def _computephaserevspure(self, repo):
272 repo = repo.unfiltered() 272 repo = repo.unfiltered()
273 cl = repo.changelog 273 cl = repo.changelog
274 self._phasesets = [set() for phase in allphases] 274 self._phasesets = [set() for phase in allphases]
275 roots = pycompat.maplist(cl.rev, self.phaseroots[secret]) 275 lowerroots = set()
276 if roots: 276 for phase in reversed(trackedphases):
277 ps = set(cl.descendants(roots)) 277 roots = pycompat.maplist(cl.rev, self.phaseroots[phase])
278 for root in roots: 278 if roots:
279 ps.add(root) 279 ps = set(cl.descendants(roots))
280 self._phasesets[secret] = ps 280 for root in roots:
281 roots = pycompat.maplist(cl.rev, self.phaseroots[draft]) 281 ps.add(root)
282 if roots: 282 ps.difference_update(lowerroots)
283 ps = set(cl.descendants(roots)) 283 lowerroots.update(ps)
284 for root in roots: 284 self._phasesets[phase] = ps
285 ps.add(root)
286 ps.difference_update(self._phasesets[secret])
287 self._phasesets[draft] = ps
288 self._loadedrevslen = len(cl) 285 self._loadedrevslen = len(cl)
289 286
290 def loadphaserevs(self, repo): 287 def loadphaserevs(self, repo):
291 """ensure phase information is loaded in the object""" 288 """ensure phase information is loaded in the object"""
292 if self._phasesets is None: 289 if self._phasesets is None: