doc/gendoc.py
changeset 19424 762e51ce3411
parent 19423 5046fede7684
child 19425 81fbd4e66ff5
equal deleted inserted replaced
19423:5046fede7684 19424:762e51ce3411
     5 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
     5 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
     6 from mercurial import demandimport; demandimport.enable()
     6 from mercurial import demandimport; demandimport.enable()
     7 from mercurial import minirst
     7 from mercurial import minirst
     8 from mercurial.commands import table, globalopts
     8 from mercurial.commands import table, globalopts
     9 from mercurial.i18n import gettext, _
     9 from mercurial.i18n import gettext, _
    10 from mercurial.help import helptable
    10 from mercurial.help import helptable, loaddoc
    11 from mercurial import extensions
    11 from mercurial import extensions
    12 from mercurial import util
    12 from mercurial import util
    13 
    13 
    14 def get_desc(docstr):
    14 def get_desc(docstr):
    15     if not docstr:
    15     if not docstr:
    94         cmdtable = getattr(mod, 'cmdtable', None)
    94         cmdtable = getattr(mod, 'cmdtable', None)
    95         if cmdtable:
    95         if cmdtable:
    96             ui.write(minirst.subsubsection(_('Commands')))
    96             ui.write(minirst.subsubsection(_('Commands')))
    97             commandprinter(ui, cmdtable, minirst.subsubsubsection)
    97             commandprinter(ui, cmdtable, minirst.subsubsubsection)
    98 
    98 
       
    99 def showtopic(ui, topic):
       
   100     extrahelptable = [
       
   101         (["common"], '', loaddoc('common')),
       
   102         (["hg.1"], '', loaddoc('hg.1')),
       
   103         (["hgignore.5"], '', loaddoc('hgignore.5')),
       
   104         (["hgrc.5"], '', loaddoc('hgrc.5')),
       
   105         (["hgignore.5.gendoc"], '', loaddoc('hgignore')),
       
   106         (["hgrc.5.gendoc"], '', loaddoc('config')),
       
   107     ]
       
   108     helpprinter(ui, helptable + extrahelptable, None, include=[topic])
       
   109 
    99 def helpprinter(ui, helptable, sectionfunc, include=[], exclude=[]):
   110 def helpprinter(ui, helptable, sectionfunc, include=[], exclude=[]):
   100     for names, sec, doc in helptable:
   111     for names, sec, doc in helptable:
   101         if exclude and names[0] in exclude:
   112         if exclude and names[0] in exclude:
   102             continue
   113             continue
   103         if include and names[0] not in include:
   114         if include and names[0] not in include: