Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/help.py @ 10282:08a0f04b56bd
many, many trivial check-code fixups
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 25 Jan 2010 00:05:27 -0600 |
parents | 25e572394f5c |
children | de1e7099d100 |
comparison
equal
deleted
inserted
replaced
10281:e7d3b509af8b | 10282:08a0f04b56bd |
---|---|
11 | 11 |
12 | 12 |
13 def moduledoc(file): | 13 def moduledoc(file): |
14 '''return the top-level python documentation for the given file | 14 '''return the top-level python documentation for the given file |
15 | 15 |
16 Loosely inspired by pydoc.source_synopsis(), but rewritten to handle \''' | 16 Loosely inspired by pydoc.source_synopsis(), but rewritten to |
17 as well as """ and to return the whole text instead of just the synopsis''' | 17 handle triple quotes and to return the whole text instead of just |
18 the synopsis''' | |
18 result = [] | 19 result = [] |
19 | 20 |
20 line = file.readline() | 21 line = file.readline() |
21 while line[:1] == '#' or not line.strip(): | 22 while line[:1] == '#' or not line.strip(): |
22 line = file.readline() | 23 line = file.readline() |
23 if not line: break | 24 if not line: |
25 break | |
24 | 26 |
25 start = line[:3] | 27 start = line[:3] |
26 if start == '"""' or start == "'''": | 28 if start == '\"\"\"' or start == "\'\'\'": |
27 line = line[3:] | 29 line = line[3:] |
28 while line: | 30 while line: |
29 if line.rstrip().endswith(start): | 31 if line.rstrip().endswith(start): |
30 line = line.split(start)[0] | 32 line = line.split(start)[0] |
31 if line: | 33 if line: |
81 | 83 |
82 helptable = ( | 84 helptable = ( |
83 (["config"], _("Configuration Files"), loaddoc('config')), | 85 (["config"], _("Configuration Files"), loaddoc('config')), |
84 (["dates"], _("Date Formats"), loaddoc('dates')), | 86 (["dates"], _("Date Formats"), loaddoc('dates')), |
85 (["patterns"], _("File Name Patterns"), loaddoc('patterns')), | 87 (["patterns"], _("File Name Patterns"), loaddoc('patterns')), |
86 (['environment', 'env'], _('Environment Variables'), loaddoc('environment')), | 88 (['environment', 'env'], _('Environment Variables'), |
87 (['revs', 'revisions'], _('Specifying Single Revisions'), loaddoc('revisions')), | 89 loaddoc('environment')), |
88 (['mrevs', 'multirevs'], _('Specifying Multiple Revisions'), loaddoc('multirevs')), | 90 (['revs', 'revisions'], _('Specifying Single Revisions'), |
91 loaddoc('revisions')), | |
92 (['mrevs', 'multirevs'], _('Specifying Multiple Revisions'), | |
93 loaddoc('multirevs')), | |
89 (['diffs'], _('Diff Formats'), loaddoc('diffs')), | 94 (['diffs'], _('Diff Formats'), loaddoc('diffs')), |
90 (['templating', 'templates'], _('Template Usage'), loaddoc('templates')), | 95 (['templating', 'templates'], _('Template Usage'), |
96 loaddoc('templates')), | |
91 (['urls'], _('URL Paths'), loaddoc('urls')), | 97 (['urls'], _('URL Paths'), loaddoc('urls')), |
92 (["extensions"], _("Using additional features"), extshelp), | 98 (["extensions"], _("Using additional features"), extshelp), |
93 ) | 99 ) |