##// END OF EJS Templates
filemerge: introduce a 'regkeyalt' merge tool variable...
Steve Borho -
r13565:98417560 stable
parent child Browse files
Show More
@@ -1,1128 +1,1134
1 ======
1 ======
2 hgrc
2 hgrc
3 ======
3 ======
4
4
5 ---------------------------------
5 ---------------------------------
6 configuration files for Mercurial
6 configuration files for Mercurial
7 ---------------------------------
7 ---------------------------------
8
8
9 :Author: Bryan O'Sullivan <bos@serpentine.com>
9 :Author: Bryan O'Sullivan <bos@serpentine.com>
10 :Organization: Mercurial
10 :Organization: Mercurial
11 :Manual section: 5
11 :Manual section: 5
12 :Manual group: Mercurial Manual
12 :Manual group: Mercurial Manual
13
13
14 .. contents::
14 .. contents::
15 :backlinks: top
15 :backlinks: top
16 :class: htmlonly
16 :class: htmlonly
17
17
18
18
19 Synopsis
19 Synopsis
20 --------
20 --------
21
21
22 The Mercurial system uses a set of configuration files to control
22 The Mercurial system uses a set of configuration files to control
23 aspects of its behavior.
23 aspects of its behavior.
24
24
25 Files
25 Files
26 -----
26 -----
27
27
28 Mercurial reads configuration data from several files, if they exist.
28 Mercurial reads configuration data from several files, if they exist.
29 The names of these files depend on the system on which Mercurial is
29 The names of these files depend on the system on which Mercurial is
30 installed. ``*.rc`` files from a single directory are read in
30 installed. ``*.rc`` files from a single directory are read in
31 alphabetical order, later ones overriding earlier ones. Where multiple
31 alphabetical order, later ones overriding earlier ones. Where multiple
32 paths are given below, settings from earlier paths override later
32 paths are given below, settings from earlier paths override later
33 ones.
33 ones.
34
34
35 | (Unix, Windows) ``<repo>/.hg/hgrc``
35 | (Unix, Windows) ``<repo>/.hg/hgrc``
36
36
37 Per-repository configuration options that only apply in a
37 Per-repository configuration options that only apply in a
38 particular repository. This file is not version-controlled, and
38 particular repository. This file is not version-controlled, and
39 will not get transferred during a "clone" operation. Options in
39 will not get transferred during a "clone" operation. Options in
40 this file override options in all other configuration files. On
40 this file override options in all other configuration files. On
41 Unix, most of this file will be ignored if it doesn't belong to a
41 Unix, most of this file will be ignored if it doesn't belong to a
42 trusted user or to a trusted group. See the documentation for the
42 trusted user or to a trusted group. See the documentation for the
43 trusted_ section below for more details.
43 trusted_ section below for more details.
44
44
45 | (Unix) ``$HOME/.hgrc``
45 | (Unix) ``$HOME/.hgrc``
46 | (Windows) ``%USERPROFILE%\.hgrc``
46 | (Windows) ``%USERPROFILE%\.hgrc``
47 | (Windows) ``%USERPROFILE%\Mercurial.ini``
47 | (Windows) ``%USERPROFILE%\Mercurial.ini``
48 | (Windows) ``%HOME%\.hgrc``
48 | (Windows) ``%HOME%\.hgrc``
49 | (Windows) ``%HOME%\Mercurial.ini``
49 | (Windows) ``%HOME%\Mercurial.ini``
50
50
51 Per-user configuration file(s), for the user running Mercurial. On
51 Per-user configuration file(s), for the user running Mercurial. On
52 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
52 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
53 files apply to all Mercurial commands executed by this user in any
53 files apply to all Mercurial commands executed by this user in any
54 directory. Options in these files override per-system and per-installation
54 directory. Options in these files override per-system and per-installation
55 options.
55 options.
56
56
57 | (Unix) ``/etc/mercurial/hgrc``
57 | (Unix) ``/etc/mercurial/hgrc``
58 | (Unix) ``/etc/mercurial/hgrc.d/*.rc``
58 | (Unix) ``/etc/mercurial/hgrc.d/*.rc``
59
59
60 Per-system configuration files, for the system on which Mercurial
60 Per-system configuration files, for the system on which Mercurial
61 is running. Options in these files apply to all Mercurial commands
61 is running. Options in these files apply to all Mercurial commands
62 executed by any user in any directory. Options in these files
62 executed by any user in any directory. Options in these files
63 override per-installation options.
63 override per-installation options.
64
64
65 | (Unix) ``<install-root>/etc/mercurial/hgrc``
65 | (Unix) ``<install-root>/etc/mercurial/hgrc``
66 | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc``
66 | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc``
67
67
68 Per-installation configuration files, searched for in the
68 Per-installation configuration files, searched for in the
69 directory where Mercurial is installed. ``<install-root>`` is the
69 directory where Mercurial is installed. ``<install-root>`` is the
70 parent directory of the **hg** executable (or symlink) being run. For
70 parent directory of the **hg** executable (or symlink) being run. For
71 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
71 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
72 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
72 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
73 to all Mercurial commands executed by any user in any directory.
73 to all Mercurial commands executed by any user in any directory.
74
74
75 | (Windows) ``<install-dir>\Mercurial.ini``
75 | (Windows) ``<install-dir>\Mercurial.ini``
76 | (Windows) ``<install-dir>\hgrc.d\*.rc``
76 | (Windows) ``<install-dir>\hgrc.d\*.rc``
77 | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial``
77 | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial``
78
78
79 Per-installation/system configuration files, for the system on
79 Per-installation/system configuration files, for the system on
80 which Mercurial is running. Options in these files apply to all
80 which Mercurial is running. Options in these files apply to all
81 Mercurial commands executed by any user in any directory. Registry
81 Mercurial commands executed by any user in any directory. Registry
82 keys contain PATH-like strings, every part of which must reference
82 keys contain PATH-like strings, every part of which must reference
83 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
83 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
84 be read. Mercurial checks each of these locations in the specified
84 be read. Mercurial checks each of these locations in the specified
85 order until one or more configuration files are detected. If the
85 order until one or more configuration files are detected. If the
86 pywin32 extensions are not installed, Mercurial will only look for
86 pywin32 extensions are not installed, Mercurial will only look for
87 site-wide configuration in ``C:\Mercurial\Mercurial.ini``.
87 site-wide configuration in ``C:\Mercurial\Mercurial.ini``.
88
88
89 Syntax
89 Syntax
90 ------
90 ------
91
91
92 A configuration file consists of sections, led by a ``[section]`` header
92 A configuration file consists of sections, led by a ``[section]`` header
93 and followed by ``name = value`` entries (sometimes called
93 and followed by ``name = value`` entries (sometimes called
94 ``configuration keys``)::
94 ``configuration keys``)::
95
95
96 [spam]
96 [spam]
97 eggs=ham
97 eggs=ham
98 green=
98 green=
99 eggs
99 eggs
100
100
101 Each line contains one entry. If the lines that follow are indented,
101 Each line contains one entry. If the lines that follow are indented,
102 they are treated as continuations of that entry. Leading whitespace is
102 they are treated as continuations of that entry. Leading whitespace is
103 removed from values. Empty lines are skipped. Lines beginning with
103 removed from values. Empty lines are skipped. Lines beginning with
104 ``#`` or ``;`` are ignored and may be used to provide comments.
104 ``#`` or ``;`` are ignored and may be used to provide comments.
105
105
106 Configuration keys can be set multiple times, in which case mercurial
106 Configuration keys can be set multiple times, in which case mercurial
107 will use the value that was configured last. As an example::
107 will use the value that was configured last. As an example::
108
108
109 [spam]
109 [spam]
110 eggs=large
110 eggs=large
111 ham=serrano
111 ham=serrano
112 eggs=small
112 eggs=small
113
113
114 This would set the configuration key named ``eggs`` to ``small``.
114 This would set the configuration key named ``eggs`` to ``small``.
115
115
116 It is also possible to define a section multiple times. A section can
116 It is also possible to define a section multiple times. A section can
117 be redefined on the same and/or on different hgrc files. For example::
117 be redefined on the same and/or on different hgrc files. For example::
118
118
119 [foo]
119 [foo]
120 eggs=large
120 eggs=large
121 ham=serrano
121 ham=serrano
122 eggs=small
122 eggs=small
123
123
124 [bar]
124 [bar]
125 eggs=ham
125 eggs=ham
126 green=
126 green=
127 eggs
127 eggs
128
128
129 [foo]
129 [foo]
130 ham=prosciutto
130 ham=prosciutto
131 eggs=medium
131 eggs=medium
132 bread=toasted
132 bread=toasted
133
133
134 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
134 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
135 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
135 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
136 respectively. As you can see there only thing that matters is the last
136 respectively. As you can see there only thing that matters is the last
137 value that was set for each of the configuration keys.
137 value that was set for each of the configuration keys.
138
138
139 If a configuration key is set multiple times in different
139 If a configuration key is set multiple times in different
140 configuration files the final value will depend on the order in which
140 configuration files the final value will depend on the order in which
141 the different configuration files are read, with settings from earlier
141 the different configuration files are read, with settings from earlier
142 paths overriding later ones as described on the ``Files`` section
142 paths overriding later ones as described on the ``Files`` section
143 above.
143 above.
144
144
145 A line of the form ``%include file`` will include ``file`` into the
145 A line of the form ``%include file`` will include ``file`` into the
146 current configuration file. The inclusion is recursive, which means
146 current configuration file. The inclusion is recursive, which means
147 that included files can include other files. Filenames are relative to
147 that included files can include other files. Filenames are relative to
148 the configuration file in which the ``%include`` directive is found.
148 the configuration file in which the ``%include`` directive is found.
149 Environment variables and ``~user`` constructs are expanded in
149 Environment variables and ``~user`` constructs are expanded in
150 ``file``. This lets you do something like::
150 ``file``. This lets you do something like::
151
151
152 %include ~/.hgrc.d/$HOST.rc
152 %include ~/.hgrc.d/$HOST.rc
153
153
154 to include a different configuration file on each computer you use.
154 to include a different configuration file on each computer you use.
155
155
156 A line with ``%unset name`` will remove ``name`` from the current
156 A line with ``%unset name`` will remove ``name`` from the current
157 section, if it has been set previously.
157 section, if it has been set previously.
158
158
159 The values are either free-form text strings, lists of text strings,
159 The values are either free-form text strings, lists of text strings,
160 or Boolean values. Boolean values can be set to true using any of "1",
160 or Boolean values. Boolean values can be set to true using any of "1",
161 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
161 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
162 (all case insensitive).
162 (all case insensitive).
163
163
164 List values are separated by whitespace or comma, except when values are
164 List values are separated by whitespace or comma, except when values are
165 placed in double quotation marks::
165 placed in double quotation marks::
166
166
167 allow_read = "John Doe, PhD", brian, betty
167 allow_read = "John Doe, PhD", brian, betty
168
168
169 Quotation marks can be escaped by prefixing them with a backslash. Only
169 Quotation marks can be escaped by prefixing them with a backslash. Only
170 quotation marks at the beginning of a word is counted as a quotation
170 quotation marks at the beginning of a word is counted as a quotation
171 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
171 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
172
172
173 Sections
173 Sections
174 --------
174 --------
175
175
176 This section describes the different sections that may appear in a
176 This section describes the different sections that may appear in a
177 Mercurial "hgrc" file, the purpose of each section, its possible keys,
177 Mercurial "hgrc" file, the purpose of each section, its possible keys,
178 and their possible values.
178 and their possible values.
179
179
180 ``alias``
180 ``alias``
181 """""""""
181 """""""""
182 Defines command aliases.
182 Defines command aliases.
183 Aliases allow you to define your own commands in terms of other
183 Aliases allow you to define your own commands in terms of other
184 commands (or aliases), optionally including arguments.
184 commands (or aliases), optionally including arguments.
185
185
186 Alias definitions consist of lines of the form::
186 Alias definitions consist of lines of the form::
187
187
188 <alias> = <command> [<argument]...
188 <alias> = <command> [<argument]...
189
189
190 For example, this definition::
190 For example, this definition::
191
191
192 latest = log --limit 5
192 latest = log --limit 5
193
193
194 creates a new command ``latest`` that shows only the five most recent
194 creates a new command ``latest`` that shows only the five most recent
195 changesets. You can define subsequent aliases using earlier ones::
195 changesets. You can define subsequent aliases using earlier ones::
196
196
197 stable5 = latest -b stable
197 stable5 = latest -b stable
198
198
199 .. note:: It is possible to create aliases with the same names as
199 .. note:: It is possible to create aliases with the same names as
200 existing commands, which will then override the original
200 existing commands, which will then override the original
201 definitions. This is almost always a bad idea!
201 definitions. This is almost always a bad idea!
202
202
203
203
204 ``auth``
204 ``auth``
205 """"""""
205 """"""""
206
206
207 Authentication credentials for HTTP authentication. This section
207 Authentication credentials for HTTP authentication. This section
208 allows you to store usernames and passwords for use when logging
208 allows you to store usernames and passwords for use when logging
209 *into* HTTP servers. See the web_ configuration section if you want to
209 *into* HTTP servers. See the web_ configuration section if you want to
210 configure *who* can login to your HTTP server.
210 configure *who* can login to your HTTP server.
211
211
212 Each line has the following format::
212 Each line has the following format::
213
213
214 <name>.<argument> = <value>
214 <name>.<argument> = <value>
215
215
216 where ``<name>`` is used to group arguments into authentication
216 where ``<name>`` is used to group arguments into authentication
217 entries. Example::
217 entries. Example::
218
218
219 foo.prefix = hg.intevation.org/mercurial
219 foo.prefix = hg.intevation.org/mercurial
220 foo.username = foo
220 foo.username = foo
221 foo.password = bar
221 foo.password = bar
222 foo.schemes = http https
222 foo.schemes = http https
223
223
224 bar.prefix = secure.example.org
224 bar.prefix = secure.example.org
225 bar.key = path/to/file.key
225 bar.key = path/to/file.key
226 bar.cert = path/to/file.cert
226 bar.cert = path/to/file.cert
227 bar.schemes = https
227 bar.schemes = https
228
228
229 Supported arguments:
229 Supported arguments:
230
230
231 ``prefix``
231 ``prefix``
232 Either ``*`` or a URI prefix with or without the scheme part.
232 Either ``*`` or a URI prefix with or without the scheme part.
233 The authentication entry with the longest matching prefix is used
233 The authentication entry with the longest matching prefix is used
234 (where ``*`` matches everything and counts as a match of length
234 (where ``*`` matches everything and counts as a match of length
235 1). If the prefix doesn't include a scheme, the match is performed
235 1). If the prefix doesn't include a scheme, the match is performed
236 against the URI with its scheme stripped as well, and the schemes
236 against the URI with its scheme stripped as well, and the schemes
237 argument, q.v., is then subsequently consulted.
237 argument, q.v., is then subsequently consulted.
238 ``username``
238 ``username``
239 Optional. Username to authenticate with. If not given, and the
239 Optional. Username to authenticate with. If not given, and the
240 remote site requires basic or digest authentication, the user will
240 remote site requires basic or digest authentication, the user will
241 be prompted for it. Environment variables are expanded in the
241 be prompted for it. Environment variables are expanded in the
242 username letting you do ``foo.username = $USER``.
242 username letting you do ``foo.username = $USER``.
243 ``password``
243 ``password``
244 Optional. Password to authenticate with. If not given, and the
244 Optional. Password to authenticate with. If not given, and the
245 remote site requires basic or digest authentication, the user
245 remote site requires basic or digest authentication, the user
246 will be prompted for it.
246 will be prompted for it.
247 ``key``
247 ``key``
248 Optional. PEM encoded client certificate key file. Environment
248 Optional. PEM encoded client certificate key file. Environment
249 variables are expanded in the filename.
249 variables are expanded in the filename.
250 ``cert``
250 ``cert``
251 Optional. PEM encoded client certificate chain file. Environment
251 Optional. PEM encoded client certificate chain file. Environment
252 variables are expanded in the filename.
252 variables are expanded in the filename.
253 ``schemes``
253 ``schemes``
254 Optional. Space separated list of URI schemes to use this
254 Optional. Space separated list of URI schemes to use this
255 authentication entry with. Only used if the prefix doesn't include
255 authentication entry with. Only used if the prefix doesn't include
256 a scheme. Supported schemes are http and https. They will match
256 a scheme. Supported schemes are http and https. They will match
257 static-http and static-https respectively, as well.
257 static-http and static-https respectively, as well.
258 Default: https.
258 Default: https.
259
259
260 If no suitable authentication entry is found, the user is prompted
260 If no suitable authentication entry is found, the user is prompted
261 for credentials as usual if required by the remote.
261 for credentials as usual if required by the remote.
262
262
263
263
264 ``decode/encode``
264 ``decode/encode``
265 """""""""""""""""
265 """""""""""""""""
266 Filters for transforming files on checkout/checkin. This would
266 Filters for transforming files on checkout/checkin. This would
267 typically be used for newline processing or other
267 typically be used for newline processing or other
268 localization/canonicalization of files.
268 localization/canonicalization of files.
269
269
270 Filters consist of a filter pattern followed by a filter command.
270 Filters consist of a filter pattern followed by a filter command.
271 Filter patterns are globs by default, rooted at the repository root.
271 Filter patterns are globs by default, rooted at the repository root.
272 For example, to match any file ending in ``.txt`` in the root
272 For example, to match any file ending in ``.txt`` in the root
273 directory only, use the pattern ``*.txt``. To match any file ending
273 directory only, use the pattern ``*.txt``. To match any file ending
274 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
274 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
275 For each file only the first matching filter applies.
275 For each file only the first matching filter applies.
276
276
277 The filter command can start with a specifier, either ``pipe:`` or
277 The filter command can start with a specifier, either ``pipe:`` or
278 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
278 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
279
279
280 A ``pipe:`` command must accept data on stdin and return the transformed
280 A ``pipe:`` command must accept data on stdin and return the transformed
281 data on stdout.
281 data on stdout.
282
282
283 Pipe example::
283 Pipe example::
284
284
285 [encode]
285 [encode]
286 # uncompress gzip files on checkin to improve delta compression
286 # uncompress gzip files on checkin to improve delta compression
287 # note: not necessarily a good idea, just an example
287 # note: not necessarily a good idea, just an example
288 *.gz = pipe: gunzip
288 *.gz = pipe: gunzip
289
289
290 [decode]
290 [decode]
291 # recompress gzip files when writing them to the working dir (we
291 # recompress gzip files when writing them to the working dir (we
292 # can safely omit "pipe:", because it's the default)
292 # can safely omit "pipe:", because it's the default)
293 *.gz = gzip
293 *.gz = gzip
294
294
295 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
295 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
296 with the name of a temporary file that contains the data to be
296 with the name of a temporary file that contains the data to be
297 filtered by the command. The string ``OUTFILE`` is replaced with the name
297 filtered by the command. The string ``OUTFILE`` is replaced with the name
298 of an empty temporary file, where the filtered data must be written by
298 of an empty temporary file, where the filtered data must be written by
299 the command.
299 the command.
300
300
301 .. note:: The tempfile mechanism is recommended for Windows systems,
301 .. note:: The tempfile mechanism is recommended for Windows systems,
302 where the standard shell I/O redirection operators often have
302 where the standard shell I/O redirection operators often have
303 strange effects and may corrupt the contents of your files.
303 strange effects and may corrupt the contents of your files.
304
304
305 This filter mechanism is used internally by the ``eol`` extension to
305 This filter mechanism is used internally by the ``eol`` extension to
306 translate line ending characters between Windows (CRLF) and Unix (LF)
306 translate line ending characters between Windows (CRLF) and Unix (LF)
307 format. We suggest you use the ``eol`` extension for convenience.
307 format. We suggest you use the ``eol`` extension for convenience.
308
308
309
309
310 ``defaults``
310 ``defaults``
311 """"""""""""
311 """"""""""""
312
312
313 (defaults are deprecated. Don't use them. Use aliases instead)
313 (defaults are deprecated. Don't use them. Use aliases instead)
314
314
315 Use the ``[defaults]`` section to define command defaults, i.e. the
315 Use the ``[defaults]`` section to define command defaults, i.e. the
316 default options/arguments to pass to the specified commands.
316 default options/arguments to pass to the specified commands.
317
317
318 The following example makes :hg:`log` run in verbose mode, and
318 The following example makes :hg:`log` run in verbose mode, and
319 :hg:`status` show only the modified files, by default::
319 :hg:`status` show only the modified files, by default::
320
320
321 [defaults]
321 [defaults]
322 log = -v
322 log = -v
323 status = -m
323 status = -m
324
324
325 The actual commands, instead of their aliases, must be used when
325 The actual commands, instead of their aliases, must be used when
326 defining command defaults. The command defaults will also be applied
326 defining command defaults. The command defaults will also be applied
327 to the aliases of the commands defined.
327 to the aliases of the commands defined.
328
328
329
329
330 ``diff``
330 ``diff``
331 """"""""
331 """"""""
332
332
333 Settings used when displaying diffs. Everything except for ``unified`` is a
333 Settings used when displaying diffs. Everything except for ``unified`` is a
334 Boolean and defaults to False.
334 Boolean and defaults to False.
335
335
336 ``git``
336 ``git``
337 Use git extended diff format.
337 Use git extended diff format.
338 ``nodates``
338 ``nodates``
339 Don't include dates in diff headers.
339 Don't include dates in diff headers.
340 ``showfunc``
340 ``showfunc``
341 Show which function each change is in.
341 Show which function each change is in.
342 ``ignorews``
342 ``ignorews``
343 Ignore white space when comparing lines.
343 Ignore white space when comparing lines.
344 ``ignorewsamount``
344 ``ignorewsamount``
345 Ignore changes in the amount of white space.
345 Ignore changes in the amount of white space.
346 ``ignoreblanklines``
346 ``ignoreblanklines``
347 Ignore changes whose lines are all blank.
347 Ignore changes whose lines are all blank.
348 ``unified``
348 ``unified``
349 Number of lines of context to show.
349 Number of lines of context to show.
350
350
351 ``email``
351 ``email``
352 """""""""
352 """""""""
353 Settings for extensions that send email messages.
353 Settings for extensions that send email messages.
354
354
355 ``from``
355 ``from``
356 Optional. Email address to use in "From" header and SMTP envelope
356 Optional. Email address to use in "From" header and SMTP envelope
357 of outgoing messages.
357 of outgoing messages.
358 ``to``
358 ``to``
359 Optional. Comma-separated list of recipients' email addresses.
359 Optional. Comma-separated list of recipients' email addresses.
360 ``cc``
360 ``cc``
361 Optional. Comma-separated list of carbon copy recipients'
361 Optional. Comma-separated list of carbon copy recipients'
362 email addresses.
362 email addresses.
363 ``bcc``
363 ``bcc``
364 Optional. Comma-separated list of blind carbon copy recipients'
364 Optional. Comma-separated list of blind carbon copy recipients'
365 email addresses.
365 email addresses.
366 ``method``
366 ``method``
367 Optional. Method to use to send email messages. If value is ``smtp``
367 Optional. Method to use to send email messages. If value is ``smtp``
368 (default), use SMTP (see the SMTP_ section for configuration).
368 (default), use SMTP (see the SMTP_ section for configuration).
369 Otherwise, use as name of program to run that acts like sendmail
369 Otherwise, use as name of program to run that acts like sendmail
370 (takes ``-f`` option for sender, list of recipients on command line,
370 (takes ``-f`` option for sender, list of recipients on command line,
371 message on stdin). Normally, setting this to ``sendmail`` or
371 message on stdin). Normally, setting this to ``sendmail`` or
372 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
372 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
373 ``charsets``
373 ``charsets``
374 Optional. Comma-separated list of character sets considered
374 Optional. Comma-separated list of character sets considered
375 convenient for recipients. Addresses, headers, and parts not
375 convenient for recipients. Addresses, headers, and parts not
376 containing patches of outgoing messages will be encoded in the
376 containing patches of outgoing messages will be encoded in the
377 first character set to which conversion from local encoding
377 first character set to which conversion from local encoding
378 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
378 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
379 conversion fails, the text in question is sent as is. Defaults to
379 conversion fails, the text in question is sent as is. Defaults to
380 empty (explicit) list.
380 empty (explicit) list.
381
381
382 Order of outgoing email character sets:
382 Order of outgoing email character sets:
383
383
384 1. ``us-ascii``: always first, regardless of settings
384 1. ``us-ascii``: always first, regardless of settings
385 2. ``email.charsets``: in order given by user
385 2. ``email.charsets``: in order given by user
386 3. ``ui.fallbackencoding``: if not in email.charsets
386 3. ``ui.fallbackencoding``: if not in email.charsets
387 4. ``$HGENCODING``: if not in email.charsets
387 4. ``$HGENCODING``: if not in email.charsets
388 5. ``utf-8``: always last, regardless of settings
388 5. ``utf-8``: always last, regardless of settings
389
389
390 Email example::
390 Email example::
391
391
392 [email]
392 [email]
393 from = Joseph User <joe.user@example.com>
393 from = Joseph User <joe.user@example.com>
394 method = /usr/sbin/sendmail
394 method = /usr/sbin/sendmail
395 # charsets for western Europeans
395 # charsets for western Europeans
396 # us-ascii, utf-8 omitted, as they are tried first and last
396 # us-ascii, utf-8 omitted, as they are tried first and last
397 charsets = iso-8859-1, iso-8859-15, windows-1252
397 charsets = iso-8859-1, iso-8859-15, windows-1252
398
398
399
399
400 ``extensions``
400 ``extensions``
401 """"""""""""""
401 """"""""""""""
402
402
403 Mercurial has an extension mechanism for adding new features. To
403 Mercurial has an extension mechanism for adding new features. To
404 enable an extension, create an entry for it in this section.
404 enable an extension, create an entry for it in this section.
405
405
406 If you know that the extension is already in Python's search path,
406 If you know that the extension is already in Python's search path,
407 you can give the name of the module, followed by ``=``, with nothing
407 you can give the name of the module, followed by ``=``, with nothing
408 after the ``=``.
408 after the ``=``.
409
409
410 Otherwise, give a name that you choose, followed by ``=``, followed by
410 Otherwise, give a name that you choose, followed by ``=``, followed by
411 the path to the ``.py`` file (including the file name extension) that
411 the path to the ``.py`` file (including the file name extension) that
412 defines the extension.
412 defines the extension.
413
413
414 To explicitly disable an extension that is enabled in an hgrc of
414 To explicitly disable an extension that is enabled in an hgrc of
415 broader scope, prepend its path with ``!``, as in
415 broader scope, prepend its path with ``!``, as in
416 ``hgext.foo = !/ext/path`` or ``hgext.foo = !`` when path is not
416 ``hgext.foo = !/ext/path`` or ``hgext.foo = !`` when path is not
417 supplied.
417 supplied.
418
418
419 Example for ``~/.hgrc``::
419 Example for ``~/.hgrc``::
420
420
421 [extensions]
421 [extensions]
422 # (the mq extension will get loaded from Mercurial's path)
422 # (the mq extension will get loaded from Mercurial's path)
423 hgext.mq =
423 hgext.mq =
424 # (this extension will get loaded from the file specified)
424 # (this extension will get loaded from the file specified)
425 myfeature = ~/.hgext/myfeature.py
425 myfeature = ~/.hgext/myfeature.py
426
426
427
427
428 ``hostfingerprints``
428 ``hostfingerprints``
429 """"""""""""""""""""
429 """"""""""""""""""""
430
430
431 Fingerprints of the certificates of known HTTPS servers.
431 Fingerprints of the certificates of known HTTPS servers.
432 A HTTPS connection to a server with a fingerprint configured here will
432 A HTTPS connection to a server with a fingerprint configured here will
433 only succeed if the servers certificate matches the fingerprint.
433 only succeed if the servers certificate matches the fingerprint.
434 This is very similar to how ssh known hosts works.
434 This is very similar to how ssh known hosts works.
435 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
435 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
436 The CA chain and web.cacerts is not used for servers with a fingerprint.
436 The CA chain and web.cacerts is not used for servers with a fingerprint.
437
437
438 For example::
438 For example::
439
439
440 [hostfingerprints]
440 [hostfingerprints]
441 hg.intevation.org = 38:76:52:7c:87:26:9a:8f:4a:f8:d3:de:08:45:3b:ea:d6:4b:ee:cc
441 hg.intevation.org = 38:76:52:7c:87:26:9a:8f:4a:f8:d3:de:08:45:3b:ea:d6:4b:ee:cc
442
442
443 This feature is only supported when using Python 2.6 or later.
443 This feature is only supported when using Python 2.6 or later.
444
444
445
445
446 ``format``
446 ``format``
447 """"""""""
447 """"""""""
448
448
449 ``usestore``
449 ``usestore``
450 Enable or disable the "store" repository format which improves
450 Enable or disable the "store" repository format which improves
451 compatibility with systems that fold case or otherwise mangle
451 compatibility with systems that fold case or otherwise mangle
452 filenames. Enabled by default. Disabling this option will allow
452 filenames. Enabled by default. Disabling this option will allow
453 you to store longer filenames in some situations at the expense of
453 you to store longer filenames in some situations at the expense of
454 compatibility and ensures that the on-disk format of newly created
454 compatibility and ensures that the on-disk format of newly created
455 repositories will be compatible with Mercurial before version 0.9.4.
455 repositories will be compatible with Mercurial before version 0.9.4.
456
456
457 ``usefncache``
457 ``usefncache``
458 Enable or disable the "fncache" repository format which enhances
458 Enable or disable the "fncache" repository format which enhances
459 the "store" repository format (which has to be enabled to use
459 the "store" repository format (which has to be enabled to use
460 fncache) to allow longer filenames and avoids using Windows
460 fncache) to allow longer filenames and avoids using Windows
461 reserved names, e.g. "nul". Enabled by default. Disabling this
461 reserved names, e.g. "nul". Enabled by default. Disabling this
462 option ensures that the on-disk format of newly created
462 option ensures that the on-disk format of newly created
463 repositories will be compatible with Mercurial before version 1.1.
463 repositories will be compatible with Mercurial before version 1.1.
464
464
465 ``dotencode``
465 ``dotencode``
466 Enable or disable the "dotencode" repository format which enhances
466 Enable or disable the "dotencode" repository format which enhances
467 the "fncache" repository format (which has to be enabled to use
467 the "fncache" repository format (which has to be enabled to use
468 dotencode) to avoid issues with filenames starting with ._ on
468 dotencode) to avoid issues with filenames starting with ._ on
469 Mac OS X and spaces on Windows. Enabled by default. Disabling this
469 Mac OS X and spaces on Windows. Enabled by default. Disabling this
470 option ensures that the on-disk format of newly created
470 option ensures that the on-disk format of newly created
471 repositories will be compatible with Mercurial before version 1.7.
471 repositories will be compatible with Mercurial before version 1.7.
472
472
473 ``merge-patterns``
473 ``merge-patterns``
474 """"""""""""""""""
474 """"""""""""""""""
475
475
476 This section specifies merge tools to associate with particular file
476 This section specifies merge tools to associate with particular file
477 patterns. Tools matched here will take precedence over the default
477 patterns. Tools matched here will take precedence over the default
478 merge tool. Patterns are globs by default, rooted at the repository
478 merge tool. Patterns are globs by default, rooted at the repository
479 root.
479 root.
480
480
481 Example::
481 Example::
482
482
483 [merge-patterns]
483 [merge-patterns]
484 **.c = kdiff3
484 **.c = kdiff3
485 **.jpg = myimgmerge
485 **.jpg = myimgmerge
486
486
487 ``merge-tools``
487 ``merge-tools``
488 """""""""""""""
488 """""""""""""""
489
489
490 This section configures external merge tools to use for file-level
490 This section configures external merge tools to use for file-level
491 merges.
491 merges.
492
492
493 Example ``~/.hgrc``::
493 Example ``~/.hgrc``::
494
494
495 [merge-tools]
495 [merge-tools]
496 # Override stock tool location
496 # Override stock tool location
497 kdiff3.executable = ~/bin/kdiff3
497 kdiff3.executable = ~/bin/kdiff3
498 # Specify command line
498 # Specify command line
499 kdiff3.args = $base $local $other -o $output
499 kdiff3.args = $base $local $other -o $output
500 # Give higher priority
500 # Give higher priority
501 kdiff3.priority = 1
501 kdiff3.priority = 1
502
502
503 # Define new tool
503 # Define new tool
504 myHtmlTool.args = -m $local $other $base $output
504 myHtmlTool.args = -m $local $other $base $output
505 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
505 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
506 myHtmlTool.priority = 1
506 myHtmlTool.priority = 1
507
507
508 Supported arguments:
508 Supported arguments:
509
509
510 ``priority``
510 ``priority``
511 The priority in which to evaluate this tool.
511 The priority in which to evaluate this tool.
512 Default: 0.
512 Default: 0.
513 ``executable``
513 ``executable``
514 Either just the name of the executable or its pathname. On Windows,
514 Either just the name of the executable or its pathname. On Windows,
515 the path can use environment variables with ${ProgramFiles} syntax.
515 the path can use environment variables with ${ProgramFiles} syntax.
516 Default: the tool name.
516 Default: the tool name.
517 ``args``
517 ``args``
518 The arguments to pass to the tool executable. You can refer to the
518 The arguments to pass to the tool executable. You can refer to the
519 files being merged as well as the output file through these
519 files being merged as well as the output file through these
520 variables: ``$base``, ``$local``, ``$other``, ``$output``.
520 variables: ``$base``, ``$local``, ``$other``, ``$output``.
521 Default: ``$local $base $other``
521 Default: ``$local $base $other``
522 ``premerge``
522 ``premerge``
523 Attempt to run internal non-interactive 3-way merge tool before
523 Attempt to run internal non-interactive 3-way merge tool before
524 launching external tool. Options are ``true``, ``false``, or ``keep``
524 launching external tool. Options are ``true``, ``false``, or ``keep``
525 to leave markers in the file if the premerge fails.
525 to leave markers in the file if the premerge fails.
526 Default: True
526 Default: True
527 ``binary``
527 ``binary``
528 This tool can merge binary files. Defaults to False, unless tool
528 This tool can merge binary files. Defaults to False, unless tool
529 was selected by file pattern match.
529 was selected by file pattern match.
530 ``symlink``
530 ``symlink``
531 This tool can merge symlinks. Defaults to False, even if tool was
531 This tool can merge symlinks. Defaults to False, even if tool was
532 selected by file pattern match.
532 selected by file pattern match.
533 ``check``
533 ``check``
534 A list of merge success-checking options:
534 A list of merge success-checking options:
535
535
536 ``changed``
536 ``changed``
537 Ask whether merge was successful when the merged file shows no changes.
537 Ask whether merge was successful when the merged file shows no changes.
538 ``conflicts``
538 ``conflicts``
539 Check whether there are conflicts even though the tool reported success.
539 Check whether there are conflicts even though the tool reported success.
540 ``prompt``
540 ``prompt``
541 Always prompt for merge success, regardless of success reported by tool.
541 Always prompt for merge success, regardless of success reported by tool.
542
542
543 ``checkchanged``
543 ``checkchanged``
544 True is equivalent to ``check = changed``.
544 True is equivalent to ``check = changed``.
545 Default: False
545 Default: False
546 ``checkconflicts``
546 ``checkconflicts``
547 True is equivalent to ``check = conflicts``.
547 True is equivalent to ``check = conflicts``.
548 Default: False
548 Default: False
549 ``fixeol``
549 ``fixeol``
550 Attempt to fix up EOL changes caused by the merge tool.
550 Attempt to fix up EOL changes caused by the merge tool.
551 Default: False
551 Default: False
552 ``gui``
552 ``gui``
553 This tool requires a graphical interface to run. Default: False
553 This tool requires a graphical interface to run. Default: False
554 ``regkey``
554 ``regkey``
555 Windows registry key which describes install location of this
555 Windows registry key which describes install location of this
556 tool. Mercurial will search for this key first under
556 tool. Mercurial will search for this key first under
557 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
557 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
558 Default: None
558 Default: None
559 ``regkeyalt``
560 An alternate Windows registry key to try if the first key is not
561 found. The alternate key uses the same ``regname`` and ``regappend``
562 semantics of the primary key. The most common use for this key
563 is to search for 32bit applications on 64bit operating systems.
564 Default: None
559 ``regname``
565 ``regname``
560 Name of value to read from specified registry key. Defaults to the
566 Name of value to read from specified registry key. Defaults to the
561 unnamed (default) value.
567 unnamed (default) value.
562 ``regappend``
568 ``regappend``
563 String to append to the value read from the registry, typically
569 String to append to the value read from the registry, typically
564 the executable name of the tool.
570 the executable name of the tool.
565 Default: None
571 Default: None
566
572
567
573
568 ``hooks``
574 ``hooks``
569 """""""""
575 """""""""
570 Commands or Python functions that get automatically executed by
576 Commands or Python functions that get automatically executed by
571 various actions such as starting or finishing a commit. Multiple
577 various actions such as starting or finishing a commit. Multiple
572 hooks can be run for the same action by appending a suffix to the
578 hooks can be run for the same action by appending a suffix to the
573 action. Overriding a site-wide hook can be done by changing its
579 action. Overriding a site-wide hook can be done by changing its
574 value or setting it to an empty string.
580 value or setting it to an empty string.
575
581
576 Example ``.hg/hgrc``::
582 Example ``.hg/hgrc``::
577
583
578 [hooks]
584 [hooks]
579 # update working directory after adding changesets
585 # update working directory after adding changesets
580 changegroup.update = hg update
586 changegroup.update = hg update
581 # do not use the site-wide hook
587 # do not use the site-wide hook
582 incoming =
588 incoming =
583 incoming.email = /my/email/hook
589 incoming.email = /my/email/hook
584 incoming.autobuild = /my/build/hook
590 incoming.autobuild = /my/build/hook
585
591
586 Most hooks are run with environment variables set that give useful
592 Most hooks are run with environment variables set that give useful
587 additional information. For each hook below, the environment
593 additional information. For each hook below, the environment
588 variables it is passed are listed with names of the form ``$HG_foo``.
594 variables it is passed are listed with names of the form ``$HG_foo``.
589
595
590 ``changegroup``
596 ``changegroup``
591 Run after a changegroup has been added via push, pull or unbundle.
597 Run after a changegroup has been added via push, pull or unbundle.
592 ID of the first new changeset is in ``$HG_NODE``. URL from which
598 ID of the first new changeset is in ``$HG_NODE``. URL from which
593 changes came is in ``$HG_URL``.
599 changes came is in ``$HG_URL``.
594 ``commit``
600 ``commit``
595 Run after a changeset has been created in the local repository. ID
601 Run after a changeset has been created in the local repository. ID
596 of the newly created changeset is in ``$HG_NODE``. Parent changeset
602 of the newly created changeset is in ``$HG_NODE``. Parent changeset
597 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
603 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
598 ``incoming``
604 ``incoming``
599 Run after a changeset has been pulled, pushed, or unbundled into
605 Run after a changeset has been pulled, pushed, or unbundled into
600 the local repository. The ID of the newly arrived changeset is in
606 the local repository. The ID of the newly arrived changeset is in
601 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
607 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
602 ``outgoing``
608 ``outgoing``
603 Run after sending changes from local repository to another. ID of
609 Run after sending changes from local repository to another. ID of
604 first changeset sent is in ``$HG_NODE``. Source of operation is in
610 first changeset sent is in ``$HG_NODE``. Source of operation is in
605 ``$HG_SOURCE``; see "preoutgoing" hook for description.
611 ``$HG_SOURCE``; see "preoutgoing" hook for description.
606 ``post-<command>``
612 ``post-<command>``
607 Run after successful invocations of the associated command. The
613 Run after successful invocations of the associated command. The
608 contents of the command line are passed as ``$HG_ARGS`` and the result
614 contents of the command line are passed as ``$HG_ARGS`` and the result
609 code in ``$HG_RESULT``. Parsed command line arguments are passed as
615 code in ``$HG_RESULT``. Parsed command line arguments are passed as
610 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
616 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
611 the python data internally passed to <command>. ``$HG_OPTS`` is a
617 the python data internally passed to <command>. ``$HG_OPTS`` is a
612 dictionary of options (with unspecified options set to their defaults).
618 dictionary of options (with unspecified options set to their defaults).
613 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
619 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
614 ``pre-<command>``
620 ``pre-<command>``
615 Run before executing the associated command. The contents of the
621 Run before executing the associated command. The contents of the
616 command line are passed as ``$HG_ARGS``. Parsed command line arguments
622 command line are passed as ``$HG_ARGS``. Parsed command line arguments
617 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
623 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
618 representations of the data internally passed to <command>. ``$HG_OPTS``
624 representations of the data internally passed to <command>. ``$HG_OPTS``
619 is a dictionary of options (with unspecified options set to their
625 is a dictionary of options (with unspecified options set to their
620 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
626 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
621 failure, the command doesn't execute and Mercurial returns the failure
627 failure, the command doesn't execute and Mercurial returns the failure
622 code.
628 code.
623 ``prechangegroup``
629 ``prechangegroup``
624 Run before a changegroup is added via push, pull or unbundle. Exit
630 Run before a changegroup is added via push, pull or unbundle. Exit
625 status 0 allows the changegroup to proceed. Non-zero status will
631 status 0 allows the changegroup to proceed. Non-zero status will
626 cause the push, pull or unbundle to fail. URL from which changes
632 cause the push, pull or unbundle to fail. URL from which changes
627 will come is in ``$HG_URL``.
633 will come is in ``$HG_URL``.
628 ``precommit``
634 ``precommit``
629 Run before starting a local commit. Exit status 0 allows the
635 Run before starting a local commit. Exit status 0 allows the
630 commit to proceed. Non-zero status will cause the commit to fail.
636 commit to proceed. Non-zero status will cause the commit to fail.
631 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
637 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
632 ``preoutgoing``
638 ``preoutgoing``
633 Run before collecting changes to send from the local repository to
639 Run before collecting changes to send from the local repository to
634 another. Non-zero status will cause failure. This lets you prevent
640 another. Non-zero status will cause failure. This lets you prevent
635 pull over HTTP or SSH. Also prevents against local pull, push
641 pull over HTTP or SSH. Also prevents against local pull, push
636 (outbound) or bundle commands, but not effective, since you can
642 (outbound) or bundle commands, but not effective, since you can
637 just copy files instead then. Source of operation is in
643 just copy files instead then. Source of operation is in
638 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
644 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
639 SSH or HTTP repository. If "push", "pull" or "bundle", operation
645 SSH or HTTP repository. If "push", "pull" or "bundle", operation
640 is happening on behalf of repository on same system.
646 is happening on behalf of repository on same system.
641 ``pretag``
647 ``pretag``
642 Run before creating a tag. Exit status 0 allows the tag to be
648 Run before creating a tag. Exit status 0 allows the tag to be
643 created. Non-zero status will cause the tag to fail. ID of
649 created. Non-zero status will cause the tag to fail. ID of
644 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
650 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
645 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
651 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
646 ``pretxnchangegroup``
652 ``pretxnchangegroup``
647 Run after a changegroup has been added via push, pull or unbundle,
653 Run after a changegroup has been added via push, pull or unbundle,
648 but before the transaction has been committed. Changegroup is
654 but before the transaction has been committed. Changegroup is
649 visible to hook program. This lets you validate incoming changes
655 visible to hook program. This lets you validate incoming changes
650 before accepting them. Passed the ID of the first new changeset in
656 before accepting them. Passed the ID of the first new changeset in
651 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
657 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
652 status will cause the transaction to be rolled back and the push,
658 status will cause the transaction to be rolled back and the push,
653 pull or unbundle will fail. URL that was source of changes is in
659 pull or unbundle will fail. URL that was source of changes is in
654 ``$HG_URL``.
660 ``$HG_URL``.
655 ``pretxncommit``
661 ``pretxncommit``
656 Run after a changeset has been created but the transaction not yet
662 Run after a changeset has been created but the transaction not yet
657 committed. Changeset is visible to hook program. This lets you
663 committed. Changeset is visible to hook program. This lets you
658 validate commit message and changes. Exit status 0 allows the
664 validate commit message and changes. Exit status 0 allows the
659 commit to proceed. Non-zero status will cause the transaction to
665 commit to proceed. Non-zero status will cause the transaction to
660 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
666 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
661 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
667 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
662 ``preupdate``
668 ``preupdate``
663 Run before updating the working directory. Exit status 0 allows
669 Run before updating the working directory. Exit status 0 allows
664 the update to proceed. Non-zero status will prevent the update.
670 the update to proceed. Non-zero status will prevent the update.
665 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
671 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
666 of second new parent is in ``$HG_PARENT2``.
672 of second new parent is in ``$HG_PARENT2``.
667 ``tag``
673 ``tag``
668 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
674 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
669 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
675 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
670 repository if ``$HG_LOCAL=0``.
676 repository if ``$HG_LOCAL=0``.
671 ``update``
677 ``update``
672 Run after updating the working directory. Changeset ID of first
678 Run after updating the working directory. Changeset ID of first
673 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
679 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
674 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
680 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
675 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
681 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
676
682
677 .. note:: It is generally better to use standard hooks rather than the
683 .. note:: It is generally better to use standard hooks rather than the
678 generic pre- and post- command hooks as they are guaranteed to be
684 generic pre- and post- command hooks as they are guaranteed to be
679 called in the appropriate contexts for influencing transactions.
685 called in the appropriate contexts for influencing transactions.
680 Also, hooks like "commit" will be called in all contexts that
686 Also, hooks like "commit" will be called in all contexts that
681 generate a commit (e.g. tag) and not just the commit command.
687 generate a commit (e.g. tag) and not just the commit command.
682
688
683 .. note:: Environment variables with empty values may not be passed to
689 .. note:: Environment variables with empty values may not be passed to
684 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
690 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
685 will have an empty value under Unix-like platforms for non-merge
691 will have an empty value under Unix-like platforms for non-merge
686 changesets, while it will not be available at all under Windows.
692 changesets, while it will not be available at all under Windows.
687
693
688 The syntax for Python hooks is as follows::
694 The syntax for Python hooks is as follows::
689
695
690 hookname = python:modulename.submodule.callable
696 hookname = python:modulename.submodule.callable
691 hookname = python:/path/to/python/module.py:callable
697 hookname = python:/path/to/python/module.py:callable
692
698
693 Python hooks are run within the Mercurial process. Each hook is
699 Python hooks are run within the Mercurial process. Each hook is
694 called with at least three keyword arguments: a ui object (keyword
700 called with at least three keyword arguments: a ui object (keyword
695 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
701 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
696 keyword that tells what kind of hook is used. Arguments listed as
702 keyword that tells what kind of hook is used. Arguments listed as
697 environment variables above are passed as keyword arguments, with no
703 environment variables above are passed as keyword arguments, with no
698 ``HG_`` prefix, and names in lower case.
704 ``HG_`` prefix, and names in lower case.
699
705
700 If a Python hook returns a "true" value or raises an exception, this
706 If a Python hook returns a "true" value or raises an exception, this
701 is treated as a failure.
707 is treated as a failure.
702
708
703
709
704 ``http_proxy``
710 ``http_proxy``
705 """"""""""""""
711 """"""""""""""
706 Used to access web-based Mercurial repositories through a HTTP
712 Used to access web-based Mercurial repositories through a HTTP
707 proxy.
713 proxy.
708
714
709 ``host``
715 ``host``
710 Host name and (optional) port of the proxy server, for example
716 Host name and (optional) port of the proxy server, for example
711 "myproxy:8000".
717 "myproxy:8000".
712 ``no``
718 ``no``
713 Optional. Comma-separated list of host names that should bypass
719 Optional. Comma-separated list of host names that should bypass
714 the proxy.
720 the proxy.
715 ``passwd``
721 ``passwd``
716 Optional. Password to authenticate with at the proxy server.
722 Optional. Password to authenticate with at the proxy server.
717 ``user``
723 ``user``
718 Optional. User name to authenticate with at the proxy server.
724 Optional. User name to authenticate with at the proxy server.
719 ``always``
725 ``always``
720 Optional. Always use the proxy, even for localhost and any entries
726 Optional. Always use the proxy, even for localhost and any entries
721 in ``http_proxy.no``. True or False. Default: False.
727 in ``http_proxy.no``. True or False. Default: False.
722
728
723 ``smtp``
729 ``smtp``
724 """"""""
730 """"""""
725 Configuration for extensions that need to send email messages.
731 Configuration for extensions that need to send email messages.
726
732
727 ``host``
733 ``host``
728 Host name of mail server, e.g. "mail.example.com".
734 Host name of mail server, e.g. "mail.example.com".
729 ``port``
735 ``port``
730 Optional. Port to connect to on mail server. Default: 25.
736 Optional. Port to connect to on mail server. Default: 25.
731 ``tls``
737 ``tls``
732 Optional. Method to enable TLS when connecting to mail server: starttls,
738 Optional. Method to enable TLS when connecting to mail server: starttls,
733 smtps or none. Default: none.
739 smtps or none. Default: none.
734 ``username``
740 ``username``
735 Optional. User name for authenticating with the SMTP server.
741 Optional. User name for authenticating with the SMTP server.
736 Default: none.
742 Default: none.
737 ``password``
743 ``password``
738 Optional. Password for authenticating with the SMTP server. If not
744 Optional. Password for authenticating with the SMTP server. If not
739 specified, interactive sessions will prompt the user for a
745 specified, interactive sessions will prompt the user for a
740 password; non-interactive sessions will fail. Default: none.
746 password; non-interactive sessions will fail. Default: none.
741 ``local_hostname``
747 ``local_hostname``
742 Optional. It's the hostname that the sender can use to identify
748 Optional. It's the hostname that the sender can use to identify
743 itself to the MTA.
749 itself to the MTA.
744
750
745
751
746 ``patch``
752 ``patch``
747 """""""""
753 """""""""
748 Settings used when applying patches, for instance through the 'import'
754 Settings used when applying patches, for instance through the 'import'
749 command or with Mercurial Queues extension.
755 command or with Mercurial Queues extension.
750
756
751 ``eol``
757 ``eol``
752 When set to 'strict' patch content and patched files end of lines
758 When set to 'strict' patch content and patched files end of lines
753 are preserved. When set to ``lf`` or ``crlf``, both files end of
759 are preserved. When set to ``lf`` or ``crlf``, both files end of
754 lines are ignored when patching and the result line endings are
760 lines are ignored when patching and the result line endings are
755 normalized to either LF (Unix) or CRLF (Windows). When set to
761 normalized to either LF (Unix) or CRLF (Windows). When set to
756 ``auto``, end of lines are again ignored while patching but line
762 ``auto``, end of lines are again ignored while patching but line
757 endings in patched files are normalized to their original setting
763 endings in patched files are normalized to their original setting
758 on a per-file basis. If target file does not exist or has no end
764 on a per-file basis. If target file does not exist or has no end
759 of line, patch line endings are preserved.
765 of line, patch line endings are preserved.
760 Default: strict.
766 Default: strict.
761
767
762
768
763 ``paths``
769 ``paths``
764 """""""""
770 """""""""
765 Assigns symbolic names to repositories. The left side is the
771 Assigns symbolic names to repositories. The left side is the
766 symbolic name, and the right gives the directory or URL that is the
772 symbolic name, and the right gives the directory or URL that is the
767 location of the repository. Default paths can be declared by setting
773 location of the repository. Default paths can be declared by setting
768 the following entries.
774 the following entries.
769
775
770 ``default``
776 ``default``
771 Directory or URL to use when pulling if no source is specified.
777 Directory or URL to use when pulling if no source is specified.
772 Default is set to repository from which the current repository was
778 Default is set to repository from which the current repository was
773 cloned.
779 cloned.
774 ``default-push``
780 ``default-push``
775 Optional. Directory or URL to use when pushing if no destination
781 Optional. Directory or URL to use when pushing if no destination
776 is specified.
782 is specified.
777
783
778
784
779 ``profiling``
785 ``profiling``
780 """""""""""""
786 """""""""""""
781 Specifies profiling format and file output. In this section
787 Specifies profiling format and file output. In this section
782 description, 'profiling data' stands for the raw data collected
788 description, 'profiling data' stands for the raw data collected
783 during profiling, while 'profiling report' stands for a statistical
789 during profiling, while 'profiling report' stands for a statistical
784 text report generated from the profiling data. The profiling is done
790 text report generated from the profiling data. The profiling is done
785 using lsprof.
791 using lsprof.
786
792
787 ``format``
793 ``format``
788 Profiling format.
794 Profiling format.
789 Default: text.
795 Default: text.
790
796
791 ``text``
797 ``text``
792 Generate a profiling report. When saving to a file, it should be
798 Generate a profiling report. When saving to a file, it should be
793 noted that only the report is saved, and the profiling data is
799 noted that only the report is saved, and the profiling data is
794 not kept.
800 not kept.
795 ``kcachegrind``
801 ``kcachegrind``
796 Format profiling data for kcachegrind use: when saving to a
802 Format profiling data for kcachegrind use: when saving to a
797 file, the generated file can directly be loaded into
803 file, the generated file can directly be loaded into
798 kcachegrind.
804 kcachegrind.
799 ``output``
805 ``output``
800 File path where profiling data or report should be saved. If the
806 File path where profiling data or report should be saved. If the
801 file exists, it is replaced. Default: None, data is printed on
807 file exists, it is replaced. Default: None, data is printed on
802 stderr
808 stderr
803
809
804 ``server``
810 ``server``
805 """"""""""
811 """"""""""
806 Controls generic server settings.
812 Controls generic server settings.
807
813
808 ``uncompressed``
814 ``uncompressed``
809 Whether to allow clients to clone a repository using the
815 Whether to allow clients to clone a repository using the
810 uncompressed streaming protocol. This transfers about 40% more
816 uncompressed streaming protocol. This transfers about 40% more
811 data than a regular clone, but uses less memory and CPU on both
817 data than a regular clone, but uses less memory and CPU on both
812 server and client. Over a LAN (100 Mbps or better) or a very fast
818 server and client. Over a LAN (100 Mbps or better) or a very fast
813 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
819 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
814 regular clone. Over most WAN connections (anything slower than
820 regular clone. Over most WAN connections (anything slower than
815 about 6 Mbps), uncompressed streaming is slower, because of the
821 about 6 Mbps), uncompressed streaming is slower, because of the
816 extra data transfer overhead. This mode will also temporarily hold
822 extra data transfer overhead. This mode will also temporarily hold
817 the write lock while determining what data to transfer.
823 the write lock while determining what data to transfer.
818 Default is True.
824 Default is True.
819
825
820 ``validate``
826 ``validate``
821 Whether to validate the completeness of pushed changesets by
827 Whether to validate the completeness of pushed changesets by
822 checking that all new file revisions specified in manifests are
828 checking that all new file revisions specified in manifests are
823 present. Default is False.
829 present. Default is False.
824
830
825 ``subpaths``
831 ``subpaths``
826 """"""""""""
832 """"""""""""
827 Defines subrepositories source locations rewriting rules of the form::
833 Defines subrepositories source locations rewriting rules of the form::
828
834
829 <pattern> = <replacement>
835 <pattern> = <replacement>
830
836
831 Where ``pattern`` is a regular expression matching the source and
837 Where ``pattern`` is a regular expression matching the source and
832 ``replacement`` is the replacement string used to rewrite it. Groups
838 ``replacement`` is the replacement string used to rewrite it. Groups
833 can be matched in ``pattern`` and referenced in ``replacements``. For
839 can be matched in ``pattern`` and referenced in ``replacements``. For
834 instance::
840 instance::
835
841
836 http://server/(.*)-hg/ = http://hg.server/\1/
842 http://server/(.*)-hg/ = http://hg.server/\1/
837
843
838 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
844 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
839
845
840 All patterns are applied in definition order.
846 All patterns are applied in definition order.
841
847
842 ``trusted``
848 ``trusted``
843 """""""""""
849 """""""""""
844
850
845 Mercurial will not use the settings in the
851 Mercurial will not use the settings in the
846 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
852 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
847 user or to a trusted group, as various hgrc features allow arbitrary
853 user or to a trusted group, as various hgrc features allow arbitrary
848 commands to be run. This issue is often encountered when configuring
854 commands to be run. This issue is often encountered when configuring
849 hooks or extensions for shared repositories or servers. However,
855 hooks or extensions for shared repositories or servers. However,
850 the web interface will use some safe settings from the ``[web]``
856 the web interface will use some safe settings from the ``[web]``
851 section.
857 section.
852
858
853 This section specifies what users and groups are trusted. The
859 This section specifies what users and groups are trusted. The
854 current user is always trusted. To trust everybody, list a user or a
860 current user is always trusted. To trust everybody, list a user or a
855 group with name ``*``. These settings must be placed in an
861 group with name ``*``. These settings must be placed in an
856 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
862 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
857 user or service running Mercurial.
863 user or service running Mercurial.
858
864
859 ``users``
865 ``users``
860 Comma-separated list of trusted users.
866 Comma-separated list of trusted users.
861 ``groups``
867 ``groups``
862 Comma-separated list of trusted groups.
868 Comma-separated list of trusted groups.
863
869
864
870
865 ``ui``
871 ``ui``
866 """"""
872 """"""
867
873
868 User interface controls.
874 User interface controls.
869
875
870 ``archivemeta``
876 ``archivemeta``
871 Whether to include the .hg_archival.txt file containing meta data
877 Whether to include the .hg_archival.txt file containing meta data
872 (hashes for the repository base and for tip) in archives created
878 (hashes for the repository base and for tip) in archives created
873 by the :hg:`archive` command or downloaded via hgweb.
879 by the :hg:`archive` command or downloaded via hgweb.
874 Default is True.
880 Default is True.
875 ``askusername``
881 ``askusername``
876 Whether to prompt for a username when committing. If True, and
882 Whether to prompt for a username when committing. If True, and
877 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
883 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
878 be prompted to enter a username. If no username is entered, the
884 be prompted to enter a username. If no username is entered, the
879 default ``USER@HOST`` is used instead.
885 default ``USER@HOST`` is used instead.
880 Default is False.
886 Default is False.
881 ``commitsubrepos``
887 ``commitsubrepos``
882 Whether to commit modified subrepositories when committing the
888 Whether to commit modified subrepositories when committing the
883 parent repository. If False and one subrepository has uncommitted
889 parent repository. If False and one subrepository has uncommitted
884 changes, abort the commit.
890 changes, abort the commit.
885 Default is True.
891 Default is True.
886 ``debug``
892 ``debug``
887 Print debugging information. True or False. Default is False.
893 Print debugging information. True or False. Default is False.
888 ``editor``
894 ``editor``
889 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
895 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
890 ``fallbackencoding``
896 ``fallbackencoding``
891 Encoding to try if it's not possible to decode the changelog using
897 Encoding to try if it's not possible to decode the changelog using
892 UTF-8. Default is ISO-8859-1.
898 UTF-8. Default is ISO-8859-1.
893 ``ignore``
899 ``ignore``
894 A file to read per-user ignore patterns from. This file should be
900 A file to read per-user ignore patterns from. This file should be
895 in the same format as a repository-wide .hgignore file. This
901 in the same format as a repository-wide .hgignore file. This
896 option supports hook syntax, so if you want to specify multiple
902 option supports hook syntax, so if you want to specify multiple
897 ignore files, you can do so by setting something like
903 ignore files, you can do so by setting something like
898 ``ignore.other = ~/.hgignore2``. For details of the ignore file
904 ``ignore.other = ~/.hgignore2``. For details of the ignore file
899 format, see the |hgignore(5)|_ man page.
905 format, see the |hgignore(5)|_ man page.
900 ``interactive``
906 ``interactive``
901 Allow to prompt the user. True or False. Default is True.
907 Allow to prompt the user. True or False. Default is True.
902 ``logtemplate``
908 ``logtemplate``
903 Template string for commands that print changesets.
909 Template string for commands that print changesets.
904 ``merge``
910 ``merge``
905 The conflict resolution program to use during a manual merge.
911 The conflict resolution program to use during a manual merge.
906 For more information on merge tools see :hg:`help merge-tools`.
912 For more information on merge tools see :hg:`help merge-tools`.
907 For configuring merge tools see the merge-tools_ section.
913 For configuring merge tools see the merge-tools_ section.
908 ``patch``
914 ``patch``
909 command to use to apply patches. Look for ``gpatch`` or ``patch`` in
915 command to use to apply patches. Look for ``gpatch`` or ``patch`` in
910 PATH if unset.
916 PATH if unset.
911 ``quiet``
917 ``quiet``
912 Reduce the amount of output printed. True or False. Default is False.
918 Reduce the amount of output printed. True or False. Default is False.
913 ``remotecmd``
919 ``remotecmd``
914 remote command to use for clone/push/pull operations. Default is ``hg``.
920 remote command to use for clone/push/pull operations. Default is ``hg``.
915 ``report_untrusted``
921 ``report_untrusted``
916 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
922 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
917 trusted user or group. True or False. Default is True.
923 trusted user or group. True or False. Default is True.
918 ``slash``
924 ``slash``
919 Display paths using a slash (``/``) as the path separator. This
925 Display paths using a slash (``/``) as the path separator. This
920 only makes a difference on systems where the default path
926 only makes a difference on systems where the default path
921 separator is not the slash character (e.g. Windows uses the
927 separator is not the slash character (e.g. Windows uses the
922 backslash character (``\``)).
928 backslash character (``\``)).
923 Default is False.
929 Default is False.
924 ``ssh``
930 ``ssh``
925 command to use for SSH connections. Default is ``ssh``.
931 command to use for SSH connections. Default is ``ssh``.
926 ``strict``
932 ``strict``
927 Require exact command names, instead of allowing unambiguous
933 Require exact command names, instead of allowing unambiguous
928 abbreviations. True or False. Default is False.
934 abbreviations. True or False. Default is False.
929 ``style``
935 ``style``
930 Name of style to use for command output.
936 Name of style to use for command output.
931 ``timeout``
937 ``timeout``
932 The timeout used when a lock is held (in seconds), a negative value
938 The timeout used when a lock is held (in seconds), a negative value
933 means no timeout. Default is 600.
939 means no timeout. Default is 600.
934 ``traceback``
940 ``traceback``
935 Mercurial always prints a traceback when an unknown exception
941 Mercurial always prints a traceback when an unknown exception
936 occurs. Setting this to True will make Mercurial print a traceback
942 occurs. Setting this to True will make Mercurial print a traceback
937 on all exceptions, even those recognized by Mercurial (such as
943 on all exceptions, even those recognized by Mercurial (such as
938 IOError or MemoryError). Default is False.
944 IOError or MemoryError). Default is False.
939 ``username``
945 ``username``
940 The committer of a changeset created when running "commit".
946 The committer of a changeset created when running "commit".
941 Typically a person's name and email address, e.g. ``Fred Widget
947 Typically a person's name and email address, e.g. ``Fred Widget
942 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
948 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
943 the username in hgrc is empty, it has to be specified manually or
949 the username in hgrc is empty, it has to be specified manually or
944 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
950 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
945 ``username =`` in the system hgrc). Environment variables in the
951 ``username =`` in the system hgrc). Environment variables in the
946 username are expanded.
952 username are expanded.
947 ``verbose``
953 ``verbose``
948 Increase the amount of output printed. True or False. Default is False.
954 Increase the amount of output printed. True or False. Default is False.
949
955
950
956
951 ``web``
957 ``web``
952 """""""
958 """""""
953
959
954 Web interface configuration. The settings in this section apply to
960 Web interface configuration. The settings in this section apply to
955 both the builtin webserver (started by :hg:`serve`) and the script you
961 both the builtin webserver (started by :hg:`serve`) and the script you
956 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
962 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
957 and WSGI).
963 and WSGI).
958
964
959 The Mercurial webserver does no authentication (it does not prompt for
965 The Mercurial webserver does no authentication (it does not prompt for
960 usernames and passwords to validate *who* users are), but it does do
966 usernames and passwords to validate *who* users are), but it does do
961 authorization (it grants or denies access for *authenticated users*
967 authorization (it grants or denies access for *authenticated users*
962 based on settings in this section). You must either configure your
968 based on settings in this section). You must either configure your
963 webserver to do authentication for you, or disable the authorization
969 webserver to do authentication for you, or disable the authorization
964 checks.
970 checks.
965
971
966 For a quick setup in a trusted environment, e.g., a private LAN, where
972 For a quick setup in a trusted environment, e.g., a private LAN, where
967 you want it to accept pushes from anybody, you can use the following
973 you want it to accept pushes from anybody, you can use the following
968 command line::
974 command line::
969
975
970 $ hg --config web.allow_push=* --config web.push_ssl=False serve
976 $ hg --config web.allow_push=* --config web.push_ssl=False serve
971
977
972 Note that this will allow anybody to push anything to the server and
978 Note that this will allow anybody to push anything to the server and
973 that this should not be used for public servers.
979 that this should not be used for public servers.
974
980
975 The full set of options is:
981 The full set of options is:
976
982
977 ``accesslog``
983 ``accesslog``
978 Where to output the access log. Default is stdout.
984 Where to output the access log. Default is stdout.
979 ``address``
985 ``address``
980 Interface address to bind to. Default is all.
986 Interface address to bind to. Default is all.
981 ``allow_archive``
987 ``allow_archive``
982 List of archive format (bz2, gz, zip) allowed for downloading.
988 List of archive format (bz2, gz, zip) allowed for downloading.
983 Default is empty.
989 Default is empty.
984 ``allowbz2``
990 ``allowbz2``
985 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
991 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
986 revisions.
992 revisions.
987 Default is False.
993 Default is False.
988 ``allowgz``
994 ``allowgz``
989 (DEPRECATED) Whether to allow .tar.gz downloading of repository
995 (DEPRECATED) Whether to allow .tar.gz downloading of repository
990 revisions.
996 revisions.
991 Default is False.
997 Default is False.
992 ``allowpull``
998 ``allowpull``
993 Whether to allow pulling from the repository. Default is True.
999 Whether to allow pulling from the repository. Default is True.
994 ``allow_push``
1000 ``allow_push``
995 Whether to allow pushing to the repository. If empty or not set,
1001 Whether to allow pushing to the repository. If empty or not set,
996 push is not allowed. If the special value ``*``, any remote user can
1002 push is not allowed. If the special value ``*``, any remote user can
997 push, including unauthenticated users. Otherwise, the remote user
1003 push, including unauthenticated users. Otherwise, the remote user
998 must have been authenticated, and the authenticated user name must
1004 must have been authenticated, and the authenticated user name must
999 be present in this list. The contents of the allow_push list are
1005 be present in this list. The contents of the allow_push list are
1000 examined after the deny_push list.
1006 examined after the deny_push list.
1001 ``allow_read``
1007 ``allow_read``
1002 If the user has not already been denied repository access due to
1008 If the user has not already been denied repository access due to
1003 the contents of deny_read, this list determines whether to grant
1009 the contents of deny_read, this list determines whether to grant
1004 repository access to the user. If this list is not empty, and the
1010 repository access to the user. If this list is not empty, and the
1005 user is unauthenticated or not present in the list, then access is
1011 user is unauthenticated or not present in the list, then access is
1006 denied for the user. If the list is empty or not set, then access
1012 denied for the user. If the list is empty or not set, then access
1007 is permitted to all users by default. Setting allow_read to the
1013 is permitted to all users by default. Setting allow_read to the
1008 special value ``*`` is equivalent to it not being set (i.e. access
1014 special value ``*`` is equivalent to it not being set (i.e. access
1009 is permitted to all users). The contents of the allow_read list are
1015 is permitted to all users). The contents of the allow_read list are
1010 examined after the deny_read list.
1016 examined after the deny_read list.
1011 ``allowzip``
1017 ``allowzip``
1012 (DEPRECATED) Whether to allow .zip downloading of repository
1018 (DEPRECATED) Whether to allow .zip downloading of repository
1013 revisions. Default is False. This feature creates temporary files.
1019 revisions. Default is False. This feature creates temporary files.
1014 ``baseurl``
1020 ``baseurl``
1015 Base URL to use when publishing URLs in other locations, so
1021 Base URL to use when publishing URLs in other locations, so
1016 third-party tools like email notification hooks can construct
1022 third-party tools like email notification hooks can construct
1017 URLs. Example: ``http://hgserver/repos/``.
1023 URLs. Example: ``http://hgserver/repos/``.
1018 ``cacerts``
1024 ``cacerts``
1019 Path to file containing a list of PEM encoded certificate
1025 Path to file containing a list of PEM encoded certificate
1020 authority certificates. Environment variables and ``~user``
1026 authority certificates. Environment variables and ``~user``
1021 constructs are expanded in the filename. If specified on the
1027 constructs are expanded in the filename. If specified on the
1022 client, then it will verify the identity of remote HTTPS servers
1028 client, then it will verify the identity of remote HTTPS servers
1023 with these certificates. The form must be as follows::
1029 with these certificates. The form must be as follows::
1024
1030
1025 -----BEGIN CERTIFICATE-----
1031 -----BEGIN CERTIFICATE-----
1026 ... (certificate in base64 PEM encoding) ...
1032 ... (certificate in base64 PEM encoding) ...
1027 -----END CERTIFICATE-----
1033 -----END CERTIFICATE-----
1028 -----BEGIN CERTIFICATE-----
1034 -----BEGIN CERTIFICATE-----
1029 ... (certificate in base64 PEM encoding) ...
1035 ... (certificate in base64 PEM encoding) ...
1030 -----END CERTIFICATE-----
1036 -----END CERTIFICATE-----
1031
1037
1032 This feature is only supported when using Python 2.6 or later. If you wish
1038 This feature is only supported when using Python 2.6 or later. If you wish
1033 to use it with earlier versions of Python, install the backported
1039 to use it with earlier versions of Python, install the backported
1034 version of the ssl library that is available from
1040 version of the ssl library that is available from
1035 ``http://pypi.python.org``.
1041 ``http://pypi.python.org``.
1036
1042
1037 You can use OpenSSL's CA certificate file if your platform has one.
1043 You can use OpenSSL's CA certificate file if your platform has one.
1038 On most Linux systems this will be ``/etc/ssl/certs/ca-certificates.crt``.
1044 On most Linux systems this will be ``/etc/ssl/certs/ca-certificates.crt``.
1039 Otherwise you will have to generate this file manually.
1045 Otherwise you will have to generate this file manually.
1040
1046
1041 To disable SSL verification temporarily, specify ``--insecure`` from
1047 To disable SSL verification temporarily, specify ``--insecure`` from
1042 command line.
1048 command line.
1043 ``contact``
1049 ``contact``
1044 Name or email address of the person in charge of the repository.
1050 Name or email address of the person in charge of the repository.
1045 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1051 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1046 ``deny_push``
1052 ``deny_push``
1047 Whether to deny pushing to the repository. If empty or not set,
1053 Whether to deny pushing to the repository. If empty or not set,
1048 push is not denied. If the special value ``*``, all remote users are
1054 push is not denied. If the special value ``*``, all remote users are
1049 denied push. Otherwise, unauthenticated users are all denied, and
1055 denied push. Otherwise, unauthenticated users are all denied, and
1050 any authenticated user name present in this list is also denied. The
1056 any authenticated user name present in this list is also denied. The
1051 contents of the deny_push list are examined before the allow_push list.
1057 contents of the deny_push list are examined before the allow_push list.
1052 ``deny_read``
1058 ``deny_read``
1053 Whether to deny reading/viewing of the repository. If this list is
1059 Whether to deny reading/viewing of the repository. If this list is
1054 not empty, unauthenticated users are all denied, and any
1060 not empty, unauthenticated users are all denied, and any
1055 authenticated user name present in this list is also denied access to
1061 authenticated user name present in this list is also denied access to
1056 the repository. If set to the special value ``*``, all remote users
1062 the repository. If set to the special value ``*``, all remote users
1057 are denied access (rarely needed ;). If deny_read is empty or not set,
1063 are denied access (rarely needed ;). If deny_read is empty or not set,
1058 the determination of repository access depends on the presence and
1064 the determination of repository access depends on the presence and
1059 content of the allow_read list (see description). If both
1065 content of the allow_read list (see description). If both
1060 deny_read and allow_read are empty or not set, then access is
1066 deny_read and allow_read are empty or not set, then access is
1061 permitted to all users by default. If the repository is being
1067 permitted to all users by default. If the repository is being
1062 served via hgwebdir, denied users will not be able to see it in
1068 served via hgwebdir, denied users will not be able to see it in
1063 the list of repositories. The contents of the deny_read list have
1069 the list of repositories. The contents of the deny_read list have
1064 priority over (are examined before) the contents of the allow_read
1070 priority over (are examined before) the contents of the allow_read
1065 list.
1071 list.
1066 ``descend``
1072 ``descend``
1067 hgwebdir indexes will not descend into subdirectories. Only repositories
1073 hgwebdir indexes will not descend into subdirectories. Only repositories
1068 directly in the current path will be shown (other repositories are still
1074 directly in the current path will be shown (other repositories are still
1069 available from the index corresponding to their containing path).
1075 available from the index corresponding to their containing path).
1070 ``description``
1076 ``description``
1071 Textual description of the repository's purpose or contents.
1077 Textual description of the repository's purpose or contents.
1072 Default is "unknown".
1078 Default is "unknown".
1073 ``encoding``
1079 ``encoding``
1074 Character encoding name. Default is the current locale charset.
1080 Character encoding name. Default is the current locale charset.
1075 Example: "UTF-8"
1081 Example: "UTF-8"
1076 ``errorlog``
1082 ``errorlog``
1077 Where to output the error log. Default is stderr.
1083 Where to output the error log. Default is stderr.
1078 ``hidden``
1084 ``hidden``
1079 Whether to hide the repository in the hgwebdir index.
1085 Whether to hide the repository in the hgwebdir index.
1080 Default is False.
1086 Default is False.
1081 ``ipv6``
1087 ``ipv6``
1082 Whether to use IPv6. Default is False.
1088 Whether to use IPv6. Default is False.
1083 ``name``
1089 ``name``
1084 Repository name to use in the web interface. Default is current
1090 Repository name to use in the web interface. Default is current
1085 working directory.
1091 working directory.
1086 ``maxchanges``
1092 ``maxchanges``
1087 Maximum number of changes to list on the changelog. Default is 10.
1093 Maximum number of changes to list on the changelog. Default is 10.
1088 ``maxfiles``
1094 ``maxfiles``
1089 Maximum number of files to list per changeset. Default is 10.
1095 Maximum number of files to list per changeset. Default is 10.
1090 ``port``
1096 ``port``
1091 Port to listen on. Default is 8000.
1097 Port to listen on. Default is 8000.
1092 ``prefix``
1098 ``prefix``
1093 Prefix path to serve from. Default is '' (server root).
1099 Prefix path to serve from. Default is '' (server root).
1094 ``push_ssl``
1100 ``push_ssl``
1095 Whether to require that inbound pushes be transported over SSL to
1101 Whether to require that inbound pushes be transported over SSL to
1096 prevent password sniffing. Default is True.
1102 prevent password sniffing. Default is True.
1097 ``staticurl``
1103 ``staticurl``
1098 Base URL to use for static files. If unset, static files (e.g. the
1104 Base URL to use for static files. If unset, static files (e.g. the
1099 hgicon.png favicon) will be served by the CGI script itself. Use
1105 hgicon.png favicon) will be served by the CGI script itself. Use
1100 this setting to serve them directly with the HTTP server.
1106 this setting to serve them directly with the HTTP server.
1101 Example: ``http://hgserver/static/``.
1107 Example: ``http://hgserver/static/``.
1102 ``stripes``
1108 ``stripes``
1103 How many lines a "zebra stripe" should span in multiline output.
1109 How many lines a "zebra stripe" should span in multiline output.
1104 Default is 1; set to 0 to disable.
1110 Default is 1; set to 0 to disable.
1105 ``style``
1111 ``style``
1106 Which template map style to use.
1112 Which template map style to use.
1107 ``templates``
1113 ``templates``
1108 Where to find the HTML templates. Default is install path.
1114 Where to find the HTML templates. Default is install path.
1109
1115
1110
1116
1111 Author
1117 Author
1112 ------
1118 ------
1113 Bryan O'Sullivan <bos@serpentine.com>.
1119 Bryan O'Sullivan <bos@serpentine.com>.
1114
1120
1115 Mercurial was written by Matt Mackall <mpm@selenic.com>.
1121 Mercurial was written by Matt Mackall <mpm@selenic.com>.
1116
1122
1117 See Also
1123 See Also
1118 --------
1124 --------
1119 |hg(1)|_, |hgignore(5)|_
1125 |hg(1)|_, |hgignore(5)|_
1120
1126
1121 Copying
1127 Copying
1122 -------
1128 -------
1123 This manual page is copyright 2005 Bryan O'Sullivan.
1129 This manual page is copyright 2005 Bryan O'Sullivan.
1124 Mercurial is copyright 2005-2010 Matt Mackall.
1130 Mercurial is copyright 2005-2010 Matt Mackall.
1125 Free use of this software is granted under the terms of the GNU General
1131 Free use of this software is granted under the terms of the GNU General
1126 Public License version 2 or any later version.
1132 Public License version 2 or any later version.
1127
1133
1128 .. include:: common.txt
1134 .. include:: common.txt
@@ -1,267 +1,269
1 # filemerge.py - file-level merge handling for Mercurial
1 # filemerge.py - file-level merge handling for Mercurial
2 #
2 #
3 # Copyright 2006, 2007, 2008 Matt Mackall <mpm@selenic.com>
3 # Copyright 2006, 2007, 2008 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 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from node import short
8 from node import short
9 from i18n import _
9 from i18n import _
10 import util, simplemerge, match, error
10 import util, simplemerge, match, error
11 import os, tempfile, re, filecmp
11 import os, tempfile, re, filecmp
12
12
13 def _toolstr(ui, tool, part, default=""):
13 def _toolstr(ui, tool, part, default=""):
14 return ui.config("merge-tools", tool + "." + part, default)
14 return ui.config("merge-tools", tool + "." + part, default)
15
15
16 def _toolbool(ui, tool, part, default=False):
16 def _toolbool(ui, tool, part, default=False):
17 return ui.configbool("merge-tools", tool + "." + part, default)
17 return ui.configbool("merge-tools", tool + "." + part, default)
18
18
19 def _toollist(ui, tool, part, default=[]):
19 def _toollist(ui, tool, part, default=[]):
20 return ui.configlist("merge-tools", tool + "." + part, default)
20 return ui.configlist("merge-tools", tool + "." + part, default)
21
21
22 _internal = ['internal:' + s
22 _internal = ['internal:' + s
23 for s in 'fail local other merge prompt dump'.split()]
23 for s in 'fail local other merge prompt dump'.split()]
24
24
25 def _findtool(ui, tool):
25 def _findtool(ui, tool):
26 if tool in _internal:
26 if tool in _internal:
27 return tool
27 return tool
28 k = _toolstr(ui, tool, "regkey")
28 for kn in ("regkey", "regkeyalt"):
29 if k:
29 k = _toolstr(ui, tool, kn)
30 if not k:
31 continue
30 p = util.lookup_reg(k, _toolstr(ui, tool, "regname"))
32 p = util.lookup_reg(k, _toolstr(ui, tool, "regname"))
31 if p:
33 if p:
32 p = util.find_exe(p + _toolstr(ui, tool, "regappend"))
34 p = util.find_exe(p + _toolstr(ui, tool, "regappend"))
33 if p:
35 if p:
34 return p
36 return p
35 return util.find_exe(_toolstr(ui, tool, "executable", tool))
37 return util.find_exe(_toolstr(ui, tool, "executable", tool))
36
38
37 def _picktool(repo, ui, path, binary, symlink):
39 def _picktool(repo, ui, path, binary, symlink):
38 def check(tool, pat, symlink, binary):
40 def check(tool, pat, symlink, binary):
39 tmsg = tool
41 tmsg = tool
40 if pat:
42 if pat:
41 tmsg += " specified for " + pat
43 tmsg += " specified for " + pat
42 if not _findtool(ui, tool):
44 if not _findtool(ui, tool):
43 if pat: # explicitly requested tool deserves a warning
45 if pat: # explicitly requested tool deserves a warning
44 ui.warn(_("couldn't find merge tool %s\n") % tmsg)
46 ui.warn(_("couldn't find merge tool %s\n") % tmsg)
45 else: # configured but non-existing tools are more silent
47 else: # configured but non-existing tools are more silent
46 ui.note(_("couldn't find merge tool %s\n") % tmsg)
48 ui.note(_("couldn't find merge tool %s\n") % tmsg)
47 elif symlink and not _toolbool(ui, tool, "symlink"):
49 elif symlink and not _toolbool(ui, tool, "symlink"):
48 ui.warn(_("tool %s can't handle symlinks\n") % tmsg)
50 ui.warn(_("tool %s can't handle symlinks\n") % tmsg)
49 elif binary and not _toolbool(ui, tool, "binary"):
51 elif binary and not _toolbool(ui, tool, "binary"):
50 ui.warn(_("tool %s can't handle binary\n") % tmsg)
52 ui.warn(_("tool %s can't handle binary\n") % tmsg)
51 elif not util.gui() and _toolbool(ui, tool, "gui"):
53 elif not util.gui() and _toolbool(ui, tool, "gui"):
52 ui.warn(_("tool %s requires a GUI\n") % tmsg)
54 ui.warn(_("tool %s requires a GUI\n") % tmsg)
53 else:
55 else:
54 return True
56 return True
55 return False
57 return False
56
58
57 # forcemerge comes from command line arguments, highest priority
59 # forcemerge comes from command line arguments, highest priority
58 force = ui.config('ui', 'forcemerge')
60 force = ui.config('ui', 'forcemerge')
59 if force:
61 if force:
60 toolpath = _findtool(ui, force)
62 toolpath = _findtool(ui, force)
61 if toolpath:
63 if toolpath:
62 return (force, '"' + toolpath + '"')
64 return (force, '"' + toolpath + '"')
63 else:
65 else:
64 # mimic HGMERGE if given tool not found
66 # mimic HGMERGE if given tool not found
65 return (force, force)
67 return (force, force)
66
68
67 # HGMERGE takes next precedence
69 # HGMERGE takes next precedence
68 hgmerge = os.environ.get("HGMERGE")
70 hgmerge = os.environ.get("HGMERGE")
69 if hgmerge:
71 if hgmerge:
70 return (hgmerge, hgmerge)
72 return (hgmerge, hgmerge)
71
73
72 # then patterns
74 # then patterns
73 for pat, tool in ui.configitems("merge-patterns"):
75 for pat, tool in ui.configitems("merge-patterns"):
74 mf = match.match(repo.root, '', [pat])
76 mf = match.match(repo.root, '', [pat])
75 if mf(path) and check(tool, pat, symlink, False):
77 if mf(path) and check(tool, pat, symlink, False):
76 toolpath = _findtool(ui, tool)
78 toolpath = _findtool(ui, tool)
77 return (tool, '"' + toolpath + '"')
79 return (tool, '"' + toolpath + '"')
78
80
79 # then merge tools
81 # then merge tools
80 tools = {}
82 tools = {}
81 for k, v in ui.configitems("merge-tools"):
83 for k, v in ui.configitems("merge-tools"):
82 t = k.split('.')[0]
84 t = k.split('.')[0]
83 if t not in tools:
85 if t not in tools:
84 tools[t] = int(_toolstr(ui, t, "priority", "0"))
86 tools[t] = int(_toolstr(ui, t, "priority", "0"))
85 names = tools.keys()
87 names = tools.keys()
86 tools = sorted([(-p, t) for t, p in tools.items()])
88 tools = sorted([(-p, t) for t, p in tools.items()])
87 uimerge = ui.config("ui", "merge")
89 uimerge = ui.config("ui", "merge")
88 if uimerge:
90 if uimerge:
89 if uimerge not in names:
91 if uimerge not in names:
90 return (uimerge, uimerge)
92 return (uimerge, uimerge)
91 tools.insert(0, (None, uimerge)) # highest priority
93 tools.insert(0, (None, uimerge)) # highest priority
92 tools.append((None, "hgmerge")) # the old default, if found
94 tools.append((None, "hgmerge")) # the old default, if found
93 for p, t in tools:
95 for p, t in tools:
94 if check(t, None, symlink, binary):
96 if check(t, None, symlink, binary):
95 toolpath = _findtool(ui, t)
97 toolpath = _findtool(ui, t)
96 return (t, '"' + toolpath + '"')
98 return (t, '"' + toolpath + '"')
97 # internal merge as last resort
99 # internal merge as last resort
98 return (not (symlink or binary) and "internal:merge" or None, None)
100 return (not (symlink or binary) and "internal:merge" or None, None)
99
101
100 def _eoltype(data):
102 def _eoltype(data):
101 "Guess the EOL type of a file"
103 "Guess the EOL type of a file"
102 if '\0' in data: # binary
104 if '\0' in data: # binary
103 return None
105 return None
104 if '\r\n' in data: # Windows
106 if '\r\n' in data: # Windows
105 return '\r\n'
107 return '\r\n'
106 if '\r' in data: # Old Mac
108 if '\r' in data: # Old Mac
107 return '\r'
109 return '\r'
108 if '\n' in data: # UNIX
110 if '\n' in data: # UNIX
109 return '\n'
111 return '\n'
110 return None # unknown
112 return None # unknown
111
113
112 def _matcheol(file, origfile):
114 def _matcheol(file, origfile):
113 "Convert EOL markers in a file to match origfile"
115 "Convert EOL markers in a file to match origfile"
114 tostyle = _eoltype(open(origfile, "rb").read())
116 tostyle = _eoltype(open(origfile, "rb").read())
115 if tostyle:
117 if tostyle:
116 data = open(file, "rb").read()
118 data = open(file, "rb").read()
117 style = _eoltype(data)
119 style = _eoltype(data)
118 if style:
120 if style:
119 newdata = data.replace(style, tostyle)
121 newdata = data.replace(style, tostyle)
120 if newdata != data:
122 if newdata != data:
121 open(file, "wb").write(newdata)
123 open(file, "wb").write(newdata)
122
124
123 def filemerge(repo, mynode, orig, fcd, fco, fca):
125 def filemerge(repo, mynode, orig, fcd, fco, fca):
124 """perform a 3-way merge in the working directory
126 """perform a 3-way merge in the working directory
125
127
126 mynode = parent node before merge
128 mynode = parent node before merge
127 orig = original local filename before merge
129 orig = original local filename before merge
128 fco = other file context
130 fco = other file context
129 fca = ancestor file context
131 fca = ancestor file context
130 fcd = local file context for current/destination file
132 fcd = local file context for current/destination file
131 """
133 """
132
134
133 def temp(prefix, ctx):
135 def temp(prefix, ctx):
134 pre = "%s~%s." % (os.path.basename(ctx.path()), prefix)
136 pre = "%s~%s." % (os.path.basename(ctx.path()), prefix)
135 (fd, name) = tempfile.mkstemp(prefix=pre)
137 (fd, name) = tempfile.mkstemp(prefix=pre)
136 data = repo.wwritedata(ctx.path(), ctx.data())
138 data = repo.wwritedata(ctx.path(), ctx.data())
137 f = os.fdopen(fd, "wb")
139 f = os.fdopen(fd, "wb")
138 f.write(data)
140 f.write(data)
139 f.close()
141 f.close()
140 return name
142 return name
141
143
142 def isbin(ctx):
144 def isbin(ctx):
143 try:
145 try:
144 return util.binary(ctx.data())
146 return util.binary(ctx.data())
145 except IOError:
147 except IOError:
146 return False
148 return False
147
149
148 if not fco.cmp(fcd): # files identical?
150 if not fco.cmp(fcd): # files identical?
149 return None
151 return None
150
152
151 ui = repo.ui
153 ui = repo.ui
152 fd = fcd.path()
154 fd = fcd.path()
153 binary = isbin(fcd) or isbin(fco) or isbin(fca)
155 binary = isbin(fcd) or isbin(fco) or isbin(fca)
154 symlink = 'l' in fcd.flags() + fco.flags()
156 symlink = 'l' in fcd.flags() + fco.flags()
155 tool, toolpath = _picktool(repo, ui, fd, binary, symlink)
157 tool, toolpath = _picktool(repo, ui, fd, binary, symlink)
156 ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" %
158 ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" %
157 (tool, fd, binary, symlink))
159 (tool, fd, binary, symlink))
158
160
159 if not tool or tool == 'internal:prompt':
161 if not tool or tool == 'internal:prompt':
160 tool = "internal:local"
162 tool = "internal:local"
161 if ui.promptchoice(_(" no tool found to merge %s\n"
163 if ui.promptchoice(_(" no tool found to merge %s\n"
162 "keep (l)ocal or take (o)ther?") % fd,
164 "keep (l)ocal or take (o)ther?") % fd,
163 (_("&Local"), _("&Other")), 0):
165 (_("&Local"), _("&Other")), 0):
164 tool = "internal:other"
166 tool = "internal:other"
165 if tool == "internal:local":
167 if tool == "internal:local":
166 return 0
168 return 0
167 if tool == "internal:other":
169 if tool == "internal:other":
168 repo.wwrite(fd, fco.data(), fco.flags())
170 repo.wwrite(fd, fco.data(), fco.flags())
169 return 0
171 return 0
170 if tool == "internal:fail":
172 if tool == "internal:fail":
171 return 1
173 return 1
172
174
173 # do the actual merge
175 # do the actual merge
174 a = repo.wjoin(fd)
176 a = repo.wjoin(fd)
175 b = temp("base", fca)
177 b = temp("base", fca)
176 c = temp("other", fco)
178 c = temp("other", fco)
177 out = ""
179 out = ""
178 back = a + ".orig"
180 back = a + ".orig"
179 util.copyfile(a, back)
181 util.copyfile(a, back)
180
182
181 if orig != fco.path():
183 if orig != fco.path():
182 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
184 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
183 else:
185 else:
184 ui.status(_("merging %s\n") % fd)
186 ui.status(_("merging %s\n") % fd)
185
187
186 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
188 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
187
189
188 # do we attempt to simplemerge first?
190 # do we attempt to simplemerge first?
189 try:
191 try:
190 premerge = _toolbool(ui, tool, "premerge", not (binary or symlink))
192 premerge = _toolbool(ui, tool, "premerge", not (binary or symlink))
191 except error.ConfigError:
193 except error.ConfigError:
192 premerge = _toolstr(ui, tool, "premerge").lower()
194 premerge = _toolstr(ui, tool, "premerge").lower()
193 valid = 'keep'.split()
195 valid = 'keep'.split()
194 if premerge not in valid:
196 if premerge not in valid:
195 _valid = ', '.join(["'" + v + "'" for v in valid])
197 _valid = ', '.join(["'" + v + "'" for v in valid])
196 raise error.ConfigError(_("%s.premerge not valid "
198 raise error.ConfigError(_("%s.premerge not valid "
197 "('%s' is neither boolean nor %s)") %
199 "('%s' is neither boolean nor %s)") %
198 (tool, premerge, _valid))
200 (tool, premerge, _valid))
199
201
200 if premerge:
202 if premerge:
201 r = simplemerge.simplemerge(ui, a, b, c, quiet=True)
203 r = simplemerge.simplemerge(ui, a, b, c, quiet=True)
202 if not r:
204 if not r:
203 ui.debug(" premerge successful\n")
205 ui.debug(" premerge successful\n")
204 os.unlink(back)
206 os.unlink(back)
205 os.unlink(b)
207 os.unlink(b)
206 os.unlink(c)
208 os.unlink(c)
207 return 0
209 return 0
208 if premerge != 'keep':
210 if premerge != 'keep':
209 util.copyfile(back, a) # restore from backup and try again
211 util.copyfile(back, a) # restore from backup and try again
210
212
211 env = dict(HG_FILE=fd,
213 env = dict(HG_FILE=fd,
212 HG_MY_NODE=short(mynode),
214 HG_MY_NODE=short(mynode),
213 HG_OTHER_NODE=str(fco.changectx()),
215 HG_OTHER_NODE=str(fco.changectx()),
214 HG_BASE_NODE=str(fca.changectx()),
216 HG_BASE_NODE=str(fca.changectx()),
215 HG_MY_ISLINK='l' in fcd.flags(),
217 HG_MY_ISLINK='l' in fcd.flags(),
216 HG_OTHER_ISLINK='l' in fco.flags(),
218 HG_OTHER_ISLINK='l' in fco.flags(),
217 HG_BASE_ISLINK='l' in fca.flags())
219 HG_BASE_ISLINK='l' in fca.flags())
218
220
219 if tool == "internal:merge":
221 if tool == "internal:merge":
220 r = simplemerge.simplemerge(ui, a, b, c, label=['local', 'other'])
222 r = simplemerge.simplemerge(ui, a, b, c, label=['local', 'other'])
221 elif tool == 'internal:dump':
223 elif tool == 'internal:dump':
222 a = repo.wjoin(fd)
224 a = repo.wjoin(fd)
223 util.copyfile(a, a + ".local")
225 util.copyfile(a, a + ".local")
224 repo.wwrite(fd + ".other", fco.data(), fco.flags())
226 repo.wwrite(fd + ".other", fco.data(), fco.flags())
225 repo.wwrite(fd + ".base", fca.data(), fca.flags())
227 repo.wwrite(fd + ".base", fca.data(), fca.flags())
226 return 1 # unresolved
228 return 1 # unresolved
227 else:
229 else:
228 args = _toolstr(ui, tool, "args", '$local $base $other')
230 args = _toolstr(ui, tool, "args", '$local $base $other')
229 if "$output" in args:
231 if "$output" in args:
230 out, a = a, back # read input from backup, write to original
232 out, a = a, back # read input from backup, write to original
231 replace = dict(local=a, base=b, other=c, output=out)
233 replace = dict(local=a, base=b, other=c, output=out)
232 args = util.interpolate(r'\$', replace, args,
234 args = util.interpolate(r'\$', replace, args,
233 lambda s: '"%s"' % util.localpath(s))
235 lambda s: '"%s"' % util.localpath(s))
234 r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env)
236 r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env)
235
237
236 if not r and (_toolbool(ui, tool, "checkconflicts") or
238 if not r and (_toolbool(ui, tool, "checkconflicts") or
237 'conflicts' in _toollist(ui, tool, "check")):
239 'conflicts' in _toollist(ui, tool, "check")):
238 if re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data(),
240 if re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data(),
239 re.MULTILINE):
241 re.MULTILINE):
240 r = 1
242 r = 1
241
243
242 checked = False
244 checked = False
243 if 'prompt' in _toollist(ui, tool, "check"):
245 if 'prompt' in _toollist(ui, tool, "check"):
244 checked = True
246 checked = True
245 if ui.promptchoice(_("was merge of '%s' successful (yn)?") % fd,
247 if ui.promptchoice(_("was merge of '%s' successful (yn)?") % fd,
246 (_("&Yes"), _("&No")), 1):
248 (_("&Yes"), _("&No")), 1):
247 r = 1
249 r = 1
248
250
249 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
251 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
250 'changed' in _toollist(ui, tool, "check")):
252 'changed' in _toollist(ui, tool, "check")):
251 if filecmp.cmp(repo.wjoin(fd), back):
253 if filecmp.cmp(repo.wjoin(fd), back):
252 if ui.promptchoice(_(" output file %s appears unchanged\n"
254 if ui.promptchoice(_(" output file %s appears unchanged\n"
253 "was merge successful (yn)?") % fd,
255 "was merge successful (yn)?") % fd,
254 (_("&Yes"), _("&No")), 1):
256 (_("&Yes"), _("&No")), 1):
255 r = 1
257 r = 1
256
258
257 if _toolbool(ui, tool, "fixeol"):
259 if _toolbool(ui, tool, "fixeol"):
258 _matcheol(repo.wjoin(fd), back)
260 _matcheol(repo.wjoin(fd), back)
259
261
260 if r:
262 if r:
261 ui.warn(_("merging %s failed!\n") % fd)
263 ui.warn(_("merging %s failed!\n") % fd)
262 else:
264 else:
263 os.unlink(back)
265 os.unlink(back)
264
266
265 os.unlink(b)
267 os.unlink(b)
266 os.unlink(c)
268 os.unlink(c)
267 return r
269 return r
General Comments 0
You need to be logged in to leave comments. Login now