diff 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
line wrap: on
line diff
--- a/mercurial/phases.py	Sat May 12 00:24:07 2012 +0200
+++ b/mercurial/phases.py	Sat May 12 00:24:07 2012 +0200
@@ -101,6 +101,7 @@
 import errno
 from node import nullid, nullrev, bin, hex, short
 from i18n import _
+import util
 
 allphases = public, draft, secret = range(3)
 trackedphases = allphases[1:]
@@ -250,6 +251,8 @@
         newroots = [n for n in nodes
                     if self.phase(repo, repo[n].rev()) < targetphase]
         if newroots:
+            if nullid in newroots:
+                raise util.Abort(_('cannot change null revision phase'))
             currentroots = currentroots.copy()
             currentroots.update(newroots)
             ctxs = repo.set('roots(%ln::)', currentroots)