comparison mercurial/help.py @ 24080:a3f2ea1d4943

help: add web commands to help documentation The capabilities and URL endpoints of the hgweb server can currently only be inferred by looking at links in `hg serve` output or by reading the source code. I've frequently found myself wanting to quickly see what URLs and capabilities are available. This patch teaches the help system how to display information about web commands and their URLs. Using a mechanism similar to revsets, templates, etc, we can now iterate over the docstrings of registered web command functions and display them in the help output. Unfortunately, web commands don't currently have docstrings, so the output is currently empty. This will be addressed in the following patches. I apologize for the patch bomb.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 06 Feb 2015 20:27:56 -0800
parents 861ddedfb402
children 067540702f64
comparison
equal deleted inserted replaced
24079:afe03a616525 24080:a3f2ea1d4943
9 import itertools, os 9 import itertools, os
10 import error 10 import error
11 import extensions, revset, fileset, templatekw, templatefilters, filemerge 11 import extensions, revset, fileset, templatekw, templatefilters, filemerge
12 import encoding, util, minirst 12 import encoding, util, minirst
13 import cmdutil 13 import cmdutil
14 import hgweb.webcommands as webcommands
14 15
15 def listexts(header, exts, indent=1, showdeprecated=False): 16 def listexts(header, exts, indent=1, showdeprecated=False):
16 '''return a text listing of the given extensions''' 17 '''return a text listing of the given extensions'''
17 rst = [] 18 rst = []
18 if exts: 19 if exts:
200 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols) 201 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
201 addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals) 202 addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals)
202 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols) 203 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
203 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords) 204 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
204 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters) 205 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
206 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands)
205 207
206 def help_(ui, name, unknowncmd=False, full=True, **opts): 208 def help_(ui, name, unknowncmd=False, full=True, **opts):
207 ''' 209 '''
208 Generate the help for 'name' as unformatted restructured text. If 210 Generate the help for 'name' as unformatted restructured text. If
209 'name' is None, describe the commands available. 211 'name' is None, describe the commands available.