Patchwork [1,of,3] help: also hide options marked EXPERIMENTAL

login
register
mail settings
Submitter Laurent Charignon
Date April 27, 2015, 11:14 p.m.
Message ID <944cb089b91456883365.1430176446@dev919.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8802/
State Superseded
Headers show

Comments

Laurent Charignon - April 27, 2015, 11:14 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1430172761 25200
#      Mon Apr 27 15:12:41 2015 -0700
# Branch stable
# Node ID 944cb089b91456883365333d09b25036096ecf56
# Parent  bff42a92012e49aabd925caa3cb243116285e243
help: also hide options marked EXPERIMENTAL

Similar to DEPRECATED, add a way to indicate that options are EXPERIMENTAL.

Patch

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -43,7 +43,9 @@ 
             shortopt, longopt, default, desc = option
             optlabel = _("VALUE") # default label
 
-        if not verbose and ("DEPRECATED" in desc or _("DEPRECATED") in desc):
+        if not verbose and ("DEPRECATED" in desc or _("DEPRECATED") in desc or
+                            "EXPERIMENTAL" in desc or
+                            _("EXPERIMENTAL") in desc):
             continue
 
         so = ''
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -629,6 +629,7 @@ 
   >     'hg nohelp',
   >     norepo=True)
   > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
+  > @command('debugoptEXP', [('', 'eopt', None, 'option is EXPERIMENTAL')])
   > def nohelp(ui, *args, **kwargs):
   >     pass
   > 
@@ -788,6 +789,7 @@ 
    debugobsolete
                  create arbitrary obsolete marker
    debugoptDEP   (no help text available)
+   debugoptEXP   (no help text available)
    debugpathcomplete
                  complete part or all of a tracked path
    debugpushkey  access the pushkey key/value protocol
@@ -822,7 +824,7 @@ 
   (use "hg help -v helpext" to show built-in aliases and global options)
 
 
-test deprecated option is hidden in command help
+test deprecated and experimental options are hidden in command help
   $ hg help debugoptDEP
   hg debugoptDEP
   
@@ -832,9 +834,20 @@ 
   
   (some details hidden, use --verbose to show complete help)
 
-test deprecated option is shown with -v
+  $ hg help debugoptEXP
+  hg debugoptEXP
+  
+  (no help text available)
+  
+  options:
+  
+  (some details hidden, use --verbose to show complete help)
+
+test deprecated and experimental options is shown with -v
   $ hg help -v debugoptDEP | grep dopt
     --dopt option is DEPRECATED
+  $ hg help -v debugoptEXP | grep eopt
+    --eopt option is EXPERIMENTAL
 
 #if gettext
 test deprecated option is hidden with translation with untranslated description