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