D5187: help: describe what ui.tweakdefaults changes, concretely

valentin.gatienbaron (Valentin Gatien-Baron) phabricator at mercurial-scm.org
Wed Oct 24 11:01:20 EDT 2018


valentin.gatienbaron updated this revision to Diff 12340.
valentin.gatienbaron edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5187?vs=12331&id=12340

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

AFFECTED FILES
  mercurial/help.py
  mercurial/help/config.txt

CHANGE DETAILS

diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -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
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -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):
     '''



To: valentin.gatienbaron, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list