D2935: fancyopts: fix rendering of customopt defaults in help text

dploch (Daniel Ploch) phabricator at mercurial-scm.org
Fri Mar 23 14:23:58 EDT 2018


dploch updated this revision to Diff 7257.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2935?vs=7255&id=7257

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

AFFECTED FILES
  mercurial/help.py

CHANGE DETAILS

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -20,6 +20,7 @@
     encoding,
     error,
     extensions,
+    fancyopts,
     filemerge,
     fileset,
     minirst,
@@ -84,7 +85,10 @@
         if shortopt:
             so = '-' + shortopt
         lo = '--' + longopt
-        if default:
+
+        if isinstance(default, fancyopts.customopt):
+            default = default.defaultvalue
+        if default and not callable(default):
             # default is of unknown type, and in Python 2 we abused
             # the %s-shows-repr property to handle integers etc. To
             # match that behavior on Python 3, we do str(default) and



To: dploch, #hg-reviewers, yuja
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list