##// END OF EJS Templates
help: mark literal blocks
Martin Geisler -
r9290:26fb5b0a default
parent child Browse files
Show More
@@ -1,522 +1,522 b''
1 # help.py - help data for mercurial
1 # help.py - help data for mercurial
2 #
2 #
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2, incorporated herein by reference.
6 # GNU General Public License version 2, incorporated herein by reference.
7
7
8 from i18n import _
8 from i18n import _
9 import extensions, util
9 import extensions, util
10
10
11
11
12 def moduledoc(file):
12 def moduledoc(file):
13 '''return the top-level python documentation for the given file
13 '''return the top-level python documentation for the given file
14
14
15 Loosely inspired by pydoc.source_synopsis(), but rewritten to handle \'''
15 Loosely inspired by pydoc.source_synopsis(), but rewritten to handle \'''
16 as well as """ and to return the whole text instead of just the synopsis'''
16 as well as """ and to return the whole text instead of just the synopsis'''
17 result = []
17 result = []
18
18
19 line = file.readline()
19 line = file.readline()
20 while line[:1] == '#' or not line.strip():
20 while line[:1] == '#' or not line.strip():
21 line = file.readline()
21 line = file.readline()
22 if not line: break
22 if not line: break
23
23
24 start = line[:3]
24 start = line[:3]
25 if start == '"""' or start == "'''":
25 if start == '"""' or start == "'''":
26 line = line[3:]
26 line = line[3:]
27 while line:
27 while line:
28 if line.rstrip().endswith(start):
28 if line.rstrip().endswith(start):
29 line = line.split(start)[0]
29 line = line.split(start)[0]
30 if line:
30 if line:
31 result.append(line)
31 result.append(line)
32 break
32 break
33 elif not line:
33 elif not line:
34 return None # unmatched delimiter
34 return None # unmatched delimiter
35 result.append(line)
35 result.append(line)
36 line = file.readline()
36 line = file.readline()
37 else:
37 else:
38 return None
38 return None
39
39
40 return ''.join(result)
40 return ''.join(result)
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 # TODO: literal block is wrong, should be a field list or a simple table.
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 result = '\n%s\n\n ::\n\n' % header
48 for name, desc in sorted(exts.iteritems()):
48 for name, desc in sorted(exts.iteritems()):
49 desc = util.wrap(desc, maxlength + 5)
49 desc = util.wrap(desc, maxlength + 5)
50 result += ' %s %s\n' % (name.ljust(maxlength), desc)
50 result += ' %s %s\n' % (name.ljust(maxlength), desc)
51 return result
51 return result
52
52
53 def extshelp():
53 def extshelp():
54 doc = _(r'''
54 doc = _(r'''
55 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
56 extensions. Extensions may add new commands, add options to
56 extensions. Extensions may add new commands, add options to
57 existing commands, change the default behavior of commands, or
57 existing commands, change the default behavior of commands, or
58 implement hooks.
58 implement hooks.
59
59
60 Extensions are not loaded by default for a variety of reasons:
60 Extensions are not loaded by default for a variety of reasons:
61 they can increase startup overhead; they may be meant for advanced
61 they can increase startup overhead; they may be meant for advanced
62 usage only; they may provide potentially dangerous abilities (such
62 usage only; they may provide potentially dangerous abilities (such
63 as letting you destroy or modify history); they might not be ready
63 as letting you destroy or modify history); they might not be ready
64 for prime time; or they may alter some usual behaviors of stock
64 for prime time; or they may alter some usual behaviors of stock
65 Mercurial. It is thus up to the user to activate extensions as
65 Mercurial. It is thus up to the user to activate extensions as
66 needed.
66 needed.
67
67
68 To enable the "foo" extension, either shipped with Mercurial or in
68 To enable the "foo" extension, either shipped with Mercurial or in
69 the Python search path, create an entry for it in your hgrc, like
69 the Python search path, create an entry for it in your hgrc, like
70 this::
70 this::
71
71
72 [extensions]
72 [extensions]
73 foo =
73 foo =
74
74
75 You may also specify the full path to an extension::
75 You may also specify the full path to an extension::
76
76
77 [extensions]
77 [extensions]
78 myfeature = ~/.hgext/myfeature.py
78 myfeature = ~/.hgext/myfeature.py
79
79
80 To explicitly disable an extension enabled in an hgrc of broader
80 To explicitly disable an extension enabled in an hgrc of broader
81 scope, prepend its path with !::
81 scope, prepend its path with !::
82
82
83 [extensions]
83 [extensions]
84 # disabling extension bar residing in /path/to/extension/bar.py
84 # disabling extension bar residing in /path/to/extension/bar.py
85 hgext.bar = !/path/to/extension/bar.py
85 hgext.bar = !/path/to/extension/bar.py
86 # ditto, but no path was supplied for extension baz
86 # ditto, but no path was supplied for extension baz
87 hgext.baz = !
87 hgext.baz = !
88 ''')
88 ''')
89
89
90 exts, maxlength = extensions.enabled()
90 exts, maxlength = extensions.enabled()
91 doc += listexts(_('enabled extensions:'), exts, maxlength)
91 doc += listexts(_('enabled extensions:'), exts, maxlength)
92
92
93 exts, maxlength = extensions.disabled()
93 exts, maxlength = extensions.disabled()
94 doc += listexts(_('disabled extensions:'), exts, maxlength)
94 doc += listexts(_('disabled extensions:'), exts, maxlength)
95
95
96 return doc
96 return doc
97
97
98 helptable = (
98 helptable = (
99 (["dates"], _("Date Formats"),
99 (["dates"], _("Date Formats"),
100 _(r'''
100 _(r'''
101 Some commands allow the user to specify a date, e.g.:
101 Some commands allow the user to specify a date, e.g.:
102
102
103 - backout, commit, import, tag: Specify the commit date.
103 - backout, commit, import, tag: Specify the commit date.
104 - log, revert, update: Select revision(s) by date.
104 - log, revert, update: Select revision(s) by date.
105
105
106 Many date formats are valid. Here are some examples::
106 Many date formats are valid. Here are some examples::
107
107
108 "Wed Dec 6 13:18:29 2006" (local timezone assumed)
108 "Wed Dec 6 13:18:29 2006" (local timezone assumed)
109 "Dec 6 13:18 -0600" (year assumed, time offset provided)
109 "Dec 6 13:18 -0600" (year assumed, time offset provided)
110 "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
110 "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000)
111 "Dec 6" (midnight)
111 "Dec 6" (midnight)
112 "13:18" (today assumed)
112 "13:18" (today assumed)
113 "3:39" (3:39AM assumed)
113 "3:39" (3:39AM assumed)
114 "3:39pm" (15:39)
114 "3:39pm" (15:39)
115 "2006-12-06 13:18:29" (ISO 8601 format)
115 "2006-12-06 13:18:29" (ISO 8601 format)
116 "2006-12-6 13:18"
116 "2006-12-6 13:18"
117 "2006-12-6"
117 "2006-12-6"
118 "12-6"
118 "12-6"
119 "12/6"
119 "12/6"
120 "12/6/6" (Dec 6 2006)
120 "12/6/6" (Dec 6 2006)
121
121
122 Lastly, there is Mercurial's internal format:
122 Lastly, there is Mercurial's internal format::
123
123
124 "1165432709 0" (Wed Dec 6 13:18:29 2006 UTC)
124 "1165432709 0" (Wed Dec 6 13:18:29 2006 UTC)
125
125
126 This is the internal representation format for dates. unixtime is
126 This is the internal representation format for dates. unixtime is
127 the number of seconds since the epoch (1970-01-01 00:00 UTC).
127 the number of seconds since the epoch (1970-01-01 00:00 UTC).
128 offset is the offset of the local timezone, in seconds west of UTC
128 offset is the offset of the local timezone, in seconds west of UTC
129 (negative if the timezone is east of UTC).
129 (negative if the timezone is east of UTC).
130
130
131 The log command also accepts date ranges::
131 The log command also accepts date ranges::
132
132
133 "<{datetime}" - at or before a given date/time
133 "<{datetime}" - at or before a given date/time
134 ">{datetime}" - on or after a given date/time
134 ">{datetime}" - on or after a given date/time
135 "{datetime} to {datetime}" - a date range, inclusive
135 "{datetime} to {datetime}" - a date range, inclusive
136 "-{days}" - within a given number of days of today
136 "-{days}" - within a given number of days of today
137 ''')),
137 ''')),
138
138
139 (["patterns"], _("File Name Patterns"),
139 (["patterns"], _("File Name Patterns"),
140 _(r'''
140 _(r'''
141 Mercurial accepts several notations for identifying one or more
141 Mercurial accepts several notations for identifying one or more
142 files at a time.
142 files at a time.
143
143
144 By default, Mercurial treats filenames as shell-style extended
144 By default, Mercurial treats filenames as shell-style extended
145 glob patterns.
145 glob patterns.
146
146
147 Alternate pattern notations must be specified explicitly.
147 Alternate pattern notations must be specified explicitly.
148
148
149 To use a plain path name without any pattern matching, start it
149 To use a plain path name without any pattern matching, start it
150 with "path:". These path names must completely match starting at
150 with "path:". These path names must completely match starting at
151 the current repository root.
151 the current repository root.
152
152
153 To use an extended glob, start a name with "glob:". Globs are
153 To use an extended glob, start a name with "glob:". Globs are
154 rooted at the current directory; a glob such as "``*.c``" will
154 rooted at the current directory; a glob such as "``*.c``" will
155 only match files in the current directory ending with ".c".
155 only match files in the current directory ending with ".c".
156
156
157 The supported glob syntax extensions are "``**``" to match any
157 The supported glob syntax extensions are "``**``" to match any
158 string across path separators and "{a,b}" to mean "a or b".
158 string across path separators and "{a,b}" to mean "a or b".
159
159
160 To use a Perl/Python regular expression, start a name with "re:".
160 To use a Perl/Python regular expression, start a name with "re:".
161 Regexp pattern matching is anchored at the root of the repository.
161 Regexp pattern matching is anchored at the root of the repository.
162
162
163 Plain examples::
163 Plain examples::
164
164
165 path:foo/bar a name bar in a directory named foo in the root
165 path:foo/bar a name bar in a directory named foo in the root
166 of the repository
166 of the repository
167 path:path:name a file or directory named "path:name"
167 path:path:name a file or directory named "path:name"
168
168
169 Glob examples::
169 Glob examples::
170
170
171 glob:*.c any name ending in ".c" in the current directory
171 glob:*.c any name ending in ".c" in the current directory
172 *.c any name ending in ".c" in the current directory
172 *.c any name ending in ".c" in the current directory
173 **.c any name ending in ".c" in any subdirectory of the
173 **.c any name ending in ".c" in any subdirectory of the
174 current directory including itself.
174 current directory including itself.
175 foo/*.c any name ending in ".c" in the directory foo
175 foo/*.c any name ending in ".c" in the directory foo
176 foo/**.c any name ending in ".c" in any subdirectory of foo
176 foo/**.c any name ending in ".c" in any subdirectory of foo
177 including itself.
177 including itself.
178
178
179 Regexp examples::
179 Regexp examples::
180
180
181 re:.*\.c$ any name ending in ".c", anywhere in the repository
181 re:.*\.c$ any name ending in ".c", anywhere in the repository
182
182
183 ''')),
183 ''')),
184
184
185 (['environment', 'env'], _('Environment Variables'),
185 (['environment', 'env'], _('Environment Variables'),
186 _(r'''
186 _(r'''
187 HG
187 HG
188 Path to the 'hg' executable, automatically passed when running
188 Path to the 'hg' executable, automatically passed when running
189 hooks, extensions or external tools. If unset or empty, this is
189 hooks, extensions or external tools. If unset or empty, this is
190 the hg executable's name if it's frozen, or an executable named
190 the hg executable's name if it's frozen, or an executable named
191 'hg' (with %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on
191 'hg' (with %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on
192 Windows) is searched.
192 Windows) is searched.
193
193
194 HGEDITOR
194 HGEDITOR
195 This is the name of the editor to run when committing. See EDITOR.
195 This is the name of the editor to run when committing. See EDITOR.
196
196
197 (deprecated, use .hgrc)
197 (deprecated, use .hgrc)
198
198
199 HGENCODING
199 HGENCODING
200 This overrides the default locale setting detected by Mercurial.
200 This overrides the default locale setting detected by Mercurial.
201 This setting is used to convert data including usernames,
201 This setting is used to convert data including usernames,
202 changeset descriptions, tag names, and branches. This setting can
202 changeset descriptions, tag names, and branches. This setting can
203 be overridden with the --encoding command-line option.
203 be overridden with the --encoding command-line option.
204
204
205 HGENCODINGMODE
205 HGENCODINGMODE
206 This sets Mercurial's behavior for handling unknown characters
206 This sets Mercurial's behavior for handling unknown characters
207 while transcoding user input. The default is "strict", which
207 while transcoding user input. The default is "strict", which
208 causes Mercurial to abort if it can't map a character. Other
208 causes Mercurial to abort if it can't map a character. Other
209 settings include "replace", which replaces unknown characters, and
209 settings include "replace", which replaces unknown characters, and
210 "ignore", which drops them. This setting can be overridden with
210 "ignore", which drops them. This setting can be overridden with
211 the --encodingmode command-line option.
211 the --encodingmode command-line option.
212
212
213 HGMERGE
213 HGMERGE
214 An executable to use for resolving merge conflicts. The program
214 An executable to use for resolving merge conflicts. The program
215 will be executed with three arguments: local file, remote file,
215 will be executed with three arguments: local file, remote file,
216 ancestor file.
216 ancestor file.
217
217
218 (deprecated, use .hgrc)
218 (deprecated, use .hgrc)
219
219
220 HGRCPATH
220 HGRCPATH
221 A list of files or directories to search for hgrc files. Item
221 A list of files or directories to search for hgrc files. Item
222 separator is ":" on Unix, ";" on Windows. If HGRCPATH is not set,
222 separator is ":" on Unix, ";" on Windows. If HGRCPATH is not set,
223 platform default search path is used. If empty, only the .hg/hgrc
223 platform default search path is used. If empty, only the .hg/hgrc
224 from the current repository is read.
224 from the current repository is read.
225
225
226 For each element in HGRCPATH:
226 For each element in HGRCPATH:
227
227
228 - if it's a directory, all files ending with .rc are added
228 - if it's a directory, all files ending with .rc are added
229 - otherwise, the file itself will be added
229 - otherwise, the file itself will be added
230
230
231 HGUSER
231 HGUSER
232 This is the string used as the author of a commit. If not set,
232 This is the string used as the author of a commit. If not set,
233 available values will be considered in this order:
233 available values will be considered in this order:
234
234
235 - HGUSER (deprecated)
235 - HGUSER (deprecated)
236 - hgrc files from the HGRCPATH
236 - hgrc files from the HGRCPATH
237 - EMAIL
237 - EMAIL
238 - interactive prompt
238 - interactive prompt
239 - LOGNAME (with '@hostname' appended)
239 - LOGNAME (with '@hostname' appended)
240
240
241 (deprecated, use .hgrc)
241 (deprecated, use .hgrc)
242
242
243 EMAIL
243 EMAIL
244 May be used as the author of a commit; see HGUSER.
244 May be used as the author of a commit; see HGUSER.
245
245
246 LOGNAME
246 LOGNAME
247 May be used as the author of a commit; see HGUSER.
247 May be used as the author of a commit; see HGUSER.
248
248
249 VISUAL
249 VISUAL
250 This is the name of the editor to use when committing. See EDITOR.
250 This is the name of the editor to use when committing. See EDITOR.
251
251
252 EDITOR
252 EDITOR
253 Sometimes Mercurial needs to open a text file in an editor for a
253 Sometimes Mercurial needs to open a text file in an editor for a
254 user to modify, for example when writing commit messages. The
254 user to modify, for example when writing commit messages. The
255 editor it uses is determined by looking at the environment
255 editor it uses is determined by looking at the environment
256 variables HGEDITOR, VISUAL and EDITOR, in that order. The first
256 variables HGEDITOR, VISUAL and EDITOR, in that order. The first
257 non-empty one is chosen. If all of them are empty, the editor
257 non-empty one is chosen. If all of them are empty, the editor
258 defaults to 'vi'.
258 defaults to 'vi'.
259
259
260 PYTHONPATH
260 PYTHONPATH
261 This is used by Python to find imported modules and may need to be
261 This is used by Python to find imported modules and may need to be
262 set appropriately if this Mercurial is not installed system-wide.
262 set appropriately if this Mercurial is not installed system-wide.
263 ''')),
263 ''')),
264
264
265 (['revs', 'revisions'], _('Specifying Single Revisions'),
265 (['revs', 'revisions'], _('Specifying Single Revisions'),
266 _(r'''
266 _(r'''
267 Mercurial supports several ways to specify individual revisions.
267 Mercurial supports several ways to specify individual revisions.
268
268
269 A plain integer is treated as a revision number. Negative integers
269 A plain integer is treated as a revision number. Negative integers
270 are treated as topological offsets from the tip, with -1 denoting
270 are treated as topological offsets from the tip, with -1 denoting
271 the tip. As such, negative numbers are only useful if you've
271 the tip. As such, negative numbers are only useful if you've
272 memorized your local tree numbers and want to save typing a single
272 memorized your local tree numbers and want to save typing a single
273 digit. This editor suggests copy and paste.
273 digit. This editor suggests copy and paste.
274
274
275 A 40-digit hexadecimal string is treated as a unique revision
275 A 40-digit hexadecimal string is treated as a unique revision
276 identifier.
276 identifier.
277
277
278 A hexadecimal string less than 40 characters long is treated as a
278 A hexadecimal string less than 40 characters long is treated as a
279 unique revision identifier, and referred to as a short-form
279 unique revision identifier, and referred to as a short-form
280 identifier. A short-form identifier is only valid if it is the
280 identifier. A short-form identifier is only valid if it is the
281 prefix of exactly one full-length identifier.
281 prefix of exactly one full-length identifier.
282
282
283 Any other string is treated as a tag name, which is a symbolic
283 Any other string is treated as a tag name, which is a symbolic
284 name associated with a revision identifier. Tag names may not
284 name associated with a revision identifier. Tag names may not
285 contain the ":" character.
285 contain the ":" character.
286
286
287 The reserved name "tip" is a special tag that always identifies
287 The reserved name "tip" is a special tag that always identifies
288 the most recent revision.
288 the most recent revision.
289
289
290 The reserved name "null" indicates the null revision. This is the
290 The reserved name "null" indicates the null revision. This is the
291 revision of an empty repository, and the parent of revision 0.
291 revision of an empty repository, and the parent of revision 0.
292
292
293 The reserved name "." indicates the working directory parent. If
293 The reserved name "." indicates the working directory parent. If
294 no working directory is checked out, it is equivalent to null. If
294 no working directory is checked out, it is equivalent to null. If
295 an uncommitted merge is in progress, "." is the revision of the
295 an uncommitted merge is in progress, "." is the revision of the
296 first parent.
296 first parent.
297 ''')),
297 ''')),
298
298
299 (['mrevs', 'multirevs'], _('Specifying Multiple Revisions'),
299 (['mrevs', 'multirevs'], _('Specifying Multiple Revisions'),
300 _(r'''
300 _(r'''
301 When Mercurial accepts more than one revision, they may be
301 When Mercurial accepts more than one revision, they may be
302 specified individually, or provided as a topologically continuous
302 specified individually, or provided as a topologically continuous
303 range, separated by the ":" character.
303 range, separated by the ":" character.
304
304
305 The syntax of range notation is [BEGIN]:[END], where BEGIN and END
305 The syntax of range notation is [BEGIN]:[END], where BEGIN and END
306 are revision identifiers. Both BEGIN and END are optional. If
306 are revision identifiers. Both BEGIN and END are optional. If
307 BEGIN is not specified, it defaults to revision number 0. If END
307 BEGIN is not specified, it defaults to revision number 0. If END
308 is not specified, it defaults to the tip. The range ":" thus means
308 is not specified, it defaults to the tip. The range ":" thus means
309 "all revisions".
309 "all revisions".
310
310
311 If BEGIN is greater than END, revisions are treated in reverse
311 If BEGIN is greater than END, revisions are treated in reverse
312 order.
312 order.
313
313
314 A range acts as a closed interval. This means that a range of 3:5
314 A range acts as a closed interval. This means that a range of 3:5
315 gives 3, 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
315 gives 3, 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
316 ''')),
316 ''')),
317
317
318 (['diffs'], _('Diff Formats'),
318 (['diffs'], _('Diff Formats'),
319 _(r'''
319 _(r'''
320 Mercurial's default format for showing changes between two
320 Mercurial's default format for showing changes between two
321 versions of a file is compatible with the unified format of GNU
321 versions of a file is compatible with the unified format of GNU
322 diff, which can be used by GNU patch and many other standard
322 diff, which can be used by GNU patch and many other standard
323 tools.
323 tools.
324
324
325 While this standard format is often enough, it does not encode the
325 While this standard format is often enough, it does not encode the
326 following information:
326 following information:
327
327
328 - executable status and other permission bits
328 - executable status and other permission bits
329 - copy or rename information
329 - copy or rename information
330 - changes in binary files
330 - changes in binary files
331 - creation or deletion of empty files
331 - creation or deletion of empty files
332
332
333 Mercurial also supports the extended diff format from the git VCS
333 Mercurial also supports the extended diff format from the git VCS
334 which addresses these limitations. The git diff format is not
334 which addresses these limitations. The git diff format is not
335 produced by default because a few widespread tools still do not
335 produced by default because a few widespread tools still do not
336 understand this format.
336 understand this format.
337
337
338 This means that when generating diffs from a Mercurial repository
338 This means that when generating diffs from a Mercurial repository
339 (e.g. with "hg export"), you should be careful about things like
339 (e.g. with "hg export"), you should be careful about things like
340 file copies and renames or other things mentioned above, because
340 file copies and renames or other things mentioned above, because
341 when applying a standard diff to a different repository, this
341 when applying a standard diff to a different repository, this
342 extra information is lost. Mercurial's internal operations (like
342 extra information is lost. Mercurial's internal operations (like
343 push and pull) are not affected by this, because they use an
343 push and pull) are not affected by this, because they use an
344 internal binary format for communicating changes.
344 internal binary format for communicating changes.
345
345
346 To make Mercurial produce the git extended diff format, use the
346 To make Mercurial produce the git extended diff format, use the
347 --git option available for many commands, or set 'git = True' in
347 --git option available for many commands, or set 'git = True' in
348 the [diff] section of your hgrc. You do not need to set this
348 the [diff] section of your hgrc. You do not need to set this
349 option when importing diffs in this format or using them in the mq
349 option when importing diffs in this format or using them in the mq
350 extension.
350 extension.
351 ''')),
351 ''')),
352 (['templating'], _('Template Usage'),
352 (['templating'], _('Template Usage'),
353 _(r'''
353 _(r'''
354 Mercurial allows you to customize output of commands through
354 Mercurial allows you to customize output of commands through
355 templates. You can either pass in a template from the command
355 templates. You can either pass in a template from the command
356 line, via the --template option, or select an existing
356 line, via the --template option, or select an existing
357 template-style (--style).
357 template-style (--style).
358
358
359 You can customize output for any "log-like" command: log,
359 You can customize output for any "log-like" command: log,
360 outgoing, incoming, tip, parents, heads and glog.
360 outgoing, incoming, tip, parents, heads and glog.
361
361
362 Three styles are packaged with Mercurial: default (the style used
362 Three styles are packaged with Mercurial: default (the style used
363 when no explicit preference is passed), compact and changelog.
363 when no explicit preference is passed), compact and changelog.
364 Usage:
364 Usage::
365
365
366 $ hg log -r1 --style changelog
366 $ hg log -r1 --style changelog
367
367
368 A template is a piece of text, with markup to invoke variable
368 A template is a piece of text, with markup to invoke variable
369 expansion:
369 expansion::
370
370
371 $ hg log -r1 --template "{node}\n"
371 $ hg log -r1 --template "{node}\n"
372 b56ce7b07c52de7d5fd79fb89701ea538af65746
372 b56ce7b07c52de7d5fd79fb89701ea538af65746
373
373
374 Strings in curly braces are called keywords. The availability of
374 Strings in curly braces are called keywords. The availability of
375 keywords depends on the exact context of the templater. These
375 keywords depends on the exact context of the templater. These
376 keywords are usually available for templating a log-like command:
376 keywords are usually available for templating a log-like command:
377
377
378 - author: String. The unmodified author of the changeset.
378 - author: String. The unmodified author of the changeset.
379 - branches: String. The name of the branch on which the changeset
379 - branches: String. The name of the branch on which the changeset
380 was committed. Will be empty if the branch name was default.
380 was committed. Will be empty if the branch name was default.
381 - date: Date information. The date when the changeset was
381 - date: Date information. The date when the changeset was
382 committed.
382 committed.
383 - desc: String. The text of the changeset description.
383 - desc: String. The text of the changeset description.
384 - diffstat: String. Statistics of changes with the following
384 - diffstat: String. Statistics of changes with the following
385 format: "modified files: +added/-removed lines"
385 format: "modified files: +added/-removed lines"
386 - files: List of strings. All files modified, added, or removed by
386 - files: List of strings. All files modified, added, or removed by
387 this changeset.
387 this changeset.
388 - file_adds: List of strings. Files added by this changeset.
388 - file_adds: List of strings. Files added by this changeset.
389 - file_mods: List of strings. Files modified by this changeset.
389 - file_mods: List of strings. Files modified by this changeset.
390 - file_dels: List of strings. Files removed by this changeset.
390 - file_dels: List of strings. Files removed by this changeset.
391 - node: String. The changeset identification hash, as a
391 - node: String. The changeset identification hash, as a
392 40-character hexadecimal string.
392 40-character hexadecimal string.
393 - parents: List of strings. The parents of the changeset.
393 - parents: List of strings. The parents of the changeset.
394 - rev: Integer. The repository-local changeset revision number.
394 - rev: Integer. The repository-local changeset revision number.
395 - tags: List of strings. Any tags associated with the changeset.
395 - tags: List of strings. Any tags associated with the changeset.
396
396
397 The "date" keyword does not produce human-readable output. If you
397 The "date" keyword does not produce human-readable output. If you
398 want to use a date in your output, you can use a filter to process
398 want to use a date in your output, you can use a filter to process
399 it. Filters are functions which return a string based on the input
399 it. Filters are functions which return a string based on the input
400 variable. You can also use a chain of filters to get the desired
400 variable. You can also use a chain of filters to get the desired
401 output:
401 output::
402
402
403 $ hg tip --template "{date|isodate}\n"
403 $ hg tip --template "{date|isodate}\n"
404 2008-08-21 18:22 +0000
404 2008-08-21 18:22 +0000
405
405
406 List of filters:
406 List of filters:
407
407
408 - addbreaks: Any text. Add an XHTML "<br />" tag before the end of
408 - addbreaks: Any text. Add an XHTML "<br />" tag before the end of
409 every line except the last.
409 every line except the last.
410 - age: Date. Returns a human-readable date/time difference between
410 - age: Date. Returns a human-readable date/time difference between
411 the given date/time and the current date/time.
411 the given date/time and the current date/time.
412 - basename: Any text. Treats the text as a path, and returns the
412 - basename: Any text. Treats the text as a path, and returns the
413 last component of the path after splitting by the path separator
413 last component of the path after splitting by the path separator
414 (ignoring trailing separators). For example, "foo/bar/baz"
414 (ignoring trailing separators). For example, "foo/bar/baz"
415 becomes "baz" and "foo/bar//" becomes "bar".
415 becomes "baz" and "foo/bar//" becomes "bar".
416 - stripdir: Treat the text as path and strip a directory level, if
416 - stripdir: Treat the text as path and strip a directory level, if
417 possible. For example, "foo" and "foo/bar" becomes "foo".
417 possible. For example, "foo" and "foo/bar" becomes "foo".
418 - date: Date. Returns a date in a Unix date format, including the
418 - date: Date. Returns a date in a Unix date format, including the
419 timezone: "Mon Sep 04 15:13:13 2006 0700".
419 timezone: "Mon Sep 04 15:13:13 2006 0700".
420 - domain: Any text. Finds the first string that looks like an
420 - domain: Any text. Finds the first string that looks like an
421 email address, and extracts just the domain component. Example:
421 email address, and extracts just the domain component. Example:
422 'User <user@example.com>' becomes 'example.com'.
422 'User <user@example.com>' becomes 'example.com'.
423 - email: Any text. Extracts the first string that looks like an
423 - email: Any text. Extracts the first string that looks like an
424 email address. Example: 'User <user@example.com>' becomes
424 email address. Example: 'User <user@example.com>' becomes
425 'user@example.com'.
425 'user@example.com'.
426 - escape: Any text. Replaces the special XML/XHTML characters "&",
426 - escape: Any text. Replaces the special XML/XHTML characters "&",
427 "<" and ">" with XML entities.
427 "<" and ">" with XML entities.
428 - fill68: Any text. Wraps the text to fit in 68 columns.
428 - fill68: Any text. Wraps the text to fit in 68 columns.
429 - fill76: Any text. Wraps the text to fit in 76 columns.
429 - fill76: Any text. Wraps the text to fit in 76 columns.
430 - firstline: Any text. Returns the first line of text.
430 - firstline: Any text. Returns the first line of text.
431 - nonempty: Any text. Returns '(none)' if the string is empty.
431 - nonempty: Any text. Returns '(none)' if the string is empty.
432 - hgdate: Date. Returns the date as a pair of numbers: "1157407993
432 - hgdate: Date. Returns the date as a pair of numbers: "1157407993
433 25200" (Unix timestamp, timezone offset).
433 25200" (Unix timestamp, timezone offset).
434 - isodate: Date. Returns the date in ISO 8601 format.
434 - isodate: Date. Returns the date in ISO 8601 format.
435 - localdate: Date. Converts a date to local date.
435 - localdate: Date. Converts a date to local date.
436 - obfuscate: Any text. Returns the input text rendered as a
436 - obfuscate: Any text. Returns the input text rendered as a
437 sequence of XML entities.
437 sequence of XML entities.
438 - person: Any text. Returns the text before an email address.
438 - person: Any text. Returns the text before an email address.
439 - rfc822date: Date. Returns a date using the same format used in
439 - rfc822date: Date. Returns a date using the same format used in
440 email headers.
440 email headers.
441 - short: Changeset hash. Returns the short form of a changeset
441 - short: Changeset hash. Returns the short form of a changeset
442 hash, i.e. a 12-byte hexadecimal string.
442 hash, i.e. a 12-byte hexadecimal string.
443 - shortdate: Date. Returns a date like "2006-09-18".
443 - shortdate: Date. Returns a date like "2006-09-18".
444 - strip: Any text. Strips all leading and trailing whitespace.
444 - strip: Any text. Strips all leading and trailing whitespace.
445 - tabindent: Any text. Returns the text, with every line except
445 - tabindent: Any text. Returns the text, with every line except
446 the first starting with a tab character.
446 the first starting with a tab character.
447 - urlescape: Any text. Escapes all "special" characters. For
447 - urlescape: Any text. Escapes all "special" characters. For
448 example, "foo bar" becomes "foo%20bar".
448 example, "foo bar" becomes "foo%20bar".
449 - user: Any text. Returns the user portion of an email address.
449 - user: Any text. Returns the user portion of an email address.
450 ''')),
450 ''')),
451
451
452 (['urls'], _('URL Paths'),
452 (['urls'], _('URL Paths'),
453 _(r'''
453 _(r'''
454 Valid URLs are of the form::
454 Valid URLs are of the form::
455
455
456 local/filesystem/path[#revision]
456 local/filesystem/path[#revision]
457 file://local/filesystem/path[#revision]
457 file://local/filesystem/path[#revision]
458 http://[user[:pass]@]host[:port]/[path][#revision]
458 http://[user[:pass]@]host[:port]/[path][#revision]
459 https://[user[:pass]@]host[:port]/[path][#revision]
459 https://[user[:pass]@]host[:port]/[path][#revision]
460 ssh://[user[:pass]@]host[:port]/[path][#revision]
460 ssh://[user[:pass]@]host[:port]/[path][#revision]
461
461
462 Paths in the local filesystem can either point to Mercurial
462 Paths in the local filesystem can either point to Mercurial
463 repositories or to bundle files (as created by 'hg bundle' or 'hg
463 repositories or to bundle files (as created by 'hg bundle' or 'hg
464 incoming --bundle').
464 incoming --bundle').
465
465
466 An optional identifier after # indicates a particular branch, tag,
466 An optional identifier after # indicates a particular branch, tag,
467 or changeset to use from the remote repository. See also 'hg help
467 or changeset to use from the remote repository. See also 'hg help
468 revisions'.
468 revisions'.
469
469
470 Some features, such as pushing to http:// and https:// URLs are
470 Some features, such as pushing to http:// and https:// URLs are
471 only possible if the feature is explicitly enabled on the remote
471 only possible if the feature is explicitly enabled on the remote
472 Mercurial server.
472 Mercurial server.
473
473
474 Some notes about using SSH with Mercurial:
474 Some notes about using SSH with Mercurial:
475
475
476 - SSH requires an accessible shell account on the destination
476 - SSH requires an accessible shell account on the destination
477 machine and a copy of hg in the remote path or specified with as
477 machine and a copy of hg in the remote path or specified with as
478 remotecmd.
478 remotecmd.
479 - path is relative to the remote user's home directory by default.
479 - path is relative to the remote user's home directory by default.
480 Use an extra slash at the start of a path to specify an absolute
480 Use an extra slash at the start of a path to specify an absolute
481 path::
481 path::
482
482
483 ssh://example.com//tmp/repository
483 ssh://example.com//tmp/repository
484
484
485 - Mercurial doesn't use its own compression via SSH; the right
485 - Mercurial doesn't use its own compression via SSH; the right
486 thing to do is to configure it in your ~/.ssh/config, e.g.::
486 thing to do is to configure it in your ~/.ssh/config, e.g.::
487
487
488 Host *.mylocalnetwork.example.com
488 Host *.mylocalnetwork.example.com
489 Compression no
489 Compression no
490 Host *
490 Host *
491 Compression yes
491 Compression yes
492
492
493 Alternatively specify "ssh -C" as your ssh command in your hgrc
493 Alternatively specify "ssh -C" as your ssh command in your hgrc
494 or with the --ssh command line option.
494 or with the --ssh command line option.
495
495
496 These URLs can all be stored in your hgrc with path aliases under
496 These URLs can all be stored in your hgrc with path aliases under
497 the [paths] section like so::
497 the [paths] section like so::
498
498
499 [paths]
499 [paths]
500 alias1 = URL1
500 alias1 = URL1
501 alias2 = URL2
501 alias2 = URL2
502 ...
502 ...
503
503
504 You can then use the alias for any command that uses a URL (for
504 You can then use the alias for any command that uses a URL (for
505 example 'hg pull alias1' would pull from the 'alias1' path).
505 example 'hg pull alias1' would pull from the 'alias1' path).
506
506
507 Two path aliases are special because they are used as defaults
507 Two path aliases are special because they are used as defaults
508 when you do not provide the URL to a command:
508 when you do not provide the URL to a command:
509
509
510 default:
510 default:
511 When you create a repository with hg clone, the clone command
511 When you create a repository with hg clone, the clone command
512 saves the location of the source repository as the new
512 saves the location of the source repository as the new
513 repository's 'default' path. This is then used when you omit
513 repository's 'default' path. This is then used when you omit
514 path from push- and pull-like commands (including incoming and
514 path from push- and pull-like commands (including incoming and
515 outgoing).
515 outgoing).
516
516
517 default-push:
517 default-push:
518 The push command will look for a path named 'default-push', and
518 The push command will look for a path named 'default-push', and
519 prefer it over 'default' if both are defined.
519 prefer it over 'default' if both are defined.
520 ''')),
520 ''')),
521 (["extensions"], _("Using additional features"), extshelp),
521 (["extensions"], _("Using additional features"), extshelp),
522 )
522 )
General Comments 0
You need to be logged in to leave comments. Login now