##// END OF EJS Templates
Add basic support for help topics and a dates topic
Matt Mackall -
r3795:17a11f4f default
parent child Browse files
Show More
@@ -0,0 +1,45 b''
1 # help.py - help data for mercurial
2 #
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
4 #
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
7
8 helptable = {
9 "dates|Date Formats":
10 r'''
11 Some commands (backout, commit, tag) allow the user to specify a date.
12 Possible formats for dates are:
13
14 YYYY-mm-dd \HH:MM[:SS] [(+|-)NNNN]::
15 This is a subset of ISO 8601, allowing just the recommended notations
16 for date and time. The last part represents the timezone; if omitted,
17 local time is assumed. Examples:
18
19 "2005-08-22 03:27 -0700"
20
21 "2006-04-19 21:39:51"
22
23 aaa bbb dd HH:MM:SS YYYY [(+|-)NNNN]::
24 This is the date format used by the C library. Here, aaa stands for
25 abbreviated weekday name and bbb for abbreviated month name. The last
26 part represents the timezone; if omitted, local time is assumed.
27 Examples:
28
29 "Mon Aug 22 03:27:00 2005 -0700"
30
31 "Wed Apr 19 21:39:51 2006"
32
33 unixtime offset::
34 This is the internal representation format for dates. unixtime is
35 the number of seconds since the epoch (1970-01-01 00:00 UTC). offset
36 is the offset of the local timezone, in seconds west of UTC (negative
37 if the timezone is east of UTC).
38 Examples:
39
40 "1124706420 25200" (2005-08-22 03:27:00 -0700)
41
42 "1145475591 -7200" (2006-04-19 21:39:51 +0200)
43 ''',
44 }
45
@@ -10,7 +10,7 b' from node import *'
10 from i18n import gettext as _
10 from i18n import gettext as _
11 demandload(globals(), "bisect os re sys signal imp urllib pdb shlex stat")
11 demandload(globals(), "bisect os re sys signal imp urllib pdb shlex stat")
12 demandload(globals(), "fancyopts ui hg util lock revlog bundlerepo")
12 demandload(globals(), "fancyopts ui hg util lock revlog bundlerepo")
13 demandload(globals(), "difflib patch time")
13 demandload(globals(), "difflib patch time help")
14 demandload(globals(), "traceback errno version atexit")
14 demandload(globals(), "traceback errno version atexit")
15 demandload(globals(), "archival changegroup cmdutil hgweb.server sshserver")
15 demandload(globals(), "archival changegroup cmdutil hgweb.server sshserver")
16
16
@@ -1141,6 +1141,24 b' def help_(ui, name=None, with_version=Fa'
1141 else:
1141 else:
1142 ui.write(' %-*s %s\n' % (m, f, h[f]))
1142 ui.write(' %-*s %s\n' % (m, f, h[f]))
1143
1143
1144 def helptopic(name):
1145 v = None
1146 for i in help.helptable:
1147 l = i.split('|')
1148 if name in l:
1149 v = i
1150 header = l[-1]
1151 if not v:
1152 raise UnknownCommand(name)
1153
1154 # description
1155 doc = help.helptable[v]
1156 if not doc:
1157 doc = _("(No help text available)")
1158
1159 ui.write("%s\n" % header)
1160 ui.write("%s\n" % doc.rstrip())
1161
1144 def helpext(name):
1162 def helpext(name):
1145 try:
1163 try:
1146 mod = findext(name)
1164 mod = findext(name)
@@ -1163,10 +1181,16 b' def help_(ui, name=None, with_version=Fa'
1163 helplist(modcmds.has_key)
1181 helplist(modcmds.has_key)
1164
1182
1165 if name and name != 'shortlist':
1183 if name and name != 'shortlist':
1166 try:
1184 i = None
1167 helpcmd(name)
1185 for f in (helpcmd, helptopic, helpext):
1168 except UnknownCommand:
1186 try:
1169 helpext(name)
1187 f(name)
1188 i = None
1189 break
1190 except UnknownCommand, inst:
1191 i = inst
1192 if i:
1193 raise i
1170
1194
1171 else:
1195 else:
1172 # program name
1196 # program name
General Comments 0
You need to be logged in to leave comments. Login now