Patchwork [2,of,5,V3] gendoc: add showtopic

login
register
mail settings
Submitter Takumi IINO
Date July 3, 2013, 1:20 p.m.
Message ID <7cca229fc44fb384b847.1372857651@iino-no-MacBook-Air.local>
Download mbox | patch
Permalink /patch/1786/
State Accepted
Commit 762e51ce3411bb0c770100e042566be86b5dbc6d
Headers show

Comments

Takumi IINO - July 3, 2013, 1:20 p.m.
# HG changeset patch
# User Takumi IINO <trot.thunder@gmail.com>
# Date 1372855779 -32400
#      Wed Jul 03 21:49:39 2013 +0900
# Node ID 7cca229fc44fb384b847344b35e7125a1f21476a
# Parent  1c93b4ca748ccf3db1a2a6a5ee72d6a4221a871e
gendoc: add showtopic

This function prints any topic.

Patch

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -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):
+    extra_helptable = [
+        (["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 + 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: