comparison mercurial/phases.py @ 15818:57241845a4bb

phases: store phase values in constant instead of using raw integer Phases constant are named after the phase name. Usage of integer have been replaced by proper constant.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 06 Jan 2012 09:51:35 +0100
parents e34f4d1f0dbb
children e3ee8bf5d0cc
comparison
equal deleted inserted replaced
15817:8f377751b510 15818:57241845a4bb
100 100
101 import errno 101 import errno
102 from node import nullid, bin, hex, short 102 from node import nullid, bin, hex, short
103 from i18n import _ 103 from i18n import _
104 104
105 allphases = range(3) 105 allphases = public, draft, secret = range(3)
106 trackedphases = allphases[1:] 106 trackedphases = allphases[1:]
107 107
108 def readroots(repo): 108 def readroots(repo):
109 """Read phase roots from disk""" 109 """Read phase roots from disk"""
110 roots = [set() for i in allphases] 110 roots = [set() for i in allphases]
240 lock.release() 240 lock.release()
241 241
242 def visibleheads(repo): 242 def visibleheads(repo):
243 """return the set of visible head of this repo""" 243 """return the set of visible head of this repo"""
244 # XXX we want a cache on this 244 # XXX we want a cache on this
245 sroots = repo._phaseroots[2] 245 sroots = repo._phaseroots[secret]
246 if sroots: 246 if sroots:
247 # XXX very slow revset. storing heads or secret "boundary" would help. 247 # XXX very slow revset. storing heads or secret "boundary" would help.
248 revset = repo.set('heads(not (%ln::))', sroots) 248 revset = repo.set('heads(not (%ln::))', sroots)
249 249
250 vheads = [ctx.node() for ctx in revset] 250 vheads = [ctx.node() for ctx in revset]