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