Show More
@@ -79,7 +79,7 b' def checkhghelps(ui):' | |||
|
79 | 79 | errorcnt = 0 |
|
80 | 80 | for names, sec, doc in helptable: |
|
81 | 81 | if callable(doc): |
|
82 | doc = doc() | |
|
82 | doc = doc(ui) | |
|
83 | 83 | errorcnt += checkseclevel(ui, doc, |
|
84 | 84 | '%s help topic' % names[0], |
|
85 | 85 | initlevel_topic) |
@@ -138,7 +138,7 b' def helpprinter(ui, helptable, sectionfu' | |||
|
138 | 138 | if sectionfunc: |
|
139 | 139 | ui.write(sectionfunc(sec)) |
|
140 | 140 | if callable(doc): |
|
141 | doc = doc() | |
|
141 | doc = doc(ui) | |
|
142 | 142 | ui.write(doc) |
|
143 | 143 | ui.write("\n") |
|
144 | 144 |
@@ -34,8 +34,8 b' def listexts(header, exts, indent=1, sho' | |||
|
34 | 34 | rst.append('%s:%s: %s\n' % (' ' * indent, name, desc)) |
|
35 | 35 | return rst |
|
36 | 36 | |
|
37 | def extshelp(): | |
|
38 | rst = loaddoc('extensions')().splitlines(True) | |
|
37 | def extshelp(ui): | |
|
38 | rst = loaddoc('extensions')(ui).splitlines(True) | |
|
39 | 39 | rst.extend(listexts( |
|
40 | 40 | _('enabled extensions:'), extensions.enabled(), showdeprecated=True)) |
|
41 | 41 | rst.extend(listexts(_('disabled extensions:'), extensions.disabled())) |
@@ -83,7 +83,7 b' def indicateomitted(rst, omitted, notomi' | |||
|
83 | 83 | if notomitted: |
|
84 | 84 | rst.append('\n\n.. container:: notomitted\n\n %s\n\n' % notomitted) |
|
85 | 85 | |
|
86 | def topicmatch(kw): | |
|
86 | def topicmatch(ui, kw): | |
|
87 | 87 | """Return help topics matching kw. |
|
88 | 88 | |
|
89 | 89 | Returns {'section': [(name, summary), ...], ...} where section is |
@@ -101,7 +101,7 b' def topicmatch(kw):' | |||
|
101 | 101 | # Old extensions may use a str as doc. |
|
102 | 102 | if (sum(map(lowercontains, names)) |
|
103 | 103 | or lowercontains(header) |
|
104 | or (callable(doc) and lowercontains(doc()))): | |
|
104 | or (callable(doc) and lowercontains(doc(ui)))): | |
|
105 | 105 | results['topics'].append((names[0], header)) |
|
106 | 106 | import commands # avoid cycle |
|
107 | 107 | for cmd, entry in commands.table.iteritems(): |
@@ -139,7 +139,7 b' def topicmatch(kw):' | |||
|
139 | 139 | def loaddoc(topic): |
|
140 | 140 | """Return a delayed loader for help/topic.txt.""" |
|
141 | 141 | |
|
142 | def loader(): | |
|
142 | def loader(ui): | |
|
143 | 143 | docdir = os.path.join(util.datapath, 'help') |
|
144 | 144 | path = os.path.join(docdir, topic + ".txt") |
|
145 | 145 | doc = gettext(util.readfile(path)) |
@@ -415,7 +415,7 b' def help_(ui, name, unknowncmd=False, fu' | |||
|
415 | 415 | if not doc: |
|
416 | 416 | rst.append(" %s\n" % _("(no help text available)")) |
|
417 | 417 | if callable(doc): |
|
418 | rst += [" %s\n" % l for l in doc().splitlines()] | |
|
418 | rst += [" %s\n" % l for l in doc(ui).splitlines()] | |
|
419 | 419 | |
|
420 | 420 | if not ui.verbose: |
|
421 | 421 | omitted = _('(some details hidden, use --verbose' |
@@ -482,7 +482,7 b' def help_(ui, name, unknowncmd=False, fu' | |||
|
482 | 482 | rst = [] |
|
483 | 483 | kw = opts.get('keyword') |
|
484 | 484 | if kw: |
|
485 | matches = topicmatch(name) | |
|
485 | matches = topicmatch(ui, name) | |
|
486 | 486 | helpareas = [] |
|
487 | 487 | if opts.get('extension'): |
|
488 | 488 | helpareas += [('extensions', _('Extensions'))] |
@@ -1105,7 +1105,7 b' Test omit indicating for help' | |||
|
1105 | 1105 | > def extsetup(ui): |
|
1106 | 1106 | > help.helptable.append((["topic-containing-verbose"], |
|
1107 | 1107 | > "This is the topic to test omit indicating.", |
|
1108 | > lambda : testtopic)) | |
|
1108 | > lambda ui: testtopic)) | |
|
1109 | 1109 | > EOF |
|
1110 | 1110 | $ echo '[extensions]' >> $HGRCPATH |
|
1111 | 1111 | $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH |
General Comments 0
You need to be logged in to leave comments.
Login now