Mercurial > hg-stable
changeset 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 | 2a71cc53f244 |
files | mercurial/commands.py mercurial/phases.py tests/test-phases.t |
diffstat | 3 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sat May 12 00:24:07 2012 +0200 +++ b/mercurial/commands.py Sat May 12 00:24:07 2012 +0200 @@ -4375,9 +4375,9 @@ lock = repo.lock() try: # set phase - nodes = [ctx.node() for ctx in repo.set('%ld', revs)] - if not nodes: - raise util.Abort(_('empty revision set')) + if not revs: + raise util.Abort(_('empty revision set')) + nodes = [repo[r].node() for r in revs] olddata = repo._phasecache.getphaserevs(repo)[:] phases.advanceboundary(repo, targetphase, nodes) if opts['force']:
--- 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)
--- a/tests/test-phases.t Sat May 12 00:24:07 2012 +0200 +++ b/tests/test-phases.t Sat May 12 00:24:07 2012 +0200 @@ -13,7 +13,7 @@ Cannot change null revision phase $ hg phase --force --secret null - abort: unknown revision '-1'! + abort: cannot change null revision phase [255] $ hg phase null -1: public