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