changeset 40421:e928bedf0919 stable

help: describe what ui.tweakdefaults changes, concretely Currently, one has to look at the code. A couple things are suboptimal: - probably not translatable - lines don't get wrapped (a couple are a bit too long) but it seems to better this way than without help at all. Differential Revision: https://phab.mercurial-scm.org/D5187
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Wed, 24 Oct 2018 10:05:13 -0400
parents 94c0421d67a0
children 7e4ffe2719e4
files mercurial/help.py mercurial/help/config.txt
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/help.py	Thu Oct 25 00:22:42 2018 -0400
+++ b/mercurial/help.py	Wed Oct 24 10:05:13 2018 -0400
@@ -9,6 +9,7 @@
 
 import itertools
 import os
+import re
 import textwrap
 
 from .i18n import (
@@ -30,6 +31,7 @@
     templatefilters,
     templatefuncs,
     templatekw,
+    ui as uimod,
     util,
 )
 from .hgweb import (
@@ -409,6 +411,16 @@
 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
                 dedent=True)
 
+def inserttweakrc(ui, topic, doc):
+    marker = '.. tweakdefaultsmarker'
+    repl = uimod.tweakrc
+    def sub(m):
+        lines = [m.group(1) + s for s in repl.splitlines()]
+        return '\n'.join(lines)
+    return re.sub(br'( *)%s' % re.escape(marker), sub, doc)
+
+addtopichook('config', inserttweakrc)
+
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
           **opts):
     '''
--- a/mercurial/help/config.txt	Thu Oct 25 00:22:42 2018 -0400
+++ b/mercurial/help/config.txt	Wed Oct 24 10:05:13 2018 -0400
@@ -2370,6 +2370,10 @@
     effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
     not include ``tweakdefaults``. (default: False)
 
+    It currently means::
+
+      .. tweakdefaultsmarker
+
 ``username``
     The committer of a changeset created when running "commit".
     Typically a person's name and email address, e.g. ``Fred Widget