comparison doc/gendoc.py @ 26412:7e8e3c0920a6

gendoc: use real ui in place of stdout ui attributes will be required by a help function, so a file object can't be used as a fake ui.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 27 Sep 2015 23:34:37 +0900
parents e0b29a0c36c4
children e0c572d4d112
comparison
equal deleted inserted replaced
26411:dd62eaa82cbe 26412:7e8e3c0920a6
12 from mercurial import minirst 12 from mercurial import minirst
13 from mercurial.commands import table, globalopts 13 from mercurial.commands import table, globalopts
14 from mercurial.i18n import gettext, _ 14 from mercurial.i18n import gettext, _
15 from mercurial.help import helptable, loaddoc 15 from mercurial.help import helptable, loaddoc
16 from mercurial import extensions 16 from mercurial import extensions
17 from mercurial import ui as uimod
17 18
18 def get_desc(docstr): 19 def get_desc(docstr):
19 if not docstr: 20 if not docstr:
20 return "", "" 21 return "", ""
21 # sanitize 22 # sanitize
196 if __name__ == "__main__": 197 if __name__ == "__main__":
197 doc = 'hg.1.gendoc' 198 doc = 'hg.1.gendoc'
198 if len(sys.argv) > 1: 199 if len(sys.argv) > 1:
199 doc = sys.argv[1] 200 doc = sys.argv[1]
200 201
202 ui = uimod.ui()
201 if doc == 'hg.1.gendoc': 203 if doc == 'hg.1.gendoc':
202 showdoc(sys.stdout) 204 showdoc(ui)
203 else: 205 else:
204 showtopic(sys.stdout, sys.argv[1]) 206 showtopic(ui, sys.argv[1])