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

Takumi IINO trot.thunder at gmail.com
Tue May 14 02:29:15 CDT 2013


# HG changeset patch
# User Takumi IINO <trot.thunder at gmail.com>
# Date 1368513072 -32400
#      Tue May 14 15:31:12 2013 +0900
# Branch stable
# Node ID 0abe54a3f5aef2a88ac291d01ad6a4d1735d68d1
# Parent  9f112d483cee35bae8e26446fd3586ed943f9af9
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 _
-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