mercurial/help.py
changeset 40460 4fe63b573791
parent 40415 dce0e0f78f0f
parent 40421 e928bedf0919
child 40595 419d703115b0
--- a/mercurial/help.py	Sat Oct 13 01:55:40 2018 -0700
+++ b/mercurial/help.py	Fri Nov 02 14:24:29 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 (
@@ -431,6 +433,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):
     '''