[PATCH 6 of 9 STABLE? V2] gendoc: add show_doc_topic

Takumi IINO trot.thunder at gmail.com
Wed May 15 02:14:23 CDT 2013


# HG changeset patch
# User Takumi IINO <trot.thunder at gmail.com>
# Date 1368600353 -32400
#      Wed May 15 15:45:53 2013 +0900
# Branch stable
# Node ID 8973dcdfb5b0501af51d72933e08fd4e80fbf20f
# Parent  fe6f4a4f4d39947f19f1238177df6cc9bc71ad82
gendoc: add show_doc_topic

This function prints any topic.

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -8,7 +8,7 @@
 from mercurial import minirst
 from mercurial.commands import table, globalopts
 from mercurial.i18n import gettext, _
-from mercurial.help import helptable
+from mercurial.help import helptable, loaddoc
 from mercurial import extensions
 from mercurial import util
 
@@ -103,6 +103,15 @@
 def show_doc_hgrc(ui):
     helpprinter(ui, helptable, None, include=['config'])
 
+def show_doc_topic(ui, topic):
+    extra_helptable = [
+        (["common"], '', loaddoc('common')),
+        (["hg.1"], '', loaddoc('hg.1')),
+        (["hgignore.5"], '', loaddoc('hgignore.5')),
+        (["hgrc.5"], '', loaddoc('hgrc.5')),
+    ]
+    helpprinter(ui, helptable + extra_helptable, None, include=[topic])
+
 def helpprinter(ui, helptable, sectionfunc, include=[], exclude=[]):
     for names, sec, doc in helptable:
         if exclude and names[0] in exclude:


More information about the Mercurial-devel mailing list