comparison mercurial/phases.py @ 16659:58edd786e96f

phase: make if abort on nullid for the good reason The good reason being you cannot call retractboundary() on nullid, not revset.set() cannot resolve '-1'.
author Patrick Mezard <patrick@mezard.eu>
date Sat, 12 May 2012 00:24:07 +0200
parents 6b3d31d04a69
children 00535da82faf
comparison
equal deleted inserted replaced
16658:6b3d31d04a69 16659:58edd786e96f
99 """ 99 """
100 100
101 import errno 101 import errno
102 from node import nullid, nullrev, bin, hex, short 102 from node import nullid, nullrev, bin, hex, short
103 from i18n import _ 103 from i18n import _
104 import util
104 105
105 allphases = public, draft, secret = range(3) 106 allphases = public, draft, secret = range(3)
106 trackedphases = allphases[1:] 107 trackedphases = allphases[1:]
107 phasenames = ['public', 'draft', 'secret'] 108 phasenames = ['public', 'draft', 'secret']
108 109
248 249
249 currentroots = self.phaseroots[targetphase] 250 currentroots = self.phaseroots[targetphase]
250 newroots = [n for n in nodes 251 newroots = [n for n in nodes
251 if self.phase(repo, repo[n].rev()) < targetphase] 252 if self.phase(repo, repo[n].rev()) < targetphase]
252 if newroots: 253 if newroots:
254 if nullid in newroots:
255 raise util.Abort(_('cannot change null revision phase'))
253 currentroots = currentroots.copy() 256 currentroots = currentroots.copy()
254 currentroots.update(newroots) 257 currentroots.update(newroots)
255 ctxs = repo.set('roots(%ln::)', currentroots) 258 ctxs = repo.set('roots(%ln::)', currentroots)
256 currentroots.intersection_update(ctx.node() for ctx in ctxs) 259 currentroots.intersection_update(ctx.node() for ctx in ctxs)
257 self._updateroots(targetphase, currentroots) 260 self._updateroots(targetphase, currentroots)