Patchwork D5430: help: use "default: on" instead of "default: True"

login
register
mail settings
Submitter phabricator
Date Dec. 15, 2018, 1:36 a.m.
Message ID <a0147beaded5b608a1e7b9f2ef948ca9@localhost.localdomain>
Download mbox | patch
Permalink /patch/37170/
State Not Applicable
Headers show

Comments

phabricator - Dec. 15, 2018, 1:36 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2c10c4eaa777: help: use &quot;default: on&quot; instead of &quot;default: True&quot; (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5430?vs=12861&id=12866

REVISION DETAIL
  https://phab.mercurial-scm.org/D5430

AFFECTED FILES
  mercurial/help.py
  tests/test-help.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -809,6 +809,8 @@ 
   >     [(b'', b'longdesc', 3, b'x'*67),
   >     (b'n', b'', None, b'normal desc'),
   >     (b'', b'newline', b'', b'line1\nline2'),
+  >     (b'', b'default-off', False, b'enable X'),
+  >     (b'', b'default-on', True, b'enable Y'),
   >     (b'', b'callableopt', func, b'adds foo'),
   >     (b'', b'customopt', customopt(''), b'adds bar'),
   >     (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')],
@@ -903,6 +905,8 @@ 
                                     xxxxxxxxxxxxxxxxxxxxxxx (default: 3)
    -n --                            normal desc
       --newline VALUE               line1 line2
+      --default-off                 enable X
+      --default-on                  enable Y (default: on)
       --callableopt VALUE           adds foo
       --customopt VALUE             adds bar
       --customopt-withdefault VALUE adds bar (default: foo)
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -168,7 +168,10 @@ 
             # the %s-shows-repr property to handle integers etc. To
             # match that behavior on Python 3, we do str(default) and
             # then convert it to bytes.
-            desc += _(" (default: %s)") % pycompat.bytestr(default)
+            defaultstr = pycompat.bytestr(default)
+            if default is True:
+                defaultstr = _("on")
+            desc += _(" (default: %s)") % defaultstr
 
         if isinstance(default, list):
             lo += " %s [+]" % optlabel