[PATCH 05 of 22 hgweb-help] help: add webcommands to help documentation

Gregory Szorc gregory.szorc at gmail.com
Sat Feb 7 01:15:43 CST 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1423283276 28800
#      Fri Feb 06 20:27:56 2015 -0800
# Node ID dc6527c38b15a67d00fd959b597149c107396b30
# Parent  f47fcc745ca8295cd06a3705089452073c3a2877
help: add webcommands 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.

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -10,8 +10,9 @@ import itertools, os
 import error
 import extensions, revset, fileset, templatekw, templatefilters, filemerge
 import encoding, util, minirst
 import cmdutil
+import hgweb.webcommands as webcommands
 
 def listexts(header, exts, indent=1, showdeprecated=False):
     '''return a text listing of the given extensions'''
     rst = []
@@ -201,8 +202,9 @@ addtopicsymbols('filesets', '.. predicat
 addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals)
 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
 addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
+addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands)
 
 def help_(ui, name, unknowncmd=False, full=True, **opts):
     '''
     Generate the help for 'name' as unformatted restructured text. If
diff --git a/mercurial/help/hgweb.txt b/mercurial/help/hgweb.txt
--- a/mercurial/help/hgweb.txt
+++ b/mercurial/help/hgweb.txt
@@ -47,18 +47,8 @@ In this example::
   and ``http://server/user/bob/quux/testsubrepo/``
 
 The ``collections`` section is deprecated and has been superseded by
 ``paths``.
-<<<<<<< local
-||||||| base
-
-Web Commands / URLs
-===================
-
-The following web commands / URL handlers are registered:
-
-  .. webcommandsmarker
-=======
 
 URLs and Common Arguments
 =========================
 
@@ -86,4 +76,11 @@ Many commands take a ``{revision}`` URL 
 changeset to operate on. This is commonly specified as the short,
 12 digit hexidecimal abbreviation for the full 40 character unique
 revision identifier. However, any value described by
 :hg:`help revisions` typically works.
+
+Commands and URLs
+=================
+
+The following web commands and their URLs are available:
+
+  .. webcommandsmarker


More information about the Mercurial-devel mailing list