diff mercurial/help.py @ 37091:979c8ce9022d

fancyopts: fix rendering of customopt defaults in help text Differential Revision: https://phab.mercurial-scm.org/D2935
author Daniel Ploch <dploch@google.com>
date Thu, 22 Mar 2018 17:08:25 -0700
parents 521f6c7e1756
children ef6215df2402
line wrap: on
line diff
--- a/mercurial/help.py	Mon Mar 12 18:38:26 2018 +0530
+++ b/mercurial/help.py	Thu Mar 22 17:08:25 2018 -0700
@@ -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