comparison mercurial/discovery.py @ 16657:b6081c2c4647

phases: introduce phasecache The original motivation was changectx.phase() had special logic to correctly lookup in repo._phaserev, including invalidating it when necessary. And at other places, repo._phaserev was accessed directly. This led to the discovery that phases state including _phaseroots, _phaserev and _dirtyphase was manipulated in localrepository.py, phases.py, repair.py, etc. phasecache helps encapsulating that. This patch replaces all phase state in localrepo with phasecache and adjust related code except for advance/retractboundary() in phases. These still access to phasecache internals directly. This will be addressed in a followup.
author Patrick Mezard <patrick@mezard.eu>
date Sat, 12 May 2012 00:24:07 +0200
parents 39d1f83eb05d
children 525fdb738975
comparison
equal deleted inserted replaced
16656:4ae3ba9e4d7a 16657:b6081c2c4647
103 if commoninc is None: 103 if commoninc is None:
104 commoninc = findcommonincoming(repo, other, force=force) 104 commoninc = findcommonincoming(repo, other, force=force)
105 og.commonheads, _any, _hds = commoninc 105 og.commonheads, _any, _hds = commoninc
106 106
107 # compute outgoing 107 # compute outgoing
108 if not repo._phaseroots[phases.secret]: 108 if not repo._phasecache.phaseroots[phases.secret]:
109 og.missingheads = onlyheads or repo.heads() 109 og.missingheads = onlyheads or repo.heads()
110 elif onlyheads is None: 110 elif onlyheads is None:
111 # use visible heads as it should be cached 111 # use visible heads as it should be cached
112 og.missingheads = phases.visibleheads(repo) 112 og.missingheads = phases.visibleheads(repo)
113 og.excluded = [ctx.node() for ctx in repo.set('secret()')] 113 og.excluded = [ctx.node() for ctx in repo.set('secret()')]