Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 6654:2713e42dcf4e
help: helptable is an ordered collection
The helptable is used for helptopics listed in the manual
page, so the order of topics should not be random.
Convert it from a dictionary into a tuple of tuples.
Also reorder helptable entries to keep previous manual
page order.
author | Johannes Stezenbach <js@sig21.net> |
---|---|
date | Tue, 03 Jun 2008 21:03:51 +0200 |
parents | a78d8edaeedd |
children | 7ca74741259f |
comparison
equal
deleted
inserted
replaced
6653:a78d8edaeedd | 6654:2713e42dcf4e |
---|---|
1319 if not ui.quiet: | 1319 if not ui.quiet: |
1320 addglobalopts(True) | 1320 addglobalopts(True) |
1321 | 1321 |
1322 def helptopic(name): | 1322 def helptopic(name): |
1323 v = None | 1323 v = None |
1324 for i in help.helptable: | 1324 for i, d in help.helptable: |
1325 l = i.split('|') | 1325 l = i.split('|') |
1326 if name in l: | 1326 if name in l: |
1327 v = i | 1327 v = i |
1328 header = l[-1] | 1328 header = l[-1] |
1329 doc = d | |
1329 if not v: | 1330 if not v: |
1330 raise cmdutil.UnknownCommand(name) | 1331 raise cmdutil.UnknownCommand(name) |
1331 | 1332 |
1332 # description | 1333 # description |
1333 doc = help.helptable[v] | |
1334 if not doc: | 1334 if not doc: |
1335 doc = _("(No help text available)") | 1335 doc = _("(No help text available)") |
1336 if callable(doc): | 1336 if callable(doc): |
1337 doc = doc() | 1337 doc = doc() |
1338 | 1338 |
1402 or ""))) | 1402 or ""))) |
1403 | 1403 |
1404 if ui.verbose: | 1404 if ui.verbose: |
1405 ui.write(_("\nspecial help topics:\n")) | 1405 ui.write(_("\nspecial help topics:\n")) |
1406 topics = [] | 1406 topics = [] |
1407 for i in help.helptable: | 1407 for i, d in help.helptable: |
1408 l = i.split('|') | 1408 l = i.split('|') |
1409 topics.append((", ".join(l[:-1]), l[-1])) | 1409 topics.append((", ".join(l[:-1]), l[-1])) |
1410 topics_len = max([len(s[0]) for s in topics]) | 1410 topics_len = max([len(s[0]) for s in topics]) |
1411 for t, desc in topics: | 1411 for t, desc in topics: |
1412 ui.write(" %-*s %s\n" % (topics_len, t, desc)) | 1412 ui.write(" %-*s %s\n" % (topics_len, t, desc)) |