Patchwork [6,of,9,STABLE?] gendoc: add show_doc_topic

login
register
mail settings
Submitter Takumi IINO
Date May 14, 2013, 7:29 a.m.
Message ID <0abe54a3f5aef2a88ac2.1368516555@iino-no-MacBook-Air.local>
Download mbox | patch
Permalink /patch/1628/
State Rejected, archived
Headers show

Comments

Takumi IINO - May 14, 2013, 7:29 a.m.
# HG changeset patch
# User Takumi IINO <trot.thunder@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.

Patch

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: