# HG changeset patch # User Philippe Pepiot # Date 1504247537 -7200 # Node ID 3f466d348047349490a9f2339d8b934015e2dfba # Parent f98f3f62f8c471b5cb980502ea2f52e68061c9a3 doc: add documentation for evolve commands By using a sphinx directive that call `hg help`. diff -r f98f3f62f8c4 -r 3f466d348047 docs/commands.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/commands.rst Fri Sep 01 08:32:17 2017 +0200 @@ -0,0 +1,70 @@ +------------------------- +Evolve Commands Reference +------------------------- + +.. highlight:: none + +amend +----- + +.. hghelp:: amend + +evolve +------ + +.. hghelp:: evolve + +fold +---- + +.. hghelp:: fold + +metaedit +-------- + +.. hghelp:: metaedit + +next +---- + +.. hghelp:: next + +obslog +------ + +.. hghelp:: obslog + +pdiff +----- + +.. hghelp:: pdiff + +previous +-------- + +.. hghelp:: previous + +prune +----- + +.. hghelp:: prune + +pstatus +------- + +.. hghelp:: pstatus + +split +----- + +.. hghelp:: split + +touch +----- + +.. hghelp:: touch + +uncommit +-------- + +.. hghelp:: uncommit diff -r f98f3f62f8c4 -r 3f466d348047 docs/conf.py --- a/docs/conf.py Thu Sep 21 16:11:59 2017 +0200 +++ b/docs/conf.py Fri Sep 01 08:32:17 2017 +0200 @@ -1,6 +1,16 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +from mercurial import demandimport +demandimport.disable() +from docutils import nodes +from docutils.parsers.rst import Directive +from mercurial import ui +from mercurial import extensions as hgext +from mercurial import commands +import os, sys + extensions = ["sphinx.ext.graphviz"] + # autoclass_content = 'both' # Add any paths that contain templates here, relative to this directory. # templates_path = [] @@ -124,3 +134,24 @@ # htmlhelp_basename = '' graphviz_output_format = "svg" + +class hghelpdirective(Directive): + has_content = True + + def run(self): + u = ui.ui() + u.disablepager() + u.setconfig( + 'extensions', 'evolve', + os.path.join( + os.path.abspath(os.path.dirname(__file__)), + os.pardir, 'hgext3rd', 'evolve')) + hgext.loadall(u) + u.pushbuffer() + commands.help_(u, self.content[0]) + return [ + nodes.literal_block(text=u.popbuffer())] + + +def setup(app): + app.add_directive('hghelp', hghelpdirective) diff -r f98f3f62f8c4 -r 3f466d348047 docs/index.rst --- a/docs/index.rst Thu Sep 21 16:11:59 2017 +0200 +++ b/docs/index.rst Fri Sep 01 08:32:17 2017 +0200 @@ -54,6 +54,7 @@ sharing concepts from-mq + commands known-doc-issues .. _`changeset evolution`: