gendoc: add showtopic
authorTakumi IINO <trot.thunder@gmail.com>
Wed, 03 Jul 2013 21:49:39 +0900
changeset 19424 762e51ce3411
parent 19423 5046fede7684
child 19425 81fbd4e66ff5
gendoc: add showtopic This function prints any topic.
doc/gendoc.py
--- a/doc/gendoc.py	Wed Jul 03 21:49:37 2013 +0900
+++ b/doc/gendoc.py	Wed Jul 03 21:49:39 2013 +0900
@@ -7,7 +7,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
 
@@ -96,6 +96,17 @@
             ui.write(minirst.subsubsection(_('Commands')))
             commandprinter(ui, cmdtable, minirst.subsubsubsection)
 
+def showtopic(ui, topic):
+    extrahelptable = [
+        (["common"], '', loaddoc('common')),
+        (["hg.1"], '', loaddoc('hg.1')),
+        (["hgignore.5"], '', loaddoc('hgignore.5')),
+        (["hgrc.5"], '', loaddoc('hgrc.5')),
+        (["hgignore.5.gendoc"], '', loaddoc('hgignore')),
+        (["hgrc.5.gendoc"], '', loaddoc('config')),
+    ]
+    helpprinter(ui, helptable + extrahelptable, None, include=[topic])
+
 def helpprinter(ui, helptable, sectionfunc, include=[], exclude=[]):
     for names, sec, doc in helptable:
         if exclude and names[0] in exclude: