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

login
register
mail settings
Submitter Matt Harbison
Date Nov. 10, 2018, 6:43 p.m.
Message ID <770e6cd99fb55978c97e.1541875406@Envy>
Download mbox | patch
Permalink /patch/36506/
State Accepted
Headers show

Comments

Matt Harbison - Nov. 10, 2018, 6:43 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@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.

Patch

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