changeset 2962:3f466d348047

doc: add documentation for evolve commands By using a sphinx directive that call `hg help`.
author Philippe Pepiot <phil@philpep.org>
date Fri, 01 Sep 2017 08:32:17 +0200
parents f98f3f62f8c4
children b84dda686fb1
files docs/commands.rst docs/conf.py docs/index.rst
diffstat 3 files changed, 102 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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
--- 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)
--- 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`: