Patchwork [1,of,2,V2] phases: add a list of names usable by the phase command

login
register
mail settings
Submitter Matt Harbison
Date Nov. 10, 2018, 6:43 p.m.
Message ID <99a5c20cec23506828eb.1541875405@Envy>
Download mbox | patch
Permalink /patch/36505/
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 1541823593 18000
#      Fri Nov 09 23:19:53 2018 -0500
# Node ID 99a5c20cec23506828eb7e3e40c7a05ab2f35d74
# Parent  aca09df32819d8571cd94bf5827b33c604191a8d
phases: add a list of names usable by the phase command

This is useful in TortoiseHg for example, which has until recently just added
all names in the `phasenames` list to the context menu that changes the phase.
The ones not supported by the command would just error out.
Yuya Nishihara - Nov. 11, 2018, 12:46 a.m.
On Sat, 10 Nov 2018 13:43:25 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1541823593 18000
> #      Fri Nov 09 23:19:53 2018 -0500
> # Node ID 99a5c20cec23506828eb7e3e40c7a05ab2f35d74
> # Parent  aca09df32819d8571cd94bf5827b33c604191a8d
> phases: add a list of names usable by the phase command

Queued, thanks.

Patch

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -133,8 +133,9 @@  archived = HIDEABLE_FLAG
 allphases = range(internal + 1)
 trackedphases = allphases[1:]
 # record phase names
+cmdphasenames = ['public', 'draft', 'secret']  # known to `hg phase` command
 phasenames = [None] * len(allphases)
-phasenames[:3] = ['public', 'draft', 'secret']
+phasenames[:len(cmdphasenames)] = cmdphasenames
 phasenames[archived] = 'archived'
 phasenames[internal] = 'internal'
 # record phase property