[PATCH 2 of 2 V2] phase: use the `phases.cmdphasenames` constant to walk available command flags

Matt Harbison mharbison72 at gmail.com
Sat Nov 10 13:43:26 EST 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1541875038 18000
#      Sat Nov 10 13:37:18 2018 -0500
# Node ID 770e6cd99fb55978c97e0e8b72259ee316a85b83
# Parent  99a5c20cec23506828eb7e3e40c7a05ab2f35d74
phase: use the `phases.cmdphasenames` constant to walk available command flags

This reverts 1ea6772fb415.

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


More information about the Mercurial-devel mailing list