comparison mercurial/help.py @ 9157:9261667e9b82

commands: use minirst parser when displaying help
author Martin Geisler <mg@lazybytes.net>
date Thu, 16 Jul 2009 23:25:26 +0200
parents 31e54756559b
children d6eecafaf12f
comparison
equal deleted inserted replaced
9156:c9c7e8cdac9c 9157:9261667e9b82
41 41
42 def listexts(header, exts, maxlength): 42 def listexts(header, exts, maxlength):
43 '''return a text listing of the given extensions''' 43 '''return a text listing of the given extensions'''
44 if not exts: 44 if not exts:
45 return '' 45 return ''
46 result = '\n%s\n\n' % header 46 # TODO: literal block is wrong, should be a field list or a simple table.
47 result = '\n%s\n\n ::\n\n' % header
47 for name, desc in sorted(exts.iteritems()): 48 for name, desc in sorted(exts.iteritems()):
48 desc = util.wrap(desc, maxlength + 4) 49 desc = util.wrap(desc, maxlength + 5)
49 result += ' %s %s\n' % (name.ljust(maxlength), desc) 50 result += ' %s %s\n' % (name.ljust(maxlength), desc)
50 return result 51 return result
51 52
52 def extshelp(): 53 def extshelp():
53 doc = _(r''' 54 doc = _(r'''
54 Mercurial has the ability to add new features through the use of 55 Mercurial has the ability to add new features through the use of
61 or modify history); they might not be ready for prime time; or they may 62 or modify history); they might not be ready for prime time; or they may
62 alter some usual behaviors of stock Mercurial. It is thus up to the user 63 alter some usual behaviors of stock Mercurial. It is thus up to the user
63 to activate extensions as needed. 64 to activate extensions as needed.
64 65
65 To enable the "foo" extension, either shipped with Mercurial or in the 66 To enable the "foo" extension, either shipped with Mercurial or in the
66 Python search path, create an entry for it in your hgrc, like this: 67 Python search path, create an entry for it in your hgrc, like this::
67 68
68 [extensions] 69 [extensions]
69 foo = 70 foo =
70 71
71 You may also specify the full path to an extension: 72 You may also specify the full path to an extension::
72 73
73 [extensions] 74 [extensions]
74 myfeature = ~/.hgext/myfeature.py 75 myfeature = ~/.hgext/myfeature.py
75 76
76 To explicitly disable an extension enabled in an hgrc of broader scope, 77 To explicitly disable an extension enabled in an hgrc of broader scope,
77 prepend its path with !: 78 prepend its path with !::
78 79
79 [extensions] 80 [extensions]
80 # disabling extension bar residing in /path/to/extension/bar.py 81 # disabling extension bar residing in /path/to/extension/bar.py
81 hgext.bar = !/path/to/extension/bar.py 82 hgext.bar = !/path/to/extension/bar.py
82 # ditto, but no path was supplied for extension baz 83 # ditto, but no path was supplied for extension baz
93 94
94 helptable = ( 95 helptable = (
95 (["dates"], _("Date Formats"), 96 (["dates"], _("Date Formats"),
96 _(r''' 97 _(r'''
97 Some commands allow the user to specify a date, e.g.: 98 Some commands allow the user to specify a date, e.g.:
98 * backout, commit, import, tag: Specify the commit date. 99
99 * log, revert, update: Select revision(s) by date. 100 - backout, commit, import, tag: Specify the commit date.
100 101 - log, revert, update: Select revision(s) by date.
101 Many date formats are valid. Here are some examples: 102
102 103 Many date formats are valid. Here are some examples::
103 "Wed Dec 6 13:18:29 2006" (local timezone assumed) 104
104 "Dec 6 13:18 -0600" (year assumed, time offset provided) 105 "Wed Dec 6 13:18:29 2006" (local timezone assumed)
105 "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) 106 "Dec 6 13:18 -0600" (year assumed, time offset provided)
106 "Dec 6" (midnight) 107 "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
107 "13:18" (today assumed) 108 "Dec 6" (midnight)
108 "3:39" (3:39AM assumed) 109 "13:18" (today assumed)
109 "3:39pm" (15:39) 110 "3:39" (3:39AM assumed)
110 "2006-12-06 13:18:29" (ISO 8601 format) 111 "3:39pm" (15:39)
111 "2006-12-6 13:18" 112 "2006-12-06 13:18:29" (ISO 8601 format)
112 "2006-12-6" 113 "2006-12-6 13:18"
113 "12-6" 114 "2006-12-6"
114 "12/6" 115 "12-6"
115 "12/6/6" (Dec 6 2006) 116 "12/6"
117 "12/6/6" (Dec 6 2006)
116 118
117 Lastly, there is Mercurial's internal format: 119 Lastly, there is Mercurial's internal format:
118 120
119 "1165432709 0" (Wed Dec 6 13:18:29 2006 UTC) 121 "1165432709 0" (Wed Dec 6 13:18:29 2006 UTC)
120 122
121 This is the internal representation format for dates. unixtime is the 123 This is the internal representation format for dates. unixtime is the
122 number of seconds since the epoch (1970-01-01 00:00 UTC). offset is the 124 number of seconds since the epoch (1970-01-01 00:00 UTC). offset is the
123 offset of the local timezone, in seconds west of UTC (negative if the 125 offset of the local timezone, in seconds west of UTC (negative if the
124 timezone is east of UTC). 126 timezone is east of UTC).
125 127
126 The log command also accepts date ranges: 128 The log command also accepts date ranges::
127 129
128 "<{datetime}" - at or before a given date/time 130 "<{datetime}" - at or before a given date/time
129 ">{datetime}" - on or after a given date/time 131 ">{datetime}" - on or after a given date/time
130 "{datetime} to {datetime}" - a date range, inclusive 132 "{datetime} to {datetime}" - a date range, inclusive
131 "-{days}" - within a given number of days of today 133 "-{days}" - within a given number of days of today
132 ''')), 134 ''')),
133 135
134 (["patterns"], _("File Name Patterns"), 136 (["patterns"], _("File Name Patterns"),
135 _(r''' 137 _(r'''
136 Mercurial accepts several notations for identifying one or more files at a 138 Mercurial accepts several notations for identifying one or more files at a
153 path separators and "{a,b}" to mean "a or b". 155 path separators and "{a,b}" to mean "a or b".
154 156
155 To use a Perl/Python regular expression, start a name with "re:". Regexp 157 To use a Perl/Python regular expression, start a name with "re:". Regexp
156 pattern matching is anchored at the root of the repository. 158 pattern matching is anchored at the root of the repository.
157 159
158 Plain examples: 160 Plain examples::
159 161
160 path:foo/bar a name bar in a directory named foo in the root of 162 path:foo/bar a name bar in a directory named foo in the root of
161 the repository 163 the repository
162 path:path:name a file or directory named "path:name" 164 path:path:name a file or directory named "path:name"
163 165
164 Glob examples: 166 Glob examples::
165 167
166 glob:*.c any name ending in ".c" in the current directory 168 glob:*.c any name ending in ".c" in the current directory
167 *.c any name ending in ".c" in the current directory 169 *.c any name ending in ".c" in the current directory
168 **.c any name ending in ".c" in any subdirectory of the current 170 **.c any name ending in ".c" in any subdirectory of the
169 directory including itself. 171 current directory including itself.
170 foo/*.c any name ending in ".c" in the directory foo 172 foo/*.c any name ending in ".c" in the directory foo
171 foo/**.c any name ending in ".c" in any subdirectory of foo 173 foo/**.c any name ending in ".c" in any subdirectory of foo
172 including itself. 174 including itself.
173 175
174 Regexp examples: 176 Regexp examples::
175 177
176 re:.*\.c$ any name ending in ".c", anywhere in the repository 178 re:.*\.c$ any name ending in ".c", anywhere in the repository
177 179
178 ''')), 180 ''')),
179 181
180 (['environment', 'env'], _('Environment Variables'), 182 (['environment', 'env'], _('Environment Variables'),
181 _(r''' 183 _(r'''
182 HG:: 184 HG
183 Path to the 'hg' executable, automatically passed when running hooks, 185 Path to the 'hg' executable, automatically passed when running hooks,
184 extensions or external tools. If unset or empty, this is the hg 186 extensions or external tools. If unset or empty, this is the hg
185 executable's name if it's frozen, or an executable named 'hg' (with 187 executable's name if it's frozen, or an executable named 'hg' (with
186 %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on Windows) is 188 %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on Windows) is
187 searched. 189 searched.
188 190
189 HGEDITOR:: 191 HGEDITOR
190 This is the name of the editor to run when committing. See EDITOR. 192 This is the name of the editor to run when committing. See EDITOR.
191 193
192 (deprecated, use .hgrc) 194 (deprecated, use .hgrc)
193 195
194 HGENCODING:: 196 HGENCODING
195 This overrides the default locale setting detected by Mercurial. This 197 This overrides the default locale setting detected by Mercurial. This
196 setting is used to convert data including usernames, changeset 198 setting is used to convert data including usernames, changeset
197 descriptions, tag names, and branches. This setting can be overridden with 199 descriptions, tag names, and branches. This setting can be overridden with
198 the --encoding command-line option. 200 the --encoding command-line option.
199 201
200 HGENCODINGMODE:: 202 HGENCODINGMODE
201 This sets Mercurial's behavior for handling unknown characters while 203 This sets Mercurial's behavior for handling unknown characters while
202 transcoding user input. The default is "strict", which causes Mercurial to 204 transcoding user input. The default is "strict", which causes Mercurial to
203 abort if it can't map a character. Other settings include "replace", which 205 abort if it can't map a character. Other settings include "replace", which
204 replaces unknown characters, and "ignore", which drops them. This setting 206 replaces unknown characters, and "ignore", which drops them. This setting
205 can be overridden with the --encodingmode command-line option. 207 can be overridden with the --encodingmode command-line option.
206 208
207 HGMERGE:: 209 HGMERGE
208 An executable to use for resolving merge conflicts. The program will be 210 An executable to use for resolving merge conflicts. The program will be
209 executed with three arguments: local file, remote file, ancestor file. 211 executed with three arguments: local file, remote file, ancestor file.
210 212
211 (deprecated, use .hgrc) 213 (deprecated, use .hgrc)
212 214
213 HGRCPATH:: 215 HGRCPATH
214 A list of files or directories to search for hgrc files. Item separator is 216 A list of files or directories to search for hgrc files. Item separator is
215 ":" on Unix, ";" on Windows. If HGRCPATH is not set, platform default 217 ":" on Unix, ";" on Windows. If HGRCPATH is not set, platform default
216 search path is used. If empty, only the .hg/hgrc from the current 218 search path is used. If empty, only the .hg/hgrc from the current
217 repository is read. 219 repository is read.
218 220
219 For each element in HGRCPATH: 221 For each element in HGRCPATH:
220 * if it's a directory, all files ending with .rc are added 222
221 * otherwise, the file itself will be added 223 - if it's a directory, all files ending with .rc are added
222 224 - otherwise, the file itself will be added
223 HGUSER:: 225
226 HGUSER
224 This is the string used as the author of a commit. If not set, available 227 This is the string used as the author of a commit. If not set, available
225 values will be considered in this order: 228 values will be considered in this order:
226 229
227 * HGUSER (deprecated) 230 - HGUSER (deprecated)
228 * hgrc files from the HGRCPATH 231 - hgrc files from the HGRCPATH
229 * EMAIL 232 - EMAIL
230 * interactive prompt 233 - interactive prompt
231 * LOGNAME (with '@hostname' appended) 234 - LOGNAME (with '@hostname' appended)
232 235
233 (deprecated, use .hgrc) 236 (deprecated, use .hgrc)
234 237
235 EMAIL:: 238 EMAIL
236 May be used as the author of a commit; see HGUSER. 239 May be used as the author of a commit; see HGUSER.
237 240
238 LOGNAME:: 241 LOGNAME
239 May be used as the author of a commit; see HGUSER. 242 May be used as the author of a commit; see HGUSER.
240 243
241 VISUAL:: 244 VISUAL
242 This is the name of the editor to use when committing. See EDITOR. 245 This is the name of the editor to use when committing. See EDITOR.
243 246
244 EDITOR:: 247 EDITOR
245 Sometimes Mercurial needs to open a text file in an editor for a user to 248 Sometimes Mercurial needs to open a text file in an editor for a user to
246 modify, for example when writing commit messages. The editor it uses is 249 modify, for example when writing commit messages. The editor it uses is
247 determined by looking at the environment variables HGEDITOR, VISUAL and 250 determined by looking at the environment variables HGEDITOR, VISUAL and
248 EDITOR, in that order. The first non-empty one is chosen. If all of them 251 EDITOR, in that order. The first non-empty one is chosen. If all of them
249 are empty, the editor defaults to 'vi'. 252 are empty, the editor defaults to 'vi'.
250 253
251 PYTHONPATH:: 254 PYTHONPATH
252 This is used by Python to find imported modules and may need to be set 255 This is used by Python to find imported modules and may need to be set
253 appropriately if this Mercurial is not installed system-wide. 256 appropriately if this Mercurial is not installed system-wide.
254 ''')), 257 ''')),
255 258
256 (['revs', 'revisions'], _('Specifying Single Revisions'), 259 (['revs', 'revisions'], _('Specifying Single Revisions'),
429 - user: Any text. Returns the user portion of an email address. 432 - user: Any text. Returns the user portion of an email address.
430 ''')), 433 ''')),
431 434
432 (['urls'], _('URL Paths'), 435 (['urls'], _('URL Paths'),
433 _(r''' 436 _(r'''
434 Valid URLs are of the form: 437 Valid URLs are of the form::
435 438
436 local/filesystem/path[#revision] 439 local/filesystem/path[#revision]
437 file://local/filesystem/path[#revision] 440 file://local/filesystem/path[#revision]
438 http://[user[:pass]@]host[:port]/[path][#revision] 441 http://[user[:pass]@]host[:port]/[path][#revision]
439 https://[user[:pass]@]host[:port]/[path][#revision] 442 https://[user[:pass]@]host[:port]/[path][#revision]
448 Some features, such as pushing to http:// and https:// URLs are only 451 Some features, such as pushing to http:// and https:// URLs are only
449 possible if the feature is explicitly enabled on the remote Mercurial 452 possible if the feature is explicitly enabled on the remote Mercurial
450 server. 453 server.
451 454
452 Some notes about using SSH with Mercurial: 455 Some notes about using SSH with Mercurial:
456
453 - SSH requires an accessible shell account on the destination machine and 457 - SSH requires an accessible shell account on the destination machine and
454 a copy of hg in the remote path or specified with as remotecmd. 458 a copy of hg in the remote path or specified with as remotecmd.
455 - path is relative to the remote user's home directory by default. Use an 459 - path is relative to the remote user's home directory by default. Use an
456 extra slash at the start of a path to specify an absolute path: 460 extra slash at the start of a path to specify an absolute path::
461
457 ssh://example.com//tmp/repository 462 ssh://example.com//tmp/repository
463
458 - Mercurial doesn't use its own compression via SSH; the right thing to do 464 - Mercurial doesn't use its own compression via SSH; the right thing to do
459 is to configure it in your ~/.ssh/config, e.g.: 465 is to configure it in your ~/.ssh/config, e.g.::
466
460 Host *.mylocalnetwork.example.com 467 Host *.mylocalnetwork.example.com
461 Compression no 468 Compression no
462 Host * 469 Host *
463 Compression yes 470 Compression yes
471
464 Alternatively specify "ssh -C" as your ssh command in your hgrc or with 472 Alternatively specify "ssh -C" as your ssh command in your hgrc or with
465 the --ssh command line option. 473 the --ssh command line option.
466 474
467 These URLs can all be stored in your hgrc with path aliases under the 475 These URLs can all be stored in your hgrc with path aliases under the
468 [paths] section like so: 476 [paths] section like so::
469 [paths] 477
470 alias1 = URL1 478 [paths]
471 alias2 = URL2 479 alias1 = URL1
472 ... 480 alias2 = URL2
481 ...
473 482
474 You can then use the alias for any command that uses a URL (for example 483 You can then use the alias for any command that uses a URL (for example
475 'hg pull alias1' would pull from the 'alias1' path). 484 'hg pull alias1' would pull from the 'alias1' path).
476 485
477 Two path aliases are special because they are used as defaults when you do 486 Two path aliases are special because they are used as defaults when you do