mercurial/help.py
branchstable
changeset 40421 e928bedf0919
parent 40295 fa88170c10bb
child 40460 4fe63b573791
equal deleted inserted replaced
40420:94c0421d67a0 40421:e928bedf0919
     7 
     7 
     8 from __future__ import absolute_import
     8 from __future__ import absolute_import
     9 
     9 
    10 import itertools
    10 import itertools
    11 import os
    11 import os
       
    12 import re
    12 import textwrap
    13 import textwrap
    13 
    14 
    14 from .i18n import (
    15 from .i18n import (
    15     _,
    16     _,
    16     gettext,
    17     gettext,
    28     registrar,
    29     registrar,
    29     revset,
    30     revset,
    30     templatefilters,
    31     templatefilters,
    31     templatefuncs,
    32     templatefuncs,
    32     templatekw,
    33     templatekw,
       
    34     ui as uimod,
    33     util,
    35     util,
    34 )
    36 )
    35 from .hgweb import (
    37 from .hgweb import (
    36     webcommands,
    38     webcommands,
    37 )
    39 )
   407 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
   409 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
   408 addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
   410 addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
   409 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
   411 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
   410                 dedent=True)
   412                 dedent=True)
   411 
   413 
       
   414 def inserttweakrc(ui, topic, doc):
       
   415     marker = '.. tweakdefaultsmarker'
       
   416     repl = uimod.tweakrc
       
   417     def sub(m):
       
   418         lines = [m.group(1) + s for s in repl.splitlines()]
       
   419         return '\n'.join(lines)
       
   420     return re.sub(br'( *)%s' % re.escape(marker), sub, doc)
       
   421 
       
   422 addtopichook('config', inserttweakrc)
       
   423 
   412 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
   424 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
   413           **opts):
   425           **opts):
   414     '''
   426     '''
   415     Generate the help for 'name' as unformatted restructured text. If
   427     Generate the help for 'name' as unformatted restructured text. If
   416     'name' is None, describe the commands available.
   428     'name' is None, describe the commands available.