[PATCH 3 of 5] phase: handle phase with no command flag

Boris Feld boris.feld at octobus.net
Fri Aug 24 18:35:39 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1534979719 -7200
#      Thu Aug 23 01:15:19 2018 +0200
# Node ID 93824739fc0d33ce7853ccfd57818df694f5593f
# Parent  5ec0b78876f2fc334c57d664a67d342859fc2b47
# EXP-Topic internal-phase.prepare
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 93824739fc0d
phase: handle phase with no command flag

Before this changeset, all existing phases have a corresponding flag on the `hg
phase` command. (eg: `hg phase --draft`).

After this changeset, a phase can exists without having an associated flag.
This is useful to introduce a new internal phase that we do not want to expose
to user.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4030,7 +4030,7 @@ def phase(ui, repo, *revs, **opts):
     # search for a unique phase argument
     targetphase = None
     for idx, name in enumerate(phases.phasenames):
-        if opts[name]:
+        if opts.get(name, False):
             if targetphase is not None:
                 raise error.Abort(_('only one phase can be specified'))
             targetphase = idx


More information about the Mercurial-devel mailing list