##// END OF EJS Templates
windows: expand '~/' and '~\' to %USERPROFILE% when translating to cmd.exe...
Matt Harbison -
r38748:c382c19c default
parent child Browse files
Show More
@@ -1,2667 +1,2669 b''
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 If you're having problems with your configuration,
7 If you're having problems with your configuration,
8 :hg:`config --debug` can help you understand what is introducing
8 :hg:`config --debug` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Structure
14 Structure
15 =========
15 =========
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself:
33 appropriate configuration files yourself:
34
34
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
35 Local configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36
36
37 Global configuration like the username setting is typically put into:
37 Global configuration like the username setting is typically put into:
38
38
39 .. container:: windows
39 .. container:: windows
40
40
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
41 - ``%USERPROFILE%\mercurial.ini`` (on Windows)
42
42
43 .. container:: unix.plan9
43 .. container:: unix.plan9
44
44
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
45 - ``$HOME/.hgrc`` (on Unix, Plan9)
46
46
47 The names of these files depend on the system on which Mercurial is
47 The names of these files depend on the system on which Mercurial is
48 installed. ``*.rc`` files from a single directory are read in
48 installed. ``*.rc`` files from a single directory are read in
49 alphabetical order, later ones overriding earlier ones. Where multiple
49 alphabetical order, later ones overriding earlier ones. Where multiple
50 paths are given below, settings from earlier paths override later
50 paths are given below, settings from earlier paths override later
51 ones.
51 ones.
52
52
53 .. container:: verbose.unix
53 .. container:: verbose.unix
54
54
55 On Unix, the following files are consulted:
55 On Unix, the following files are consulted:
56
56
57 - ``<repo>/.hg/hgrc`` (per-repository)
57 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``$HOME/.hgrc`` (per-user)
58 - ``$HOME/.hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
62 - ``/etc/mercurial/hgrc`` (per-system)
62 - ``/etc/mercurial/hgrc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
63 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
64 - ``<internal>/default.d/*.rc`` (defaults)
64 - ``<internal>/default.d/*.rc`` (defaults)
65
65
66 .. container:: verbose.windows
66 .. container:: verbose.windows
67
67
68 On Windows, the following files are consulted:
68 On Windows, the following files are consulted:
69
69
70 - ``<repo>/.hg/hgrc`` (per-repository)
70 - ``<repo>/.hg/hgrc`` (per-repository)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
71 - ``%USERPROFILE%\.hgrc`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
72 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
73 - ``%HOME%\.hgrc`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
74 - ``%HOME%\Mercurial.ini`` (per-user)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
75 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
76 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
77 - ``<install-dir>\Mercurial.ini`` (per-installation)
78 - ``<internal>/default.d/*.rc`` (defaults)
78 - ``<internal>/default.d/*.rc`` (defaults)
79
79
80 .. note::
80 .. note::
81
81
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
82 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
83 is used when running 32-bit Python on 64-bit Windows.
83 is used when running 32-bit Python on 64-bit Windows.
84
84
85 .. container:: windows
85 .. container:: windows
86
86
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
87 On Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``.
88
88
89 .. container:: verbose.plan9
89 .. container:: verbose.plan9
90
90
91 On Plan9, the following files are consulted:
91 On Plan9, the following files are consulted:
92
92
93 - ``<repo>/.hg/hgrc`` (per-repository)
93 - ``<repo>/.hg/hgrc`` (per-repository)
94 - ``$home/lib/hgrc`` (per-user)
94 - ``$home/lib/hgrc`` (per-user)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
95 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
96 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
97 - ``/lib/mercurial/hgrc`` (per-system)
97 - ``/lib/mercurial/hgrc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
98 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
99 - ``<internal>/default.d/*.rc`` (defaults)
99 - ``<internal>/default.d/*.rc`` (defaults)
100
100
101 Per-repository configuration options only apply in a
101 Per-repository configuration options only apply in a
102 particular repository. This file is not version-controlled, and
102 particular repository. This file is not version-controlled, and
103 will not get transferred during a "clone" operation. Options in
103 will not get transferred during a "clone" operation. Options in
104 this file override options in all other configuration files.
104 this file override options in all other configuration files.
105
105
106 .. container:: unix.plan9
106 .. container:: unix.plan9
107
107
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
108 On Plan 9 and Unix, most of this file will be ignored if it doesn't
109 belong to a trusted user or to a trusted group. See
109 belong to a trusted user or to a trusted group. See
110 :hg:`help config.trusted` for more details.
110 :hg:`help config.trusted` for more details.
111
111
112 Per-user configuration file(s) are for the user running Mercurial. Options
112 Per-user configuration file(s) are for the user running Mercurial. Options
113 in these files apply to all Mercurial commands executed by this user in any
113 in these files apply to all Mercurial commands executed by this user in any
114 directory. Options in these files override per-system and per-installation
114 directory. Options in these files override per-system and per-installation
115 options.
115 options.
116
116
117 Per-installation configuration files are searched for in the
117 Per-installation configuration files are searched for in the
118 directory where Mercurial is installed. ``<install-root>`` is the
118 directory where Mercurial is installed. ``<install-root>`` is the
119 parent directory of the **hg** executable (or symlink) being run.
119 parent directory of the **hg** executable (or symlink) being run.
120
120
121 .. container:: unix.plan9
121 .. container:: unix.plan9
122
122
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
123 For example, if installed in ``/shared/tools/bin/hg``, Mercurial
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
124 will look in ``/shared/tools/etc/mercurial/hgrc``. Options in these
125 files apply to all Mercurial commands executed by any user in any
125 files apply to all Mercurial commands executed by any user in any
126 directory.
126 directory.
127
127
128 Per-installation configuration files are for the system on
128 Per-installation configuration files are for the system on
129 which Mercurial is running. Options in these files apply to all
129 which Mercurial is running. Options in these files apply to all
130 Mercurial commands executed by any user in any directory. Registry
130 Mercurial commands executed by any user in any directory. Registry
131 keys contain PATH-like strings, every part of which must reference
131 keys contain PATH-like strings, every part of which must reference
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
132 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
133 be read. Mercurial checks each of these locations in the specified
133 be read. Mercurial checks each of these locations in the specified
134 order until one or more configuration files are detected.
134 order until one or more configuration files are detected.
135
135
136 Per-system configuration files are for the system on which Mercurial
136 Per-system configuration files are for the system on which Mercurial
137 is running. Options in these files apply to all Mercurial commands
137 is running. Options in these files apply to all Mercurial commands
138 executed by any user in any directory. Options in these files
138 executed by any user in any directory. Options in these files
139 override per-installation options.
139 override per-installation options.
140
140
141 Mercurial comes with some default configuration. The default configuration
141 Mercurial comes with some default configuration. The default configuration
142 files are installed with Mercurial and will be overwritten on upgrades. Default
142 files are installed with Mercurial and will be overwritten on upgrades. Default
143 configuration files should never be edited by users or administrators but can
143 configuration files should never be edited by users or administrators but can
144 be overridden in other configuration files. So far the directory only contains
144 be overridden in other configuration files. So far the directory only contains
145 merge tool configuration but packagers can also put other default configuration
145 merge tool configuration but packagers can also put other default configuration
146 there.
146 there.
147
147
148 Syntax
148 Syntax
149 ======
149 ======
150
150
151 A configuration file consists of sections, led by a ``[section]`` header
151 A configuration file consists of sections, led by a ``[section]`` header
152 and followed by ``name = value`` entries (sometimes called
152 and followed by ``name = value`` entries (sometimes called
153 ``configuration keys``)::
153 ``configuration keys``)::
154
154
155 [spam]
155 [spam]
156 eggs=ham
156 eggs=ham
157 green=
157 green=
158 eggs
158 eggs
159
159
160 Each line contains one entry. If the lines that follow are indented,
160 Each line contains one entry. If the lines that follow are indented,
161 they are treated as continuations of that entry. Leading whitespace is
161 they are treated as continuations of that entry. Leading whitespace is
162 removed from values. Empty lines are skipped. Lines beginning with
162 removed from values. Empty lines are skipped. Lines beginning with
163 ``#`` or ``;`` are ignored and may be used to provide comments.
163 ``#`` or ``;`` are ignored and may be used to provide comments.
164
164
165 Configuration keys can be set multiple times, in which case Mercurial
165 Configuration keys can be set multiple times, in which case Mercurial
166 will use the value that was configured last. As an example::
166 will use the value that was configured last. As an example::
167
167
168 [spam]
168 [spam]
169 eggs=large
169 eggs=large
170 ham=serrano
170 ham=serrano
171 eggs=small
171 eggs=small
172
172
173 This would set the configuration key named ``eggs`` to ``small``.
173 This would set the configuration key named ``eggs`` to ``small``.
174
174
175 It is also possible to define a section multiple times. A section can
175 It is also possible to define a section multiple times. A section can
176 be redefined on the same and/or on different configuration files. For
176 be redefined on the same and/or on different configuration files. For
177 example::
177 example::
178
178
179 [foo]
179 [foo]
180 eggs=large
180 eggs=large
181 ham=serrano
181 ham=serrano
182 eggs=small
182 eggs=small
183
183
184 [bar]
184 [bar]
185 eggs=ham
185 eggs=ham
186 green=
186 green=
187 eggs
187 eggs
188
188
189 [foo]
189 [foo]
190 ham=prosciutto
190 ham=prosciutto
191 eggs=medium
191 eggs=medium
192 bread=toasted
192 bread=toasted
193
193
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
194 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
195 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
196 respectively. As you can see there only thing that matters is the last
196 respectively. As you can see there only thing that matters is the last
197 value that was set for each of the configuration keys.
197 value that was set for each of the configuration keys.
198
198
199 If a configuration key is set multiple times in different
199 If a configuration key is set multiple times in different
200 configuration files the final value will depend on the order in which
200 configuration files the final value will depend on the order in which
201 the different configuration files are read, with settings from earlier
201 the different configuration files are read, with settings from earlier
202 paths overriding later ones as described on the ``Files`` section
202 paths overriding later ones as described on the ``Files`` section
203 above.
203 above.
204
204
205 A line of the form ``%include file`` will include ``file`` into the
205 A line of the form ``%include file`` will include ``file`` into the
206 current configuration file. The inclusion is recursive, which means
206 current configuration file. The inclusion is recursive, which means
207 that included files can include other files. Filenames are relative to
207 that included files can include other files. Filenames are relative to
208 the configuration file in which the ``%include`` directive is found.
208 the configuration file in which the ``%include`` directive is found.
209 Environment variables and ``~user`` constructs are expanded in
209 Environment variables and ``~user`` constructs are expanded in
210 ``file``. This lets you do something like::
210 ``file``. This lets you do something like::
211
211
212 %include ~/.hgrc.d/$HOST.rc
212 %include ~/.hgrc.d/$HOST.rc
213
213
214 to include a different configuration file on each computer you use.
214 to include a different configuration file on each computer you use.
215
215
216 A line with ``%unset name`` will remove ``name`` from the current
216 A line with ``%unset name`` will remove ``name`` from the current
217 section, if it has been set previously.
217 section, if it has been set previously.
218
218
219 The values are either free-form text strings, lists of text strings,
219 The values are either free-form text strings, lists of text strings,
220 or Boolean values. Boolean values can be set to true using any of "1",
220 or Boolean values. Boolean values can be set to true using any of "1",
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
221 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
222 (all case insensitive).
222 (all case insensitive).
223
223
224 List values are separated by whitespace or comma, except when values are
224 List values are separated by whitespace or comma, except when values are
225 placed in double quotation marks::
225 placed in double quotation marks::
226
226
227 allow_read = "John Doe, PhD", brian, betty
227 allow_read = "John Doe, PhD", brian, betty
228
228
229 Quotation marks can be escaped by prefixing them with a backslash. Only
229 Quotation marks can be escaped by prefixing them with a backslash. Only
230 quotation marks at the beginning of a word is counted as a quotation
230 quotation marks at the beginning of a word is counted as a quotation
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
231 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
232
232
233 Sections
233 Sections
234 ========
234 ========
235
235
236 This section describes the different sections that may appear in a
236 This section describes the different sections that may appear in a
237 Mercurial configuration file, the purpose of each section, its possible
237 Mercurial configuration file, the purpose of each section, its possible
238 keys, and their possible values.
238 keys, and their possible values.
239
239
240 ``alias``
240 ``alias``
241 ---------
241 ---------
242
242
243 Defines command aliases.
243 Defines command aliases.
244
244
245 Aliases allow you to define your own commands in terms of other
245 Aliases allow you to define your own commands in terms of other
246 commands (or aliases), optionally including arguments. Positional
246 commands (or aliases), optionally including arguments. Positional
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
247 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
248 are expanded by Mercurial before execution. Positional arguments not
248 are expanded by Mercurial before execution. Positional arguments not
249 already used by ``$N`` in the definition are put at the end of the
249 already used by ``$N`` in the definition are put at the end of the
250 command to be executed.
250 command to be executed.
251
251
252 Alias definitions consist of lines of the form::
252 Alias definitions consist of lines of the form::
253
253
254 <alias> = <command> [<argument>]...
254 <alias> = <command> [<argument>]...
255
255
256 For example, this definition::
256 For example, this definition::
257
257
258 latest = log --limit 5
258 latest = log --limit 5
259
259
260 creates a new command ``latest`` that shows only the five most recent
260 creates a new command ``latest`` that shows only the five most recent
261 changesets. You can define subsequent aliases using earlier ones::
261 changesets. You can define subsequent aliases using earlier ones::
262
262
263 stable5 = latest -b stable
263 stable5 = latest -b stable
264
264
265 .. note::
265 .. note::
266
266
267 It is possible to create aliases with the same names as
267 It is possible to create aliases with the same names as
268 existing commands, which will then override the original
268 existing commands, which will then override the original
269 definitions. This is almost always a bad idea!
269 definitions. This is almost always a bad idea!
270
270
271 An alias can start with an exclamation point (``!``) to make it a
271 An alias can start with an exclamation point (``!``) to make it a
272 shell alias. A shell alias is executed with the shell and will let you
272 shell alias. A shell alias is executed with the shell and will let you
273 run arbitrary commands. As an example, ::
273 run arbitrary commands. As an example, ::
274
274
275 echo = !echo $@
275 echo = !echo $@
276
276
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
277 will let you do ``hg echo foo`` to have ``foo`` printed in your
278 terminal. A better example might be::
278 terminal. A better example might be::
279
279
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
280 purge = !$HG status --no-status --unknown -0 re: | xargs -0 rm -f
281
281
282 which will make ``hg purge`` delete all unknown files in the
282 which will make ``hg purge`` delete all unknown files in the
283 repository in the same manner as the purge extension.
283 repository in the same manner as the purge extension.
284
284
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
285 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
286 expand to the command arguments. Unmatched arguments are
286 expand to the command arguments. Unmatched arguments are
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
287 removed. ``$0`` expands to the alias name and ``$@`` expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
288 arguments separated by a space. ``"$@"`` (with quotes) expands to all
289 arguments quoted individually and separated by a space. These expansions
289 arguments quoted individually and separated by a space. These expansions
290 happen before the command is passed to the shell.
290 happen before the command is passed to the shell.
291
291
292 Shell aliases are executed in an environment where ``$HG`` expands to
292 Shell aliases are executed in an environment where ``$HG`` expands to
293 the path of the Mercurial that was used to execute the alias. This is
293 the path of the Mercurial that was used to execute the alias. This is
294 useful when you want to call further Mercurial commands in a shell
294 useful when you want to call further Mercurial commands in a shell
295 alias, as was done above for the purge alias. In addition,
295 alias, as was done above for the purge alias. In addition,
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
296 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
297 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
298
298
299 .. note::
299 .. note::
300
300
301 Some global configuration options such as ``-R`` are
301 Some global configuration options such as ``-R`` are
302 processed before shell aliases and will thus not be passed to
302 processed before shell aliases and will thus not be passed to
303 aliases.
303 aliases.
304
304
305
305
306 ``annotate``
306 ``annotate``
307 ------------
307 ------------
308
308
309 Settings used when displaying file annotations. All values are
309 Settings used when displaying file annotations. All values are
310 Booleans and default to False. See :hg:`help config.diff` for
310 Booleans and default to False. See :hg:`help config.diff` for
311 related options for the diff command.
311 related options for the diff command.
312
312
313 ``ignorews``
313 ``ignorews``
314 Ignore white space when comparing lines.
314 Ignore white space when comparing lines.
315
315
316 ``ignorewseol``
316 ``ignorewseol``
317 Ignore white space at the end of a line when comparing lines.
317 Ignore white space at the end of a line when comparing lines.
318
318
319 ``ignorewsamount``
319 ``ignorewsamount``
320 Ignore changes in the amount of white space.
320 Ignore changes in the amount of white space.
321
321
322 ``ignoreblanklines``
322 ``ignoreblanklines``
323 Ignore changes whose lines are all blank.
323 Ignore changes whose lines are all blank.
324
324
325
325
326 ``auth``
326 ``auth``
327 --------
327 --------
328
328
329 Authentication credentials and other authentication-like configuration
329 Authentication credentials and other authentication-like configuration
330 for HTTP connections. This section allows you to store usernames and
330 for HTTP connections. This section allows you to store usernames and
331 passwords for use when logging *into* HTTP servers. See
331 passwords for use when logging *into* HTTP servers. See
332 :hg:`help config.web` if you want to configure *who* can login to
332 :hg:`help config.web` if you want to configure *who* can login to
333 your HTTP server.
333 your HTTP server.
334
334
335 The following options apply to all hosts.
335 The following options apply to all hosts.
336
336
337 ``cookiefile``
337 ``cookiefile``
338 Path to a file containing HTTP cookie lines. Cookies matching a
338 Path to a file containing HTTP cookie lines. Cookies matching a
339 host will be sent automatically.
339 host will be sent automatically.
340
340
341 The file format uses the Mozilla cookies.txt format, which defines cookies
341 The file format uses the Mozilla cookies.txt format, which defines cookies
342 on their own lines. Each line contains 7 fields delimited by the tab
342 on their own lines. Each line contains 7 fields delimited by the tab
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
343 character (domain, is_domain_cookie, path, is_secure, expires, name,
344 value). For more info, do an Internet search for "Netscape cookies.txt
344 value). For more info, do an Internet search for "Netscape cookies.txt
345 format."
345 format."
346
346
347 Note: the cookies parser does not handle port numbers on domains. You
347 Note: the cookies parser does not handle port numbers on domains. You
348 will need to remove ports from the domain for the cookie to be recognized.
348 will need to remove ports from the domain for the cookie to be recognized.
349 This could result in a cookie being disclosed to an unwanted server.
349 This could result in a cookie being disclosed to an unwanted server.
350
350
351 The cookies file is read-only.
351 The cookies file is read-only.
352
352
353 Other options in this section are grouped by name and have the following
353 Other options in this section are grouped by name and have the following
354 format::
354 format::
355
355
356 <name>.<argument> = <value>
356 <name>.<argument> = <value>
357
357
358 where ``<name>`` is used to group arguments into authentication
358 where ``<name>`` is used to group arguments into authentication
359 entries. Example::
359 entries. Example::
360
360
361 foo.prefix = hg.intevation.de/mercurial
361 foo.prefix = hg.intevation.de/mercurial
362 foo.username = foo
362 foo.username = foo
363 foo.password = bar
363 foo.password = bar
364 foo.schemes = http https
364 foo.schemes = http https
365
365
366 bar.prefix = secure.example.org
366 bar.prefix = secure.example.org
367 bar.key = path/to/file.key
367 bar.key = path/to/file.key
368 bar.cert = path/to/file.cert
368 bar.cert = path/to/file.cert
369 bar.schemes = https
369 bar.schemes = https
370
370
371 Supported arguments:
371 Supported arguments:
372
372
373 ``prefix``
373 ``prefix``
374 Either ``*`` or a URI prefix with or without the scheme part.
374 Either ``*`` or a URI prefix with or without the scheme part.
375 The authentication entry with the longest matching prefix is used
375 The authentication entry with the longest matching prefix is used
376 (where ``*`` matches everything and counts as a match of length
376 (where ``*`` matches everything and counts as a match of length
377 1). If the prefix doesn't include a scheme, the match is performed
377 1). If the prefix doesn't include a scheme, the match is performed
378 against the URI with its scheme stripped as well, and the schemes
378 against the URI with its scheme stripped as well, and the schemes
379 argument, q.v., is then subsequently consulted.
379 argument, q.v., is then subsequently consulted.
380
380
381 ``username``
381 ``username``
382 Optional. Username to authenticate with. If not given, and the
382 Optional. Username to authenticate with. If not given, and the
383 remote site requires basic or digest authentication, the user will
383 remote site requires basic or digest authentication, the user will
384 be prompted for it. Environment variables are expanded in the
384 be prompted for it. Environment variables are expanded in the
385 username letting you do ``foo.username = $USER``. If the URI
385 username letting you do ``foo.username = $USER``. If the URI
386 includes a username, only ``[auth]`` entries with a matching
386 includes a username, only ``[auth]`` entries with a matching
387 username or without a username will be considered.
387 username or without a username will be considered.
388
388
389 ``password``
389 ``password``
390 Optional. Password to authenticate with. If not given, and the
390 Optional. Password to authenticate with. If not given, and the
391 remote site requires basic or digest authentication, the user
391 remote site requires basic or digest authentication, the user
392 will be prompted for it.
392 will be prompted for it.
393
393
394 ``key``
394 ``key``
395 Optional. PEM encoded client certificate key file. Environment
395 Optional. PEM encoded client certificate key file. Environment
396 variables are expanded in the filename.
396 variables are expanded in the filename.
397
397
398 ``cert``
398 ``cert``
399 Optional. PEM encoded client certificate chain file. Environment
399 Optional. PEM encoded client certificate chain file. Environment
400 variables are expanded in the filename.
400 variables are expanded in the filename.
401
401
402 ``schemes``
402 ``schemes``
403 Optional. Space separated list of URI schemes to use this
403 Optional. Space separated list of URI schemes to use this
404 authentication entry with. Only used if the prefix doesn't include
404 authentication entry with. Only used if the prefix doesn't include
405 a scheme. Supported schemes are http and https. They will match
405 a scheme. Supported schemes are http and https. They will match
406 static-http and static-https respectively, as well.
406 static-http and static-https respectively, as well.
407 (default: https)
407 (default: https)
408
408
409 If no suitable authentication entry is found, the user is prompted
409 If no suitable authentication entry is found, the user is prompted
410 for credentials as usual if required by the remote.
410 for credentials as usual if required by the remote.
411
411
412 ``color``
412 ``color``
413 ---------
413 ---------
414
414
415 Configure the Mercurial color mode. For details about how to define your custom
415 Configure the Mercurial color mode. For details about how to define your custom
416 effect and style see :hg:`help color`.
416 effect and style see :hg:`help color`.
417
417
418 ``mode``
418 ``mode``
419 String: control the method used to output color. One of ``auto``, ``ansi``,
419 String: control the method used to output color. One of ``auto``, ``ansi``,
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
420 ``win32``, ``terminfo`` or ``debug``. In auto mode, Mercurial will
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
421 use ANSI mode by default (or win32 mode prior to Windows 10) if it detects a
422 terminal. Any invalid value will disable color.
422 terminal. Any invalid value will disable color.
423
423
424 ``pagermode``
424 ``pagermode``
425 String: optional override of ``color.mode`` used with pager.
425 String: optional override of ``color.mode`` used with pager.
426
426
427 On some systems, terminfo mode may cause problems when using
427 On some systems, terminfo mode may cause problems when using
428 color with ``less -R`` as a pager program. less with the -R option
428 color with ``less -R`` as a pager program. less with the -R option
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
429 will only display ECMA-48 color codes, and terminfo mode may sometimes
430 emit codes that less doesn't understand. You can work around this by
430 emit codes that less doesn't understand. You can work around this by
431 either using ansi mode (or auto mode), or by using less -r (which will
431 either using ansi mode (or auto mode), or by using less -r (which will
432 pass through all terminal control codes, not just color control
432 pass through all terminal control codes, not just color control
433 codes).
433 codes).
434
434
435 On some systems (such as MSYS in Windows), the terminal may support
435 On some systems (such as MSYS in Windows), the terminal may support
436 a different color mode than the pager program.
436 a different color mode than the pager program.
437
437
438 ``commands``
438 ``commands``
439 ------------
439 ------------
440
440
441 ``status.relative``
441 ``status.relative``
442 Make paths in :hg:`status` output relative to the current directory.
442 Make paths in :hg:`status` output relative to the current directory.
443 (default: False)
443 (default: False)
444
444
445 ``status.terse``
445 ``status.terse``
446 Default value for the --terse flag, which condenes status output.
446 Default value for the --terse flag, which condenes status output.
447 (default: empty)
447 (default: empty)
448
448
449 ``update.check``
449 ``update.check``
450 Determines what level of checking :hg:`update` will perform before moving
450 Determines what level of checking :hg:`update` will perform before moving
451 to a destination revision. Valid values are ``abort``, ``none``,
451 to a destination revision. Valid values are ``abort``, ``none``,
452 ``linear``, and ``noconflict``. ``abort`` always fails if the working
452 ``linear``, and ``noconflict``. ``abort`` always fails if the working
453 directory has uncommitted changes. ``none`` performs no checking, and may
453 directory has uncommitted changes. ``none`` performs no checking, and may
454 result in a merge with uncommitted changes. ``linear`` allows any update
454 result in a merge with uncommitted changes. ``linear`` allows any update
455 as long as it follows a straight line in the revision history, and may
455 as long as it follows a straight line in the revision history, and may
456 trigger a merge with uncommitted changes. ``noconflict`` will allow any
456 trigger a merge with uncommitted changes. ``noconflict`` will allow any
457 update which would not trigger a merge with uncommitted changes, if any
457 update which would not trigger a merge with uncommitted changes, if any
458 are present.
458 are present.
459 (default: ``linear``)
459 (default: ``linear``)
460
460
461 ``update.requiredest``
461 ``update.requiredest``
462 Require that the user pass a destination when running :hg:`update`.
462 Require that the user pass a destination when running :hg:`update`.
463 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
463 For example, :hg:`update .::` will be allowed, but a plain :hg:`update`
464 will be disallowed.
464 will be disallowed.
465 (default: False)
465 (default: False)
466
466
467 ``committemplate``
467 ``committemplate``
468 ------------------
468 ------------------
469
469
470 ``changeset``
470 ``changeset``
471 String: configuration in this section is used as the template to
471 String: configuration in this section is used as the template to
472 customize the text shown in the editor when committing.
472 customize the text shown in the editor when committing.
473
473
474 In addition to pre-defined template keywords, commit log specific one
474 In addition to pre-defined template keywords, commit log specific one
475 below can be used for customization:
475 below can be used for customization:
476
476
477 ``extramsg``
477 ``extramsg``
478 String: Extra message (typically 'Leave message empty to abort
478 String: Extra message (typically 'Leave message empty to abort
479 commit.'). This may be changed by some commands or extensions.
479 commit.'). This may be changed by some commands or extensions.
480
480
481 For example, the template configuration below shows as same text as
481 For example, the template configuration below shows as same text as
482 one shown by default::
482 one shown by default::
483
483
484 [committemplate]
484 [committemplate]
485 changeset = {desc}\n\n
485 changeset = {desc}\n\n
486 HG: Enter commit message. Lines beginning with 'HG:' are removed.
486 HG: Enter commit message. Lines beginning with 'HG:' are removed.
487 HG: {extramsg}
487 HG: {extramsg}
488 HG: --
488 HG: --
489 HG: user: {author}\n{ifeq(p2rev, "-1", "",
489 HG: user: {author}\n{ifeq(p2rev, "-1", "",
490 "HG: branch merge\n")
490 "HG: branch merge\n")
491 }HG: branch '{branch}'\n{if(activebookmark,
491 }HG: branch '{branch}'\n{if(activebookmark,
492 "HG: bookmark '{activebookmark}'\n") }{subrepos %
492 "HG: bookmark '{activebookmark}'\n") }{subrepos %
493 "HG: subrepo {subrepo}\n" }{file_adds %
493 "HG: subrepo {subrepo}\n" }{file_adds %
494 "HG: added {file}\n" }{file_mods %
494 "HG: added {file}\n" }{file_mods %
495 "HG: changed {file}\n" }{file_dels %
495 "HG: changed {file}\n" }{file_dels %
496 "HG: removed {file}\n" }{if(files, "",
496 "HG: removed {file}\n" }{if(files, "",
497 "HG: no files changed\n")}
497 "HG: no files changed\n")}
498
498
499 ``diff()``
499 ``diff()``
500 String: show the diff (see :hg:`help templates` for detail)
500 String: show the diff (see :hg:`help templates` for detail)
501
501
502 Sometimes it is helpful to show the diff of the changeset in the editor without
502 Sometimes it is helpful to show the diff of the changeset in the editor without
503 having to prefix 'HG: ' to each line so that highlighting works correctly. For
503 having to prefix 'HG: ' to each line so that highlighting works correctly. For
504 this, Mercurial provides a special string which will ignore everything below
504 this, Mercurial provides a special string which will ignore everything below
505 it::
505 it::
506
506
507 HG: ------------------------ >8 ------------------------
507 HG: ------------------------ >8 ------------------------
508
508
509 For example, the template configuration below will show the diff below the
509 For example, the template configuration below will show the diff below the
510 extra message::
510 extra message::
511
511
512 [committemplate]
512 [committemplate]
513 changeset = {desc}\n\n
513 changeset = {desc}\n\n
514 HG: Enter commit message. Lines beginning with 'HG:' are removed.
514 HG: Enter commit message. Lines beginning with 'HG:' are removed.
515 HG: {extramsg}
515 HG: {extramsg}
516 HG: ------------------------ >8 ------------------------
516 HG: ------------------------ >8 ------------------------
517 HG: Do not touch the line above.
517 HG: Do not touch the line above.
518 HG: Everything below will be removed.
518 HG: Everything below will be removed.
519 {diff()}
519 {diff()}
520
520
521 .. note::
521 .. note::
522
522
523 For some problematic encodings (see :hg:`help win32mbcs` for
523 For some problematic encodings (see :hg:`help win32mbcs` for
524 detail), this customization should be configured carefully, to
524 detail), this customization should be configured carefully, to
525 avoid showing broken characters.
525 avoid showing broken characters.
526
526
527 For example, if a multibyte character ending with backslash (0x5c) is
527 For example, if a multibyte character ending with backslash (0x5c) is
528 followed by the ASCII character 'n' in the customized template,
528 followed by the ASCII character 'n' in the customized template,
529 the sequence of backslash and 'n' is treated as line-feed unexpectedly
529 the sequence of backslash and 'n' is treated as line-feed unexpectedly
530 (and the multibyte character is broken, too).
530 (and the multibyte character is broken, too).
531
531
532 Customized template is used for commands below (``--edit`` may be
532 Customized template is used for commands below (``--edit`` may be
533 required):
533 required):
534
534
535 - :hg:`backout`
535 - :hg:`backout`
536 - :hg:`commit`
536 - :hg:`commit`
537 - :hg:`fetch` (for merge commit only)
537 - :hg:`fetch` (for merge commit only)
538 - :hg:`graft`
538 - :hg:`graft`
539 - :hg:`histedit`
539 - :hg:`histedit`
540 - :hg:`import`
540 - :hg:`import`
541 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
541 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
542 - :hg:`rebase`
542 - :hg:`rebase`
543 - :hg:`shelve`
543 - :hg:`shelve`
544 - :hg:`sign`
544 - :hg:`sign`
545 - :hg:`tag`
545 - :hg:`tag`
546 - :hg:`transplant`
546 - :hg:`transplant`
547
547
548 Configuring items below instead of ``changeset`` allows showing
548 Configuring items below instead of ``changeset`` allows showing
549 customized message only for specific actions, or showing different
549 customized message only for specific actions, or showing different
550 messages for each action.
550 messages for each action.
551
551
552 - ``changeset.backout`` for :hg:`backout`
552 - ``changeset.backout`` for :hg:`backout`
553 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
553 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
554 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
554 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
555 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
555 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
556 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
556 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
557 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
557 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
558 - ``changeset.gpg.sign`` for :hg:`sign`
558 - ``changeset.gpg.sign`` for :hg:`sign`
559 - ``changeset.graft`` for :hg:`graft`
559 - ``changeset.graft`` for :hg:`graft`
560 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
560 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
561 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
561 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
562 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
562 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
563 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
563 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
564 - ``changeset.import.bypass`` for :hg:`import --bypass`
564 - ``changeset.import.bypass`` for :hg:`import --bypass`
565 - ``changeset.import.normal.merge`` for :hg:`import` on merges
565 - ``changeset.import.normal.merge`` for :hg:`import` on merges
566 - ``changeset.import.normal.normal`` for :hg:`import` on other
566 - ``changeset.import.normal.normal`` for :hg:`import` on other
567 - ``changeset.mq.qnew`` for :hg:`qnew`
567 - ``changeset.mq.qnew`` for :hg:`qnew`
568 - ``changeset.mq.qfold`` for :hg:`qfold`
568 - ``changeset.mq.qfold`` for :hg:`qfold`
569 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
569 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
570 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
570 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
571 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
571 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
572 - ``changeset.rebase.normal`` for :hg:`rebase` on other
572 - ``changeset.rebase.normal`` for :hg:`rebase` on other
573 - ``changeset.shelve.shelve`` for :hg:`shelve`
573 - ``changeset.shelve.shelve`` for :hg:`shelve`
574 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
574 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
575 - ``changeset.tag.remove`` for :hg:`tag --remove`
575 - ``changeset.tag.remove`` for :hg:`tag --remove`
576 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
576 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
577 - ``changeset.transplant.normal`` for :hg:`transplant` on other
577 - ``changeset.transplant.normal`` for :hg:`transplant` on other
578
578
579 These dot-separated lists of names are treated as hierarchical ones.
579 These dot-separated lists of names are treated as hierarchical ones.
580 For example, ``changeset.tag.remove`` customizes the commit message
580 For example, ``changeset.tag.remove`` customizes the commit message
581 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
581 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
582 commit message for :hg:`tag` regardless of ``--remove`` option.
582 commit message for :hg:`tag` regardless of ``--remove`` option.
583
583
584 When the external editor is invoked for a commit, the corresponding
584 When the external editor is invoked for a commit, the corresponding
585 dot-separated list of names without the ``changeset.`` prefix
585 dot-separated list of names without the ``changeset.`` prefix
586 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
586 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
587 variable.
587 variable.
588
588
589 In this section, items other than ``changeset`` can be referred from
589 In this section, items other than ``changeset`` can be referred from
590 others. For example, the configuration to list committed files up
590 others. For example, the configuration to list committed files up
591 below can be referred as ``{listupfiles}``::
591 below can be referred as ``{listupfiles}``::
592
592
593 [committemplate]
593 [committemplate]
594 listupfiles = {file_adds %
594 listupfiles = {file_adds %
595 "HG: added {file}\n" }{file_mods %
595 "HG: added {file}\n" }{file_mods %
596 "HG: changed {file}\n" }{file_dels %
596 "HG: changed {file}\n" }{file_dels %
597 "HG: removed {file}\n" }{if(files, "",
597 "HG: removed {file}\n" }{if(files, "",
598 "HG: no files changed\n")}
598 "HG: no files changed\n")}
599
599
600 ``decode/encode``
600 ``decode/encode``
601 -----------------
601 -----------------
602
602
603 Filters for transforming files on checkout/checkin. This would
603 Filters for transforming files on checkout/checkin. This would
604 typically be used for newline processing or other
604 typically be used for newline processing or other
605 localization/canonicalization of files.
605 localization/canonicalization of files.
606
606
607 Filters consist of a filter pattern followed by a filter command.
607 Filters consist of a filter pattern followed by a filter command.
608 Filter patterns are globs by default, rooted at the repository root.
608 Filter patterns are globs by default, rooted at the repository root.
609 For example, to match any file ending in ``.txt`` in the root
609 For example, to match any file ending in ``.txt`` in the root
610 directory only, use the pattern ``*.txt``. To match any file ending
610 directory only, use the pattern ``*.txt``. To match any file ending
611 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
611 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
612 For each file only the first matching filter applies.
612 For each file only the first matching filter applies.
613
613
614 The filter command can start with a specifier, either ``pipe:`` or
614 The filter command can start with a specifier, either ``pipe:`` or
615 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
615 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
616
616
617 A ``pipe:`` command must accept data on stdin and return the transformed
617 A ``pipe:`` command must accept data on stdin and return the transformed
618 data on stdout.
618 data on stdout.
619
619
620 Pipe example::
620 Pipe example::
621
621
622 [encode]
622 [encode]
623 # uncompress gzip files on checkin to improve delta compression
623 # uncompress gzip files on checkin to improve delta compression
624 # note: not necessarily a good idea, just an example
624 # note: not necessarily a good idea, just an example
625 *.gz = pipe: gunzip
625 *.gz = pipe: gunzip
626
626
627 [decode]
627 [decode]
628 # recompress gzip files when writing them to the working dir (we
628 # recompress gzip files when writing them to the working dir (we
629 # can safely omit "pipe:", because it's the default)
629 # can safely omit "pipe:", because it's the default)
630 *.gz = gzip
630 *.gz = gzip
631
631
632 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
632 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
633 with the name of a temporary file that contains the data to be
633 with the name of a temporary file that contains the data to be
634 filtered by the command. The string ``OUTFILE`` is replaced with the name
634 filtered by the command. The string ``OUTFILE`` is replaced with the name
635 of an empty temporary file, where the filtered data must be written by
635 of an empty temporary file, where the filtered data must be written by
636 the command.
636 the command.
637
637
638 .. container:: windows
638 .. container:: windows
639
639
640 .. note::
640 .. note::
641
641
642 The tempfile mechanism is recommended for Windows systems,
642 The tempfile mechanism is recommended for Windows systems,
643 where the standard shell I/O redirection operators often have
643 where the standard shell I/O redirection operators often have
644 strange effects and may corrupt the contents of your files.
644 strange effects and may corrupt the contents of your files.
645
645
646 This filter mechanism is used internally by the ``eol`` extension to
646 This filter mechanism is used internally by the ``eol`` extension to
647 translate line ending characters between Windows (CRLF) and Unix (LF)
647 translate line ending characters between Windows (CRLF) and Unix (LF)
648 format. We suggest you use the ``eol`` extension for convenience.
648 format. We suggest you use the ``eol`` extension for convenience.
649
649
650
650
651 ``defaults``
651 ``defaults``
652 ------------
652 ------------
653
653
654 (defaults are deprecated. Don't use them. Use aliases instead.)
654 (defaults are deprecated. Don't use them. Use aliases instead.)
655
655
656 Use the ``[defaults]`` section to define command defaults, i.e. the
656 Use the ``[defaults]`` section to define command defaults, i.e. the
657 default options/arguments to pass to the specified commands.
657 default options/arguments to pass to the specified commands.
658
658
659 The following example makes :hg:`log` run in verbose mode, and
659 The following example makes :hg:`log` run in verbose mode, and
660 :hg:`status` show only the modified files, by default::
660 :hg:`status` show only the modified files, by default::
661
661
662 [defaults]
662 [defaults]
663 log = -v
663 log = -v
664 status = -m
664 status = -m
665
665
666 The actual commands, instead of their aliases, must be used when
666 The actual commands, instead of their aliases, must be used when
667 defining command defaults. The command defaults will also be applied
667 defining command defaults. The command defaults will also be applied
668 to the aliases of the commands defined.
668 to the aliases of the commands defined.
669
669
670
670
671 ``diff``
671 ``diff``
672 --------
672 --------
673
673
674 Settings used when displaying diffs. Everything except for ``unified``
674 Settings used when displaying diffs. Everything except for ``unified``
675 is a Boolean and defaults to False. See :hg:`help config.annotate`
675 is a Boolean and defaults to False. See :hg:`help config.annotate`
676 for related options for the annotate command.
676 for related options for the annotate command.
677
677
678 ``git``
678 ``git``
679 Use git extended diff format.
679 Use git extended diff format.
680
680
681 ``nobinary``
681 ``nobinary``
682 Omit git binary patches.
682 Omit git binary patches.
683
683
684 ``nodates``
684 ``nodates``
685 Don't include dates in diff headers.
685 Don't include dates in diff headers.
686
686
687 ``noprefix``
687 ``noprefix``
688 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
688 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
689
689
690 ``showfunc``
690 ``showfunc``
691 Show which function each change is in.
691 Show which function each change is in.
692
692
693 ``ignorews``
693 ``ignorews``
694 Ignore white space when comparing lines.
694 Ignore white space when comparing lines.
695
695
696 ``ignorewsamount``
696 ``ignorewsamount``
697 Ignore changes in the amount of white space.
697 Ignore changes in the amount of white space.
698
698
699 ``ignoreblanklines``
699 ``ignoreblanklines``
700 Ignore changes whose lines are all blank.
700 Ignore changes whose lines are all blank.
701
701
702 ``unified``
702 ``unified``
703 Number of lines of context to show.
703 Number of lines of context to show.
704
704
705 ``word-diff``
705 ``word-diff``
706 Highlight changed words.
706 Highlight changed words.
707
707
708 ``email``
708 ``email``
709 ---------
709 ---------
710
710
711 Settings for extensions that send email messages.
711 Settings for extensions that send email messages.
712
712
713 ``from``
713 ``from``
714 Optional. Email address to use in "From" header and SMTP envelope
714 Optional. Email address to use in "From" header and SMTP envelope
715 of outgoing messages.
715 of outgoing messages.
716
716
717 ``to``
717 ``to``
718 Optional. Comma-separated list of recipients' email addresses.
718 Optional. Comma-separated list of recipients' email addresses.
719
719
720 ``cc``
720 ``cc``
721 Optional. Comma-separated list of carbon copy recipients'
721 Optional. Comma-separated list of carbon copy recipients'
722 email addresses.
722 email addresses.
723
723
724 ``bcc``
724 ``bcc``
725 Optional. Comma-separated list of blind carbon copy recipients'
725 Optional. Comma-separated list of blind carbon copy recipients'
726 email addresses.
726 email addresses.
727
727
728 ``method``
728 ``method``
729 Optional. Method to use to send email messages. If value is ``smtp``
729 Optional. Method to use to send email messages. If value is ``smtp``
730 (default), use SMTP (see the ``[smtp]`` section for configuration).
730 (default), use SMTP (see the ``[smtp]`` section for configuration).
731 Otherwise, use as name of program to run that acts like sendmail
731 Otherwise, use as name of program to run that acts like sendmail
732 (takes ``-f`` option for sender, list of recipients on command line,
732 (takes ``-f`` option for sender, list of recipients on command line,
733 message on stdin). Normally, setting this to ``sendmail`` or
733 message on stdin). Normally, setting this to ``sendmail`` or
734 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
734 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
735
735
736 ``charsets``
736 ``charsets``
737 Optional. Comma-separated list of character sets considered
737 Optional. Comma-separated list of character sets considered
738 convenient for recipients. Addresses, headers, and parts not
738 convenient for recipients. Addresses, headers, and parts not
739 containing patches of outgoing messages will be encoded in the
739 containing patches of outgoing messages will be encoded in the
740 first character set to which conversion from local encoding
740 first character set to which conversion from local encoding
741 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
741 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
742 conversion fails, the text in question is sent as is.
742 conversion fails, the text in question is sent as is.
743 (default: '')
743 (default: '')
744
744
745 Order of outgoing email character sets:
745 Order of outgoing email character sets:
746
746
747 1. ``us-ascii``: always first, regardless of settings
747 1. ``us-ascii``: always first, regardless of settings
748 2. ``email.charsets``: in order given by user
748 2. ``email.charsets``: in order given by user
749 3. ``ui.fallbackencoding``: if not in email.charsets
749 3. ``ui.fallbackencoding``: if not in email.charsets
750 4. ``$HGENCODING``: if not in email.charsets
750 4. ``$HGENCODING``: if not in email.charsets
751 5. ``utf-8``: always last, regardless of settings
751 5. ``utf-8``: always last, regardless of settings
752
752
753 Email example::
753 Email example::
754
754
755 [email]
755 [email]
756 from = Joseph User <joe.user@example.com>
756 from = Joseph User <joe.user@example.com>
757 method = /usr/sbin/sendmail
757 method = /usr/sbin/sendmail
758 # charsets for western Europeans
758 # charsets for western Europeans
759 # us-ascii, utf-8 omitted, as they are tried first and last
759 # us-ascii, utf-8 omitted, as they are tried first and last
760 charsets = iso-8859-1, iso-8859-15, windows-1252
760 charsets = iso-8859-1, iso-8859-15, windows-1252
761
761
762
762
763 ``extensions``
763 ``extensions``
764 --------------
764 --------------
765
765
766 Mercurial has an extension mechanism for adding new features. To
766 Mercurial has an extension mechanism for adding new features. To
767 enable an extension, create an entry for it in this section.
767 enable an extension, create an entry for it in this section.
768
768
769 If you know that the extension is already in Python's search path,
769 If you know that the extension is already in Python's search path,
770 you can give the name of the module, followed by ``=``, with nothing
770 you can give the name of the module, followed by ``=``, with nothing
771 after the ``=``.
771 after the ``=``.
772
772
773 Otherwise, give a name that you choose, followed by ``=``, followed by
773 Otherwise, give a name that you choose, followed by ``=``, followed by
774 the path to the ``.py`` file (including the file name extension) that
774 the path to the ``.py`` file (including the file name extension) that
775 defines the extension.
775 defines the extension.
776
776
777 To explicitly disable an extension that is enabled in an hgrc of
777 To explicitly disable an extension that is enabled in an hgrc of
778 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
778 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
779 or ``foo = !`` when path is not supplied.
779 or ``foo = !`` when path is not supplied.
780
780
781 Example for ``~/.hgrc``::
781 Example for ``~/.hgrc``::
782
782
783 [extensions]
783 [extensions]
784 # (the churn extension will get loaded from Mercurial's path)
784 # (the churn extension will get loaded from Mercurial's path)
785 churn =
785 churn =
786 # (this extension will get loaded from the file specified)
786 # (this extension will get loaded from the file specified)
787 myfeature = ~/.hgext/myfeature.py
787 myfeature = ~/.hgext/myfeature.py
788
788
789
789
790 ``format``
790 ``format``
791 ----------
791 ----------
792
792
793 ``usegeneraldelta``
793 ``usegeneraldelta``
794 Enable or disable the "generaldelta" repository format which improves
794 Enable or disable the "generaldelta" repository format which improves
795 repository compression by allowing "revlog" to store delta against arbitrary
795 repository compression by allowing "revlog" to store delta against arbitrary
796 revision instead of the previous stored one. This provides significant
796 revision instead of the previous stored one. This provides significant
797 improvement for repositories with branches.
797 improvement for repositories with branches.
798
798
799 Repositories with this on-disk format require Mercurial version 1.9.
799 Repositories with this on-disk format require Mercurial version 1.9.
800
800
801 Enabled by default.
801 Enabled by default.
802
802
803 ``dotencode``
803 ``dotencode``
804 Enable or disable the "dotencode" repository format which enhances
804 Enable or disable the "dotencode" repository format which enhances
805 the "fncache" repository format (which has to be enabled to use
805 the "fncache" repository format (which has to be enabled to use
806 dotencode) to avoid issues with filenames starting with ._ on
806 dotencode) to avoid issues with filenames starting with ._ on
807 Mac OS X and spaces on Windows.
807 Mac OS X and spaces on Windows.
808
808
809 Repositories with this on-disk format require Mercurial version 1.7.
809 Repositories with this on-disk format require Mercurial version 1.7.
810
810
811 Enabled by default.
811 Enabled by default.
812
812
813 ``usefncache``
813 ``usefncache``
814 Enable or disable the "fncache" repository format which enhances
814 Enable or disable the "fncache" repository format which enhances
815 the "store" repository format (which has to be enabled to use
815 the "store" repository format (which has to be enabled to use
816 fncache) to allow longer filenames and avoids using Windows
816 fncache) to allow longer filenames and avoids using Windows
817 reserved names, e.g. "nul".
817 reserved names, e.g. "nul".
818
818
819 Repositories with this on-disk format require Mercurial version 1.1.
819 Repositories with this on-disk format require Mercurial version 1.1.
820
820
821 Enabled by default.
821 Enabled by default.
822
822
823 ``usestore``
823 ``usestore``
824 Enable or disable the "store" repository format which improves
824 Enable or disable the "store" repository format which improves
825 compatibility with systems that fold case or otherwise mangle
825 compatibility with systems that fold case or otherwise mangle
826 filenames. Disabling this option will allow you to store longer filenames
826 filenames. Disabling this option will allow you to store longer filenames
827 in some situations at the expense of compatibility.
827 in some situations at the expense of compatibility.
828
828
829 Repositories with this on-disk format require Mercurial version 0.9.4.
829 Repositories with this on-disk format require Mercurial version 0.9.4.
830
830
831 Enabled by default.
831 Enabled by default.
832
832
833 ``graph``
833 ``graph``
834 ---------
834 ---------
835
835
836 Web graph view configuration. This section let you change graph
836 Web graph view configuration. This section let you change graph
837 elements display properties by branches, for instance to make the
837 elements display properties by branches, for instance to make the
838 ``default`` branch stand out.
838 ``default`` branch stand out.
839
839
840 Each line has the following format::
840 Each line has the following format::
841
841
842 <branch>.<argument> = <value>
842 <branch>.<argument> = <value>
843
843
844 where ``<branch>`` is the name of the branch being
844 where ``<branch>`` is the name of the branch being
845 customized. Example::
845 customized. Example::
846
846
847 [graph]
847 [graph]
848 # 2px width
848 # 2px width
849 default.width = 2
849 default.width = 2
850 # red color
850 # red color
851 default.color = FF0000
851 default.color = FF0000
852
852
853 Supported arguments:
853 Supported arguments:
854
854
855 ``width``
855 ``width``
856 Set branch edges width in pixels.
856 Set branch edges width in pixels.
857
857
858 ``color``
858 ``color``
859 Set branch edges color in hexadecimal RGB notation.
859 Set branch edges color in hexadecimal RGB notation.
860
860
861 ``hooks``
861 ``hooks``
862 ---------
862 ---------
863
863
864 Commands or Python functions that get automatically executed by
864 Commands or Python functions that get automatically executed by
865 various actions such as starting or finishing a commit. Multiple
865 various actions such as starting or finishing a commit. Multiple
866 hooks can be run for the same action by appending a suffix to the
866 hooks can be run for the same action by appending a suffix to the
867 action. Overriding a site-wide hook can be done by changing its
867 action. Overriding a site-wide hook can be done by changing its
868 value or setting it to an empty string. Hooks can be prioritized
868 value or setting it to an empty string. Hooks can be prioritized
869 by adding a prefix of ``priority.`` to the hook name on a new line
869 by adding a prefix of ``priority.`` to the hook name on a new line
870 and setting the priority. The default priority is 0.
870 and setting the priority. The default priority is 0.
871
871
872 Example ``.hg/hgrc``::
872 Example ``.hg/hgrc``::
873
873
874 [hooks]
874 [hooks]
875 # update working directory after adding changesets
875 # update working directory after adding changesets
876 changegroup.update = hg update
876 changegroup.update = hg update
877 # do not use the site-wide hook
877 # do not use the site-wide hook
878 incoming =
878 incoming =
879 incoming.email = /my/email/hook
879 incoming.email = /my/email/hook
880 incoming.autobuild = /my/build/hook
880 incoming.autobuild = /my/build/hook
881 # force autobuild hook to run before other incoming hooks
881 # force autobuild hook to run before other incoming hooks
882 priority.incoming.autobuild = 1
882 priority.incoming.autobuild = 1
883
883
884 Most hooks are run with environment variables set that give useful
884 Most hooks are run with environment variables set that give useful
885 additional information. For each hook below, the environment variables
885 additional information. For each hook below, the environment variables
886 it is passed are listed with names in the form ``$HG_foo``. The
886 it is passed are listed with names in the form ``$HG_foo``. The
887 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
887 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
888 They contain the type of hook which triggered the run and the full name
888 They contain the type of hook which triggered the run and the full name
889 of the hook in the config, respectively. In the example above, this will
889 of the hook in the config, respectively. In the example above, this will
890 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
890 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
891
891
892 .. container:: windows
892 .. container:: windows
893
893
894 Some basic Unix syntax can be enabled for portability, including ``$VAR``
894 Some basic Unix syntax can be enabled for portability, including ``$VAR``
895 and ``${VAR}`` style variables. To use a literal ``$``, it must be
895 and ``${VAR}`` style variables. A ``~`` followed by ``\`` or ``/`` will
896 escaped with a back slash or inside of a strong quote. Strong quotes
896 be expanded to ``%USERPROFILE%`` to simulate a subset of tilde expansion
897 will be replaced by double quotes after processing.
897 on Unix. To use a literal ``$`` or ``~``, it must be escaped with a back
898 slash or inside of a strong quote. Strong quotes will be replaced by
899 double quotes after processing.
898
900
899 This feature is enabled by adding a prefix of ``tonative.`` to the hook
901 This feature is enabled by adding a prefix of ``tonative.`` to the hook
900 name on a new line, and setting it to ``True``. For example::
902 name on a new line, and setting it to ``True``. For example::
901
903
902 [hooks]
904 [hooks]
903 incoming.autobuild = /my/build/hook
905 incoming.autobuild = /my/build/hook
904 # enable translation to cmd.exe syntax for autobuild hook
906 # enable translation to cmd.exe syntax for autobuild hook
905 tonative.incoming.autobuild = True
907 tonative.incoming.autobuild = True
906
908
907 ``changegroup``
909 ``changegroup``
908 Run after a changegroup has been added via push, pull or unbundle. The ID of
910 Run after a changegroup has been added via push, pull or unbundle. The ID of
909 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
911 the first new changeset is in ``$HG_NODE`` and last is in ``$HG_NODE_LAST``.
910 The URL from which changes came is in ``$HG_URL``.
912 The URL from which changes came is in ``$HG_URL``.
911
913
912 ``commit``
914 ``commit``
913 Run after a changeset has been created in the local repository. The ID
915 Run after a changeset has been created in the local repository. The ID
914 of the newly created changeset is in ``$HG_NODE``. Parent changeset
916 of the newly created changeset is in ``$HG_NODE``. Parent changeset
915 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
917 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
916
918
917 ``incoming``
919 ``incoming``
918 Run after a changeset has been pulled, pushed, or unbundled into
920 Run after a changeset has been pulled, pushed, or unbundled into
919 the local repository. The ID of the newly arrived changeset is in
921 the local repository. The ID of the newly arrived changeset is in
920 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
922 ``$HG_NODE``. The URL that was source of the changes is in ``$HG_URL``.
921
923
922 ``outgoing``
924 ``outgoing``
923 Run after sending changes from the local repository to another. The ID of
925 Run after sending changes from the local repository to another. The ID of
924 first changeset sent is in ``$HG_NODE``. The source of operation is in
926 first changeset sent is in ``$HG_NODE``. The source of operation is in
925 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
927 ``$HG_SOURCE``. Also see :hg:`help config.hooks.preoutgoing`.
926
928
927 ``post-<command>``
929 ``post-<command>``
928 Run after successful invocations of the associated command. The
930 Run after successful invocations of the associated command. The
929 contents of the command line are passed as ``$HG_ARGS`` and the result
931 contents of the command line are passed as ``$HG_ARGS`` and the result
930 code in ``$HG_RESULT``. Parsed command line arguments are passed as
932 code in ``$HG_RESULT``. Parsed command line arguments are passed as
931 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
933 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
932 the python data internally passed to <command>. ``$HG_OPTS`` is a
934 the python data internally passed to <command>. ``$HG_OPTS`` is a
933 dictionary of options (with unspecified options set to their defaults).
935 dictionary of options (with unspecified options set to their defaults).
934 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
936 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
935
937
936 ``fail-<command>``
938 ``fail-<command>``
937 Run after a failed invocation of an associated command. The contents
939 Run after a failed invocation of an associated command. The contents
938 of the command line are passed as ``$HG_ARGS``. Parsed command line
940 of the command line are passed as ``$HG_ARGS``. Parsed command line
939 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
941 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
940 string representations of the python data internally passed to
942 string representations of the python data internally passed to
941 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
943 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
942 options set to their defaults). ``$HG_PATS`` is a list of arguments.
944 options set to their defaults). ``$HG_PATS`` is a list of arguments.
943 Hook failure is ignored.
945 Hook failure is ignored.
944
946
945 ``pre-<command>``
947 ``pre-<command>``
946 Run before executing the associated command. The contents of the
948 Run before executing the associated command. The contents of the
947 command line are passed as ``$HG_ARGS``. Parsed command line arguments
949 command line are passed as ``$HG_ARGS``. Parsed command line arguments
948 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
950 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
949 representations of the data internally passed to <command>. ``$HG_OPTS``
951 representations of the data internally passed to <command>. ``$HG_OPTS``
950 is a dictionary of options (with unspecified options set to their
952 is a dictionary of options (with unspecified options set to their
951 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
953 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
952 failure, the command doesn't execute and Mercurial returns the failure
954 failure, the command doesn't execute and Mercurial returns the failure
953 code.
955 code.
954
956
955 ``prechangegroup``
957 ``prechangegroup``
956 Run before a changegroup is added via push, pull or unbundle. Exit
958 Run before a changegroup is added via push, pull or unbundle. Exit
957 status 0 allows the changegroup to proceed. A non-zero status will
959 status 0 allows the changegroup to proceed. A non-zero status will
958 cause the push, pull or unbundle to fail. The URL from which changes
960 cause the push, pull or unbundle to fail. The URL from which changes
959 will come is in ``$HG_URL``.
961 will come is in ``$HG_URL``.
960
962
961 ``precommit``
963 ``precommit``
962 Run before starting a local commit. Exit status 0 allows the
964 Run before starting a local commit. Exit status 0 allows the
963 commit to proceed. A non-zero status will cause the commit to fail.
965 commit to proceed. A non-zero status will cause the commit to fail.
964 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
966 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
965
967
966 ``prelistkeys``
968 ``prelistkeys``
967 Run before listing pushkeys (like bookmarks) in the
969 Run before listing pushkeys (like bookmarks) in the
968 repository. A non-zero status will cause failure. The key namespace is
970 repository. A non-zero status will cause failure. The key namespace is
969 in ``$HG_NAMESPACE``.
971 in ``$HG_NAMESPACE``.
970
972
971 ``preoutgoing``
973 ``preoutgoing``
972 Run before collecting changes to send from the local repository to
974 Run before collecting changes to send from the local repository to
973 another. A non-zero status will cause failure. This lets you prevent
975 another. A non-zero status will cause failure. This lets you prevent
974 pull over HTTP or SSH. It can also prevent propagating commits (via
976 pull over HTTP or SSH. It can also prevent propagating commits (via
975 local pull, push (outbound) or bundle commands), but not completely,
977 local pull, push (outbound) or bundle commands), but not completely,
976 since you can just copy files instead. The source of operation is in
978 since you can just copy files instead. The source of operation is in
977 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
979 ``$HG_SOURCE``. If "serve", the operation is happening on behalf of a remote
978 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
980 SSH or HTTP repository. If "push", "pull" or "bundle", the operation
979 is happening on behalf of a repository on same system.
981 is happening on behalf of a repository on same system.
980
982
981 ``prepushkey``
983 ``prepushkey``
982 Run before a pushkey (like a bookmark) is added to the
984 Run before a pushkey (like a bookmark) is added to the
983 repository. A non-zero status will cause the key to be rejected. The
985 repository. A non-zero status will cause the key to be rejected. The
984 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
986 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
985 the old value (if any) is in ``$HG_OLD``, and the new value is in
987 the old value (if any) is in ``$HG_OLD``, and the new value is in
986 ``$HG_NEW``.
988 ``$HG_NEW``.
987
989
988 ``pretag``
990 ``pretag``
989 Run before creating a tag. Exit status 0 allows the tag to be
991 Run before creating a tag. Exit status 0 allows the tag to be
990 created. A non-zero status will cause the tag to fail. The ID of the
992 created. A non-zero status will cause the tag to fail. The ID of the
991 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
993 changeset to tag is in ``$HG_NODE``. The name of tag is in ``$HG_TAG``. The
992 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
994 tag is local if ``$HG_LOCAL=1``, or in the repository if ``$HG_LOCAL=0``.
993
995
994 ``pretxnopen``
996 ``pretxnopen``
995 Run before any new repository transaction is open. The reason for the
997 Run before any new repository transaction is open. The reason for the
996 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
998 transaction will be in ``$HG_TXNNAME``, and a unique identifier for the
997 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
999 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
998 transaction from being opened.
1000 transaction from being opened.
999
1001
1000 ``pretxnclose``
1002 ``pretxnclose``
1001 Run right before the transaction is actually finalized. Any repository change
1003 Run right before the transaction is actually finalized. Any repository change
1002 will be visible to the hook program. This lets you validate the transaction
1004 will be visible to the hook program. This lets you validate the transaction
1003 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1005 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1004 status will cause the transaction to be rolled back. The reason for the
1006 status will cause the transaction to be rolled back. The reason for the
1005 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1007 transaction opening will be in ``$HG_TXNNAME``, and a unique identifier for
1006 the transaction will be in ``HG_TXNID``. The rest of the available data will
1008 the transaction will be in ``HG_TXNID``. The rest of the available data will
1007 vary according the transaction type. New changesets will add ``$HG_NODE``
1009 vary according the transaction type. New changesets will add ``$HG_NODE``
1008 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
1010 (the ID of the first added changeset), ``$HG_NODE_LAST`` (the ID of the last
1009 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
1011 added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables. Bookmark and
1010 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
1012 phase changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``
1011 respectively, etc.
1013 respectively, etc.
1012
1014
1013 ``pretxnclose-bookmark``
1015 ``pretxnclose-bookmark``
1014 Run right before a bookmark change is actually finalized. Any repository
1016 Run right before a bookmark change is actually finalized. Any repository
1015 change will be visible to the hook program. This lets you validate the
1017 change will be visible to the hook program. This lets you validate the
1016 transaction content or change it. Exit status 0 allows the commit to
1018 transaction content or change it. Exit status 0 allows the commit to
1017 proceed. A non-zero status will cause the transaction to be rolled back.
1019 proceed. A non-zero status will cause the transaction to be rolled back.
1018 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1020 The name of the bookmark will be available in ``$HG_BOOKMARK``, the new
1019 bookmark location will be available in ``$HG_NODE`` while the previous
1021 bookmark location will be available in ``$HG_NODE`` while the previous
1020 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1022 location will be available in ``$HG_OLDNODE``. In case of a bookmark
1021 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1023 creation ``$HG_OLDNODE`` will be empty. In case of deletion ``$HG_NODE``
1022 will be empty.
1024 will be empty.
1023 In addition, the reason for the transaction opening will be in
1025 In addition, the reason for the transaction opening will be in
1024 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1026 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1025 ``HG_TXNID``.
1027 ``HG_TXNID``.
1026
1028
1027 ``pretxnclose-phase``
1029 ``pretxnclose-phase``
1028 Run right before a phase change is actually finalized. Any repository change
1030 Run right before a phase change is actually finalized. Any repository change
1029 will be visible to the hook program. This lets you validate the transaction
1031 will be visible to the hook program. This lets you validate the transaction
1030 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1032 content or change it. Exit status 0 allows the commit to proceed. A non-zero
1031 status will cause the transaction to be rolled back. The hook is called
1033 status will cause the transaction to be rolled back. The hook is called
1032 multiple times, once for each revision affected by a phase change.
1034 multiple times, once for each revision affected by a phase change.
1033 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1035 The affected node is available in ``$HG_NODE``, the phase in ``$HG_PHASE``
1034 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1036 while the previous ``$HG_OLDPHASE``. In case of new node, ``$HG_OLDPHASE``
1035 will be empty. In addition, the reason for the transaction opening will be in
1037 will be empty. In addition, the reason for the transaction opening will be in
1036 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1038 ``$HG_TXNNAME``, and a unique identifier for the transaction will be in
1037 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1039 ``HG_TXNID``. The hook is also run for newly added revisions. In this case
1038 the ``$HG_OLDPHASE`` entry will be empty.
1040 the ``$HG_OLDPHASE`` entry will be empty.
1039
1041
1040 ``txnclose``
1042 ``txnclose``
1041 Run after any repository transaction has been committed. At this
1043 Run after any repository transaction has been committed. At this
1042 point, the transaction can no longer be rolled back. The hook will run
1044 point, the transaction can no longer be rolled back. The hook will run
1043 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1045 after the lock is released. See :hg:`help config.hooks.pretxnclose` for
1044 details about available variables.
1046 details about available variables.
1045
1047
1046 ``txnclose-bookmark``
1048 ``txnclose-bookmark``
1047 Run after any bookmark change has been committed. At this point, the
1049 Run after any bookmark change has been committed. At this point, the
1048 transaction can no longer be rolled back. The hook will run after the lock
1050 transaction can no longer be rolled back. The hook will run after the lock
1049 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1051 is released. See :hg:`help config.hooks.pretxnclose-bookmark` for details
1050 about available variables.
1052 about available variables.
1051
1053
1052 ``txnclose-phase``
1054 ``txnclose-phase``
1053 Run after any phase change has been committed. At this point, the
1055 Run after any phase change has been committed. At this point, the
1054 transaction can no longer be rolled back. The hook will run after the lock
1056 transaction can no longer be rolled back. The hook will run after the lock
1055 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1057 is released. See :hg:`help config.hooks.pretxnclose-phase` for details about
1056 available variables.
1058 available variables.
1057
1059
1058 ``txnabort``
1060 ``txnabort``
1059 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1061 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
1060 for details about available variables.
1062 for details about available variables.
1061
1063
1062 ``pretxnchangegroup``
1064 ``pretxnchangegroup``
1063 Run after a changegroup has been added via push, pull or unbundle, but before
1065 Run after a changegroup has been added via push, pull or unbundle, but before
1064 the transaction has been committed. The changegroup is visible to the hook
1066 the transaction has been committed. The changegroup is visible to the hook
1065 program. This allows validation of incoming changes before accepting them.
1067 program. This allows validation of incoming changes before accepting them.
1066 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1068 The ID of the first new changeset is in ``$HG_NODE`` and last is in
1067 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1069 ``$HG_NODE_LAST``. Exit status 0 allows the transaction to commit. A non-zero
1068 status will cause the transaction to be rolled back, and the push, pull or
1070 status will cause the transaction to be rolled back, and the push, pull or
1069 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1071 unbundle will fail. The URL that was the source of changes is in ``$HG_URL``.
1070
1072
1071 ``pretxncommit``
1073 ``pretxncommit``
1072 Run after a changeset has been created, but before the transaction is
1074 Run after a changeset has been created, but before the transaction is
1073 committed. The changeset is visible to the hook program. This allows
1075 committed. The changeset is visible to the hook program. This allows
1074 validation of the commit message and changes. Exit status 0 allows the
1076 validation of the commit message and changes. Exit status 0 allows the
1075 commit to proceed. A non-zero status will cause the transaction to
1077 commit to proceed. A non-zero status will cause the transaction to
1076 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1078 be rolled back. The ID of the new changeset is in ``$HG_NODE``. The parent
1077 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1079 changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1078
1080
1079 ``preupdate``
1081 ``preupdate``
1080 Run before updating the working directory. Exit status 0 allows
1082 Run before updating the working directory. Exit status 0 allows
1081 the update to proceed. A non-zero status will prevent the update.
1083 the update to proceed. A non-zero status will prevent the update.
1082 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1084 The changeset ID of first new parent is in ``$HG_PARENT1``. If updating to a
1083 merge, the ID of second new parent is in ``$HG_PARENT2``.
1085 merge, the ID of second new parent is in ``$HG_PARENT2``.
1084
1086
1085 ``listkeys``
1087 ``listkeys``
1086 Run after listing pushkeys (like bookmarks) in the repository. The
1088 Run after listing pushkeys (like bookmarks) in the repository. The
1087 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1089 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1088 dictionary containing the keys and values.
1090 dictionary containing the keys and values.
1089
1091
1090 ``pushkey``
1092 ``pushkey``
1091 Run after a pushkey (like a bookmark) is added to the
1093 Run after a pushkey (like a bookmark) is added to the
1092 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1094 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1093 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1095 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1094 value is in ``$HG_NEW``.
1096 value is in ``$HG_NEW``.
1095
1097
1096 ``tag``
1098 ``tag``
1097 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1099 Run after a tag is created. The ID of the tagged changeset is in ``$HG_NODE``.
1098 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1100 The name of tag is in ``$HG_TAG``. The tag is local if ``$HG_LOCAL=1``, or in
1099 the repository if ``$HG_LOCAL=0``.
1101 the repository if ``$HG_LOCAL=0``.
1100
1102
1101 ``update``
1103 ``update``
1102 Run after updating the working directory. The changeset ID of first
1104 Run after updating the working directory. The changeset ID of first
1103 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1105 new parent is in ``$HG_PARENT1``. If updating to a merge, the ID of second new
1104 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1106 parent is in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1105 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1107 update failed (e.g. because conflicts were not resolved), ``$HG_ERROR=1``.
1106
1108
1107 .. note::
1109 .. note::
1108
1110
1109 It is generally better to use standard hooks rather than the
1111 It is generally better to use standard hooks rather than the
1110 generic pre- and post- command hooks, as they are guaranteed to be
1112 generic pre- and post- command hooks, as they are guaranteed to be
1111 called in the appropriate contexts for influencing transactions.
1113 called in the appropriate contexts for influencing transactions.
1112 Also, hooks like "commit" will be called in all contexts that
1114 Also, hooks like "commit" will be called in all contexts that
1113 generate a commit (e.g. tag) and not just the commit command.
1115 generate a commit (e.g. tag) and not just the commit command.
1114
1116
1115 .. note::
1117 .. note::
1116
1118
1117 Environment variables with empty values may not be passed to
1119 Environment variables with empty values may not be passed to
1118 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1120 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1119 will have an empty value under Unix-like platforms for non-merge
1121 will have an empty value under Unix-like platforms for non-merge
1120 changesets, while it will not be available at all under Windows.
1122 changesets, while it will not be available at all under Windows.
1121
1123
1122 The syntax for Python hooks is as follows::
1124 The syntax for Python hooks is as follows::
1123
1125
1124 hookname = python:modulename.submodule.callable
1126 hookname = python:modulename.submodule.callable
1125 hookname = python:/path/to/python/module.py:callable
1127 hookname = python:/path/to/python/module.py:callable
1126
1128
1127 Python hooks are run within the Mercurial process. Each hook is
1129 Python hooks are run within the Mercurial process. Each hook is
1128 called with at least three keyword arguments: a ui object (keyword
1130 called with at least three keyword arguments: a ui object (keyword
1129 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1131 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1130 keyword that tells what kind of hook is used. Arguments listed as
1132 keyword that tells what kind of hook is used. Arguments listed as
1131 environment variables above are passed as keyword arguments, with no
1133 environment variables above are passed as keyword arguments, with no
1132 ``HG_`` prefix, and names in lower case.
1134 ``HG_`` prefix, and names in lower case.
1133
1135
1134 If a Python hook returns a "true" value or raises an exception, this
1136 If a Python hook returns a "true" value or raises an exception, this
1135 is treated as a failure.
1137 is treated as a failure.
1136
1138
1137
1139
1138 ``hostfingerprints``
1140 ``hostfingerprints``
1139 --------------------
1141 --------------------
1140
1142
1141 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1143 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1142
1144
1143 Fingerprints of the certificates of known HTTPS servers.
1145 Fingerprints of the certificates of known HTTPS servers.
1144
1146
1145 A HTTPS connection to a server with a fingerprint configured here will
1147 A HTTPS connection to a server with a fingerprint configured here will
1146 only succeed if the servers certificate matches the fingerprint.
1148 only succeed if the servers certificate matches the fingerprint.
1147 This is very similar to how ssh known hosts works.
1149 This is very similar to how ssh known hosts works.
1148
1150
1149 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1151 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1150 Multiple values can be specified (separated by spaces or commas). This can
1152 Multiple values can be specified (separated by spaces or commas). This can
1151 be used to define both old and new fingerprints while a host transitions
1153 be used to define both old and new fingerprints while a host transitions
1152 to a new certificate.
1154 to a new certificate.
1153
1155
1154 The CA chain and web.cacerts is not used for servers with a fingerprint.
1156 The CA chain and web.cacerts is not used for servers with a fingerprint.
1155
1157
1156 For example::
1158 For example::
1157
1159
1158 [hostfingerprints]
1160 [hostfingerprints]
1159 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1161 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1160 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1162 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1161
1163
1162 ``hostsecurity``
1164 ``hostsecurity``
1163 ----------------
1165 ----------------
1164
1166
1165 Used to specify global and per-host security settings for connecting to
1167 Used to specify global and per-host security settings for connecting to
1166 other machines.
1168 other machines.
1167
1169
1168 The following options control default behavior for all hosts.
1170 The following options control default behavior for all hosts.
1169
1171
1170 ``ciphers``
1172 ``ciphers``
1171 Defines the cryptographic ciphers to use for connections.
1173 Defines the cryptographic ciphers to use for connections.
1172
1174
1173 Value must be a valid OpenSSL Cipher List Format as documented at
1175 Value must be a valid OpenSSL Cipher List Format as documented at
1174 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1176 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1175
1177
1176 This setting is for advanced users only. Setting to incorrect values
1178 This setting is for advanced users only. Setting to incorrect values
1177 can significantly lower connection security or decrease performance.
1179 can significantly lower connection security or decrease performance.
1178 You have been warned.
1180 You have been warned.
1179
1181
1180 This option requires Python 2.7.
1182 This option requires Python 2.7.
1181
1183
1182 ``minimumprotocol``
1184 ``minimumprotocol``
1183 Defines the minimum channel encryption protocol to use.
1185 Defines the minimum channel encryption protocol to use.
1184
1186
1185 By default, the highest version of TLS supported by both client and server
1187 By default, the highest version of TLS supported by both client and server
1186 is used.
1188 is used.
1187
1189
1188 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1190 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1189
1191
1190 When running on an old Python version, only ``tls1.0`` is allowed since
1192 When running on an old Python version, only ``tls1.0`` is allowed since
1191 old versions of Python only support up to TLS 1.0.
1193 old versions of Python only support up to TLS 1.0.
1192
1194
1193 When running a Python that supports modern TLS versions, the default is
1195 When running a Python that supports modern TLS versions, the default is
1194 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1196 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1195 weakens security and should only be used as a feature of last resort if
1197 weakens security and should only be used as a feature of last resort if
1196 a server does not support TLS 1.1+.
1198 a server does not support TLS 1.1+.
1197
1199
1198 Options in the ``[hostsecurity]`` section can have the form
1200 Options in the ``[hostsecurity]`` section can have the form
1199 ``hostname``:``setting``. This allows multiple settings to be defined on a
1201 ``hostname``:``setting``. This allows multiple settings to be defined on a
1200 per-host basis.
1202 per-host basis.
1201
1203
1202 The following per-host settings can be defined.
1204 The following per-host settings can be defined.
1203
1205
1204 ``ciphers``
1206 ``ciphers``
1205 This behaves like ``ciphers`` as described above except it only applies
1207 This behaves like ``ciphers`` as described above except it only applies
1206 to the host on which it is defined.
1208 to the host on which it is defined.
1207
1209
1208 ``fingerprints``
1210 ``fingerprints``
1209 A list of hashes of the DER encoded peer/remote certificate. Values have
1211 A list of hashes of the DER encoded peer/remote certificate. Values have
1210 the form ``algorithm``:``fingerprint``. e.g.
1212 the form ``algorithm``:``fingerprint``. e.g.
1211 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1213 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1212 In addition, colons (``:``) can appear in the fingerprint part.
1214 In addition, colons (``:``) can appear in the fingerprint part.
1213
1215
1214 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1216 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1215 ``sha512``.
1217 ``sha512``.
1216
1218
1217 Use of ``sha256`` or ``sha512`` is preferred.
1219 Use of ``sha256`` or ``sha512`` is preferred.
1218
1220
1219 If a fingerprint is specified, the CA chain is not validated for this
1221 If a fingerprint is specified, the CA chain is not validated for this
1220 host and Mercurial will require the remote certificate to match one
1222 host and Mercurial will require the remote certificate to match one
1221 of the fingerprints specified. This means if the server updates its
1223 of the fingerprints specified. This means if the server updates its
1222 certificate, Mercurial will abort until a new fingerprint is defined.
1224 certificate, Mercurial will abort until a new fingerprint is defined.
1223 This can provide stronger security than traditional CA-based validation
1225 This can provide stronger security than traditional CA-based validation
1224 at the expense of convenience.
1226 at the expense of convenience.
1225
1227
1226 This option takes precedence over ``verifycertsfile``.
1228 This option takes precedence over ``verifycertsfile``.
1227
1229
1228 ``minimumprotocol``
1230 ``minimumprotocol``
1229 This behaves like ``minimumprotocol`` as described above except it
1231 This behaves like ``minimumprotocol`` as described above except it
1230 only applies to the host on which it is defined.
1232 only applies to the host on which it is defined.
1231
1233
1232 ``verifycertsfile``
1234 ``verifycertsfile``
1233 Path to file a containing a list of PEM encoded certificates used to
1235 Path to file a containing a list of PEM encoded certificates used to
1234 verify the server certificate. Environment variables and ``~user``
1236 verify the server certificate. Environment variables and ``~user``
1235 constructs are expanded in the filename.
1237 constructs are expanded in the filename.
1236
1238
1237 The server certificate or the certificate's certificate authority (CA)
1239 The server certificate or the certificate's certificate authority (CA)
1238 must match a certificate from this file or certificate verification
1240 must match a certificate from this file or certificate verification
1239 will fail and connections to the server will be refused.
1241 will fail and connections to the server will be refused.
1240
1242
1241 If defined, only certificates provided by this file will be used:
1243 If defined, only certificates provided by this file will be used:
1242 ``web.cacerts`` and any system/default certificates will not be
1244 ``web.cacerts`` and any system/default certificates will not be
1243 used.
1245 used.
1244
1246
1245 This option has no effect if the per-host ``fingerprints`` option
1247 This option has no effect if the per-host ``fingerprints`` option
1246 is set.
1248 is set.
1247
1249
1248 The format of the file is as follows::
1250 The format of the file is as follows::
1249
1251
1250 -----BEGIN CERTIFICATE-----
1252 -----BEGIN CERTIFICATE-----
1251 ... (certificate in base64 PEM encoding) ...
1253 ... (certificate in base64 PEM encoding) ...
1252 -----END CERTIFICATE-----
1254 -----END CERTIFICATE-----
1253 -----BEGIN CERTIFICATE-----
1255 -----BEGIN CERTIFICATE-----
1254 ... (certificate in base64 PEM encoding) ...
1256 ... (certificate in base64 PEM encoding) ...
1255 -----END CERTIFICATE-----
1257 -----END CERTIFICATE-----
1256
1258
1257 For example::
1259 For example::
1258
1260
1259 [hostsecurity]
1261 [hostsecurity]
1260 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1262 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1261 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1263 hg2.example.com:fingerprints = sha1:914f1aff87249c09b6859b88b1906d30756491ca, sha1:fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1262 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1264 hg3.example.com:fingerprints = sha256:9a:b0:dc:e2:75:ad:8a:b7:84:58:e5:1f:07:32:f1:87:e6:bd:24:22:af:b7:ce:8e:9c:b4:10:cf:b9:f4:0e:d2
1263 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1265 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1264
1266
1265 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1267 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1266 when connecting to ``hg.example.com``::
1268 when connecting to ``hg.example.com``::
1267
1269
1268 [hostsecurity]
1270 [hostsecurity]
1269 minimumprotocol = tls1.2
1271 minimumprotocol = tls1.2
1270 hg.example.com:minimumprotocol = tls1.1
1272 hg.example.com:minimumprotocol = tls1.1
1271
1273
1272 ``http_proxy``
1274 ``http_proxy``
1273 --------------
1275 --------------
1274
1276
1275 Used to access web-based Mercurial repositories through a HTTP
1277 Used to access web-based Mercurial repositories through a HTTP
1276 proxy.
1278 proxy.
1277
1279
1278 ``host``
1280 ``host``
1279 Host name and (optional) port of the proxy server, for example
1281 Host name and (optional) port of the proxy server, for example
1280 "myproxy:8000".
1282 "myproxy:8000".
1281
1283
1282 ``no``
1284 ``no``
1283 Optional. Comma-separated list of host names that should bypass
1285 Optional. Comma-separated list of host names that should bypass
1284 the proxy.
1286 the proxy.
1285
1287
1286 ``passwd``
1288 ``passwd``
1287 Optional. Password to authenticate with at the proxy server.
1289 Optional. Password to authenticate with at the proxy server.
1288
1290
1289 ``user``
1291 ``user``
1290 Optional. User name to authenticate with at the proxy server.
1292 Optional. User name to authenticate with at the proxy server.
1291
1293
1292 ``always``
1294 ``always``
1293 Optional. Always use the proxy, even for localhost and any entries
1295 Optional. Always use the proxy, even for localhost and any entries
1294 in ``http_proxy.no``. (default: False)
1296 in ``http_proxy.no``. (default: False)
1295
1297
1296 ``merge``
1298 ``merge``
1297 ---------
1299 ---------
1298
1300
1299 This section specifies behavior during merges and updates.
1301 This section specifies behavior during merges and updates.
1300
1302
1301 ``checkignored``
1303 ``checkignored``
1302 Controls behavior when an ignored file on disk has the same name as a tracked
1304 Controls behavior when an ignored file on disk has the same name as a tracked
1303 file in the changeset being merged or updated to, and has different
1305 file in the changeset being merged or updated to, and has different
1304 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1306 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1305 abort on such files. With ``warn``, warn on such files and back them up as
1307 abort on such files. With ``warn``, warn on such files and back them up as
1306 ``.orig``. With ``ignore``, don't print a warning and back them up as
1308 ``.orig``. With ``ignore``, don't print a warning and back them up as
1307 ``.orig``. (default: ``abort``)
1309 ``.orig``. (default: ``abort``)
1308
1310
1309 ``checkunknown``
1311 ``checkunknown``
1310 Controls behavior when an unknown file that isn't ignored has the same name
1312 Controls behavior when an unknown file that isn't ignored has the same name
1311 as a tracked file in the changeset being merged or updated to, and has
1313 as a tracked file in the changeset being merged or updated to, and has
1312 different contents. Similar to ``merge.checkignored``, except for files that
1314 different contents. Similar to ``merge.checkignored``, except for files that
1313 are not ignored. (default: ``abort``)
1315 are not ignored. (default: ``abort``)
1314
1316
1315 ``on-failure``
1317 ``on-failure``
1316 When set to ``continue`` (the default), the merge process attempts to
1318 When set to ``continue`` (the default), the merge process attempts to
1317 merge all unresolved files using the merge chosen tool, regardless of
1319 merge all unresolved files using the merge chosen tool, regardless of
1318 whether previous file merge attempts during the process succeeded or not.
1320 whether previous file merge attempts during the process succeeded or not.
1319 Setting this to ``prompt`` will prompt after any merge failure continue
1321 Setting this to ``prompt`` will prompt after any merge failure continue
1320 or halt the merge process. Setting this to ``halt`` will automatically
1322 or halt the merge process. Setting this to ``halt`` will automatically
1321 halt the merge process on any merge tool failure. The merge process
1323 halt the merge process on any merge tool failure. The merge process
1322 can be restarted by using the ``resolve`` command. When a merge is
1324 can be restarted by using the ``resolve`` command. When a merge is
1323 halted, the repository is left in a normal ``unresolved`` merge state.
1325 halted, the repository is left in a normal ``unresolved`` merge state.
1324 (default: ``continue``)
1326 (default: ``continue``)
1325
1327
1326 ``merge-patterns``
1328 ``merge-patterns``
1327 ------------------
1329 ------------------
1328
1330
1329 This section specifies merge tools to associate with particular file
1331 This section specifies merge tools to associate with particular file
1330 patterns. Tools matched here will take precedence over the default
1332 patterns. Tools matched here will take precedence over the default
1331 merge tool. Patterns are globs by default, rooted at the repository
1333 merge tool. Patterns are globs by default, rooted at the repository
1332 root.
1334 root.
1333
1335
1334 Example::
1336 Example::
1335
1337
1336 [merge-patterns]
1338 [merge-patterns]
1337 **.c = kdiff3
1339 **.c = kdiff3
1338 **.jpg = myimgmerge
1340 **.jpg = myimgmerge
1339
1341
1340 ``merge-tools``
1342 ``merge-tools``
1341 ---------------
1343 ---------------
1342
1344
1343 This section configures external merge tools to use for file-level
1345 This section configures external merge tools to use for file-level
1344 merges. This section has likely been preconfigured at install time.
1346 merges. This section has likely been preconfigured at install time.
1345 Use :hg:`config merge-tools` to check the existing configuration.
1347 Use :hg:`config merge-tools` to check the existing configuration.
1346 Also see :hg:`help merge-tools` for more details.
1348 Also see :hg:`help merge-tools` for more details.
1347
1349
1348 Example ``~/.hgrc``::
1350 Example ``~/.hgrc``::
1349
1351
1350 [merge-tools]
1352 [merge-tools]
1351 # Override stock tool location
1353 # Override stock tool location
1352 kdiff3.executable = ~/bin/kdiff3
1354 kdiff3.executable = ~/bin/kdiff3
1353 # Specify command line
1355 # Specify command line
1354 kdiff3.args = $base $local $other -o $output
1356 kdiff3.args = $base $local $other -o $output
1355 # Give higher priority
1357 # Give higher priority
1356 kdiff3.priority = 1
1358 kdiff3.priority = 1
1357
1359
1358 # Changing the priority of preconfigured tool
1360 # Changing the priority of preconfigured tool
1359 meld.priority = 0
1361 meld.priority = 0
1360
1362
1361 # Disable a preconfigured tool
1363 # Disable a preconfigured tool
1362 vimdiff.disabled = yes
1364 vimdiff.disabled = yes
1363
1365
1364 # Define new tool
1366 # Define new tool
1365 myHtmlTool.args = -m $local $other $base $output
1367 myHtmlTool.args = -m $local $other $base $output
1366 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1368 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1367 myHtmlTool.priority = 1
1369 myHtmlTool.priority = 1
1368
1370
1369 Supported arguments:
1371 Supported arguments:
1370
1372
1371 ``priority``
1373 ``priority``
1372 The priority in which to evaluate this tool.
1374 The priority in which to evaluate this tool.
1373 (default: 0)
1375 (default: 0)
1374
1376
1375 ``executable``
1377 ``executable``
1376 Either just the name of the executable or its pathname.
1378 Either just the name of the executable or its pathname.
1377
1379
1378 .. container:: windows
1380 .. container:: windows
1379
1381
1380 On Windows, the path can use environment variables with ${ProgramFiles}
1382 On Windows, the path can use environment variables with ${ProgramFiles}
1381 syntax.
1383 syntax.
1382
1384
1383 (default: the tool name)
1385 (default: the tool name)
1384
1386
1385 ``args``
1387 ``args``
1386 The arguments to pass to the tool executable. You can refer to the
1388 The arguments to pass to the tool executable. You can refer to the
1387 files being merged as well as the output file through these
1389 files being merged as well as the output file through these
1388 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1390 variables: ``$base``, ``$local``, ``$other``, ``$output``.
1389
1391
1390 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1392 The meaning of ``$local`` and ``$other`` can vary depending on which action is
1391 being performed. During an update or merge, ``$local`` represents the original
1393 being performed. During an update or merge, ``$local`` represents the original
1392 state of the file, while ``$other`` represents the commit you are updating to or
1394 state of the file, while ``$other`` represents the commit you are updating to or
1393 the commit you are merging with. During a rebase, ``$local`` represents the
1395 the commit you are merging with. During a rebase, ``$local`` represents the
1394 destination of the rebase, and ``$other`` represents the commit being rebased.
1396 destination of the rebase, and ``$other`` represents the commit being rebased.
1395
1397
1396 Some operations define custom labels to assist with identifying the revisions,
1398 Some operations define custom labels to assist with identifying the revisions,
1397 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1399 accessible via ``$labellocal``, ``$labelother``, and ``$labelbase``. If custom
1398 labels are not available, these will be ``local``, ``other``, and ``base``,
1400 labels are not available, these will be ``local``, ``other``, and ``base``,
1399 respectively.
1401 respectively.
1400 (default: ``$local $base $other``)
1402 (default: ``$local $base $other``)
1401
1403
1402 ``premerge``
1404 ``premerge``
1403 Attempt to run internal non-interactive 3-way merge tool before
1405 Attempt to run internal non-interactive 3-way merge tool before
1404 launching external tool. Options are ``true``, ``false``, ``keep`` or
1406 launching external tool. Options are ``true``, ``false``, ``keep`` or
1405 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1407 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1406 premerge fails. The ``keep-merge3`` will do the same but include information
1408 premerge fails. The ``keep-merge3`` will do the same but include information
1407 about the base of the merge in the marker (see internal :merge3 in
1409 about the base of the merge in the marker (see internal :merge3 in
1408 :hg:`help merge-tools`).
1410 :hg:`help merge-tools`).
1409 (default: True)
1411 (default: True)
1410
1412
1411 ``binary``
1413 ``binary``
1412 This tool can merge binary files. (default: False, unless tool
1414 This tool can merge binary files. (default: False, unless tool
1413 was selected by file pattern match)
1415 was selected by file pattern match)
1414
1416
1415 ``symlink``
1417 ``symlink``
1416 This tool can merge symlinks. (default: False)
1418 This tool can merge symlinks. (default: False)
1417
1419
1418 ``check``
1420 ``check``
1419 A list of merge success-checking options:
1421 A list of merge success-checking options:
1420
1422
1421 ``changed``
1423 ``changed``
1422 Ask whether merge was successful when the merged file shows no changes.
1424 Ask whether merge was successful when the merged file shows no changes.
1423 ``conflicts``
1425 ``conflicts``
1424 Check whether there are conflicts even though the tool reported success.
1426 Check whether there are conflicts even though the tool reported success.
1425 ``prompt``
1427 ``prompt``
1426 Always prompt for merge success, regardless of success reported by tool.
1428 Always prompt for merge success, regardless of success reported by tool.
1427
1429
1428 ``fixeol``
1430 ``fixeol``
1429 Attempt to fix up EOL changes caused by the merge tool.
1431 Attempt to fix up EOL changes caused by the merge tool.
1430 (default: False)
1432 (default: False)
1431
1433
1432 ``gui``
1434 ``gui``
1433 This tool requires a graphical interface to run. (default: False)
1435 This tool requires a graphical interface to run. (default: False)
1434
1436
1435 ``mergemarkers``
1437 ``mergemarkers``
1436 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1438 Controls whether the labels passed via ``$labellocal``, ``$labelother``, and
1437 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1439 ``$labelbase`` are ``detailed`` (respecting ``mergemarkertemplate``) or
1438 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1440 ``basic``. If ``premerge`` is ``keep`` or ``keep-merge3``, the conflict
1439 markers generated during premerge will be ``detailed`` if either this option or
1441 markers generated during premerge will be ``detailed`` if either this option or
1440 the corresponding option in the ``[ui]`` section is ``detailed``.
1442 the corresponding option in the ``[ui]`` section is ``detailed``.
1441 (default: ``basic``)
1443 (default: ``basic``)
1442
1444
1443 ``mergemarkertemplate``
1445 ``mergemarkertemplate``
1444 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1446 This setting can be used to override ``mergemarkertemplate`` from the ``[ui]``
1445 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1447 section on a per-tool basis; this applies to the ``$label``-prefixed variables
1446 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1448 and to the conflict markers that are generated if ``premerge`` is ``keep` or
1447 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1449 ``keep-merge3``. See the corresponding variable in ``[ui]`` for more
1448 information.
1450 information.
1449
1451
1450 .. container:: windows
1452 .. container:: windows
1451
1453
1452 ``regkey``
1454 ``regkey``
1453 Windows registry key which describes install location of this
1455 Windows registry key which describes install location of this
1454 tool. Mercurial will search for this key first under
1456 tool. Mercurial will search for this key first under
1455 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1457 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1456 (default: None)
1458 (default: None)
1457
1459
1458 ``regkeyalt``
1460 ``regkeyalt``
1459 An alternate Windows registry key to try if the first key is not
1461 An alternate Windows registry key to try if the first key is not
1460 found. The alternate key uses the same ``regname`` and ``regappend``
1462 found. The alternate key uses the same ``regname`` and ``regappend``
1461 semantics of the primary key. The most common use for this key
1463 semantics of the primary key. The most common use for this key
1462 is to search for 32bit applications on 64bit operating systems.
1464 is to search for 32bit applications on 64bit operating systems.
1463 (default: None)
1465 (default: None)
1464
1466
1465 ``regname``
1467 ``regname``
1466 Name of value to read from specified registry key.
1468 Name of value to read from specified registry key.
1467 (default: the unnamed (default) value)
1469 (default: the unnamed (default) value)
1468
1470
1469 ``regappend``
1471 ``regappend``
1470 String to append to the value read from the registry, typically
1472 String to append to the value read from the registry, typically
1471 the executable name of the tool.
1473 the executable name of the tool.
1472 (default: None)
1474 (default: None)
1473
1475
1474 ``pager``
1476 ``pager``
1475 ---------
1477 ---------
1476
1478
1477 Setting used to control when to paginate and with what external tool. See
1479 Setting used to control when to paginate and with what external tool. See
1478 :hg:`help pager` for details.
1480 :hg:`help pager` for details.
1479
1481
1480 ``pager``
1482 ``pager``
1481 Define the external tool used as pager.
1483 Define the external tool used as pager.
1482
1484
1483 If no pager is set, Mercurial uses the environment variable $PAGER.
1485 If no pager is set, Mercurial uses the environment variable $PAGER.
1484 If neither pager.pager, nor $PAGER is set, a default pager will be
1486 If neither pager.pager, nor $PAGER is set, a default pager will be
1485 used, typically `less` on Unix and `more` on Windows. Example::
1487 used, typically `less` on Unix and `more` on Windows. Example::
1486
1488
1487 [pager]
1489 [pager]
1488 pager = less -FRX
1490 pager = less -FRX
1489
1491
1490 ``ignore``
1492 ``ignore``
1491 List of commands to disable the pager for. Example::
1493 List of commands to disable the pager for. Example::
1492
1494
1493 [pager]
1495 [pager]
1494 ignore = version, help, update
1496 ignore = version, help, update
1495
1497
1496 ``patch``
1498 ``patch``
1497 ---------
1499 ---------
1498
1500
1499 Settings used when applying patches, for instance through the 'import'
1501 Settings used when applying patches, for instance through the 'import'
1500 command or with Mercurial Queues extension.
1502 command or with Mercurial Queues extension.
1501
1503
1502 ``eol``
1504 ``eol``
1503 When set to 'strict' patch content and patched files end of lines
1505 When set to 'strict' patch content and patched files end of lines
1504 are preserved. When set to ``lf`` or ``crlf``, both files end of
1506 are preserved. When set to ``lf`` or ``crlf``, both files end of
1505 lines are ignored when patching and the result line endings are
1507 lines are ignored when patching and the result line endings are
1506 normalized to either LF (Unix) or CRLF (Windows). When set to
1508 normalized to either LF (Unix) or CRLF (Windows). When set to
1507 ``auto``, end of lines are again ignored while patching but line
1509 ``auto``, end of lines are again ignored while patching but line
1508 endings in patched files are normalized to their original setting
1510 endings in patched files are normalized to their original setting
1509 on a per-file basis. If target file does not exist or has no end
1511 on a per-file basis. If target file does not exist or has no end
1510 of line, patch line endings are preserved.
1512 of line, patch line endings are preserved.
1511 (default: strict)
1513 (default: strict)
1512
1514
1513 ``fuzz``
1515 ``fuzz``
1514 The number of lines of 'fuzz' to allow when applying patches. This
1516 The number of lines of 'fuzz' to allow when applying patches. This
1515 controls how much context the patcher is allowed to ignore when
1517 controls how much context the patcher is allowed to ignore when
1516 trying to apply a patch.
1518 trying to apply a patch.
1517 (default: 2)
1519 (default: 2)
1518
1520
1519 ``paths``
1521 ``paths``
1520 ---------
1522 ---------
1521
1523
1522 Assigns symbolic names and behavior to repositories.
1524 Assigns symbolic names and behavior to repositories.
1523
1525
1524 Options are symbolic names defining the URL or directory that is the
1526 Options are symbolic names defining the URL or directory that is the
1525 location of the repository. Example::
1527 location of the repository. Example::
1526
1528
1527 [paths]
1529 [paths]
1528 my_server = https://example.com/my_repo
1530 my_server = https://example.com/my_repo
1529 local_path = /home/me/repo
1531 local_path = /home/me/repo
1530
1532
1531 These symbolic names can be used from the command line. To pull
1533 These symbolic names can be used from the command line. To pull
1532 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1534 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1533 :hg:`push local_path`.
1535 :hg:`push local_path`.
1534
1536
1535 Options containing colons (``:``) denote sub-options that can influence
1537 Options containing colons (``:``) denote sub-options that can influence
1536 behavior for that specific path. Example::
1538 behavior for that specific path. Example::
1537
1539
1538 [paths]
1540 [paths]
1539 my_server = https://example.com/my_path
1541 my_server = https://example.com/my_path
1540 my_server:pushurl = ssh://example.com/my_path
1542 my_server:pushurl = ssh://example.com/my_path
1541
1543
1542 The following sub-options can be defined:
1544 The following sub-options can be defined:
1543
1545
1544 ``pushurl``
1546 ``pushurl``
1545 The URL to use for push operations. If not defined, the location
1547 The URL to use for push operations. If not defined, the location
1546 defined by the path's main entry is used.
1548 defined by the path's main entry is used.
1547
1549
1548 ``pushrev``
1550 ``pushrev``
1549 A revset defining which revisions to push by default.
1551 A revset defining which revisions to push by default.
1550
1552
1551 When :hg:`push` is executed without a ``-r`` argument, the revset
1553 When :hg:`push` is executed without a ``-r`` argument, the revset
1552 defined by this sub-option is evaluated to determine what to push.
1554 defined by this sub-option is evaluated to determine what to push.
1553
1555
1554 For example, a value of ``.`` will push the working directory's
1556 For example, a value of ``.`` will push the working directory's
1555 revision by default.
1557 revision by default.
1556
1558
1557 Revsets specifying bookmarks will not result in the bookmark being
1559 Revsets specifying bookmarks will not result in the bookmark being
1558 pushed.
1560 pushed.
1559
1561
1560 The following special named paths exist:
1562 The following special named paths exist:
1561
1563
1562 ``default``
1564 ``default``
1563 The URL or directory to use when no source or remote is specified.
1565 The URL or directory to use when no source or remote is specified.
1564
1566
1565 :hg:`clone` will automatically define this path to the location the
1567 :hg:`clone` will automatically define this path to the location the
1566 repository was cloned from.
1568 repository was cloned from.
1567
1569
1568 ``default-push``
1570 ``default-push``
1569 (deprecated) The URL or directory for the default :hg:`push` location.
1571 (deprecated) The URL or directory for the default :hg:`push` location.
1570 ``default:pushurl`` should be used instead.
1572 ``default:pushurl`` should be used instead.
1571
1573
1572 ``phases``
1574 ``phases``
1573 ----------
1575 ----------
1574
1576
1575 Specifies default handling of phases. See :hg:`help phases` for more
1577 Specifies default handling of phases. See :hg:`help phases` for more
1576 information about working with phases.
1578 information about working with phases.
1577
1579
1578 ``publish``
1580 ``publish``
1579 Controls draft phase behavior when working as a server. When true,
1581 Controls draft phase behavior when working as a server. When true,
1580 pushed changesets are set to public in both client and server and
1582 pushed changesets are set to public in both client and server and
1581 pulled or cloned changesets are set to public in the client.
1583 pulled or cloned changesets are set to public in the client.
1582 (default: True)
1584 (default: True)
1583
1585
1584 ``new-commit``
1586 ``new-commit``
1585 Phase of newly-created commits.
1587 Phase of newly-created commits.
1586 (default: draft)
1588 (default: draft)
1587
1589
1588 ``checksubrepos``
1590 ``checksubrepos``
1589 Check the phase of the current revision of each subrepository. Allowed
1591 Check the phase of the current revision of each subrepository. Allowed
1590 values are "ignore", "follow" and "abort". For settings other than
1592 values are "ignore", "follow" and "abort". For settings other than
1591 "ignore", the phase of the current revision of each subrepository is
1593 "ignore", the phase of the current revision of each subrepository is
1592 checked before committing the parent repository. If any of those phases is
1594 checked before committing the parent repository. If any of those phases is
1593 greater than the phase of the parent repository (e.g. if a subrepo is in a
1595 greater than the phase of the parent repository (e.g. if a subrepo is in a
1594 "secret" phase while the parent repo is in "draft" phase), the commit is
1596 "secret" phase while the parent repo is in "draft" phase), the commit is
1595 either aborted (if checksubrepos is set to "abort") or the higher phase is
1597 either aborted (if checksubrepos is set to "abort") or the higher phase is
1596 used for the parent repository commit (if set to "follow").
1598 used for the parent repository commit (if set to "follow").
1597 (default: follow)
1599 (default: follow)
1598
1600
1599
1601
1600 ``profiling``
1602 ``profiling``
1601 -------------
1603 -------------
1602
1604
1603 Specifies profiling type, format, and file output. Two profilers are
1605 Specifies profiling type, format, and file output. Two profilers are
1604 supported: an instrumenting profiler (named ``ls``), and a sampling
1606 supported: an instrumenting profiler (named ``ls``), and a sampling
1605 profiler (named ``stat``).
1607 profiler (named ``stat``).
1606
1608
1607 In this section description, 'profiling data' stands for the raw data
1609 In this section description, 'profiling data' stands for the raw data
1608 collected during profiling, while 'profiling report' stands for a
1610 collected during profiling, while 'profiling report' stands for a
1609 statistical text report generated from the profiling data.
1611 statistical text report generated from the profiling data.
1610
1612
1611 ``enabled``
1613 ``enabled``
1612 Enable the profiler.
1614 Enable the profiler.
1613 (default: false)
1615 (default: false)
1614
1616
1615 This is equivalent to passing ``--profile`` on the command line.
1617 This is equivalent to passing ``--profile`` on the command line.
1616
1618
1617 ``type``
1619 ``type``
1618 The type of profiler to use.
1620 The type of profiler to use.
1619 (default: stat)
1621 (default: stat)
1620
1622
1621 ``ls``
1623 ``ls``
1622 Use Python's built-in instrumenting profiler. This profiler
1624 Use Python's built-in instrumenting profiler. This profiler
1623 works on all platforms, but each line number it reports is the
1625 works on all platforms, but each line number it reports is the
1624 first line of a function. This restriction makes it difficult to
1626 first line of a function. This restriction makes it difficult to
1625 identify the expensive parts of a non-trivial function.
1627 identify the expensive parts of a non-trivial function.
1626 ``stat``
1628 ``stat``
1627 Use a statistical profiler, statprof. This profiler is most
1629 Use a statistical profiler, statprof. This profiler is most
1628 useful for profiling commands that run for longer than about 0.1
1630 useful for profiling commands that run for longer than about 0.1
1629 seconds.
1631 seconds.
1630
1632
1631 ``format``
1633 ``format``
1632 Profiling format. Specific to the ``ls`` instrumenting profiler.
1634 Profiling format. Specific to the ``ls`` instrumenting profiler.
1633 (default: text)
1635 (default: text)
1634
1636
1635 ``text``
1637 ``text``
1636 Generate a profiling report. When saving to a file, it should be
1638 Generate a profiling report. When saving to a file, it should be
1637 noted that only the report is saved, and the profiling data is
1639 noted that only the report is saved, and the profiling data is
1638 not kept.
1640 not kept.
1639 ``kcachegrind``
1641 ``kcachegrind``
1640 Format profiling data for kcachegrind use: when saving to a
1642 Format profiling data for kcachegrind use: when saving to a
1641 file, the generated file can directly be loaded into
1643 file, the generated file can directly be loaded into
1642 kcachegrind.
1644 kcachegrind.
1643
1645
1644 ``statformat``
1646 ``statformat``
1645 Profiling format for the ``stat`` profiler.
1647 Profiling format for the ``stat`` profiler.
1646 (default: hotpath)
1648 (default: hotpath)
1647
1649
1648 ``hotpath``
1650 ``hotpath``
1649 Show a tree-based display containing the hot path of execution (where
1651 Show a tree-based display containing the hot path of execution (where
1650 most time was spent).
1652 most time was spent).
1651 ``bymethod``
1653 ``bymethod``
1652 Show a table of methods ordered by how frequently they are active.
1654 Show a table of methods ordered by how frequently they are active.
1653 ``byline``
1655 ``byline``
1654 Show a table of lines in files ordered by how frequently they are active.
1656 Show a table of lines in files ordered by how frequently they are active.
1655 ``json``
1657 ``json``
1656 Render profiling data as JSON.
1658 Render profiling data as JSON.
1657
1659
1658 ``frequency``
1660 ``frequency``
1659 Sampling frequency. Specific to the ``stat`` sampling profiler.
1661 Sampling frequency. Specific to the ``stat`` sampling profiler.
1660 (default: 1000)
1662 (default: 1000)
1661
1663
1662 ``output``
1664 ``output``
1663 File path where profiling data or report should be saved. If the
1665 File path where profiling data or report should be saved. If the
1664 file exists, it is replaced. (default: None, data is printed on
1666 file exists, it is replaced. (default: None, data is printed on
1665 stderr)
1667 stderr)
1666
1668
1667 ``sort``
1669 ``sort``
1668 Sort field. Specific to the ``ls`` instrumenting profiler.
1670 Sort field. Specific to the ``ls`` instrumenting profiler.
1669 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1671 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1670 ``inlinetime``.
1672 ``inlinetime``.
1671 (default: inlinetime)
1673 (default: inlinetime)
1672
1674
1673 ``time-track``
1675 ``time-track``
1674 Control if the stat profiler track ``cpu`` or ``real`` time.
1676 Control if the stat profiler track ``cpu`` or ``real`` time.
1675 (default: ``cpu``)
1677 (default: ``cpu``)
1676
1678
1677 ``limit``
1679 ``limit``
1678 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1680 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1679 (default: 30)
1681 (default: 30)
1680
1682
1681 ``nested``
1683 ``nested``
1682 Show at most this number of lines of drill-down info after each main entry.
1684 Show at most this number of lines of drill-down info after each main entry.
1683 This can help explain the difference between Total and Inline.
1685 This can help explain the difference between Total and Inline.
1684 Specific to the ``ls`` instrumenting profiler.
1686 Specific to the ``ls`` instrumenting profiler.
1685 (default: 0)
1687 (default: 0)
1686
1688
1687 ``showmin``
1689 ``showmin``
1688 Minimum fraction of samples an entry must have for it to be displayed.
1690 Minimum fraction of samples an entry must have for it to be displayed.
1689 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1691 Can be specified as a float between ``0.0`` and ``1.0`` or can have a
1690 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1692 ``%`` afterwards to allow values up to ``100``. e.g. ``5%``.
1691
1693
1692 Only used by the ``stat`` profiler.
1694 Only used by the ``stat`` profiler.
1693
1695
1694 For the ``hotpath`` format, default is ``0.05``.
1696 For the ``hotpath`` format, default is ``0.05``.
1695 For the ``chrome`` format, default is ``0.005``.
1697 For the ``chrome`` format, default is ``0.005``.
1696
1698
1697 The option is unused on other formats.
1699 The option is unused on other formats.
1698
1700
1699 ``showmax``
1701 ``showmax``
1700 Maximum fraction of samples an entry can have before it is ignored in
1702 Maximum fraction of samples an entry can have before it is ignored in
1701 display. Values format is the same as ``showmin``.
1703 display. Values format is the same as ``showmin``.
1702
1704
1703 Only used by the ``stat`` profiler.
1705 Only used by the ``stat`` profiler.
1704
1706
1705 For the ``chrome`` format, default is ``0.999``.
1707 For the ``chrome`` format, default is ``0.999``.
1706
1708
1707 The option is unused on other formats.
1709 The option is unused on other formats.
1708
1710
1709 ``progress``
1711 ``progress``
1710 ------------
1712 ------------
1711
1713
1712 Mercurial commands can draw progress bars that are as informative as
1714 Mercurial commands can draw progress bars that are as informative as
1713 possible. Some progress bars only offer indeterminate information, while others
1715 possible. Some progress bars only offer indeterminate information, while others
1714 have a definite end point.
1716 have a definite end point.
1715
1717
1716 ``delay``
1718 ``delay``
1717 Number of seconds (float) before showing the progress bar. (default: 3)
1719 Number of seconds (float) before showing the progress bar. (default: 3)
1718
1720
1719 ``changedelay``
1721 ``changedelay``
1720 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1722 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1721 that value will be used instead. (default: 1)
1723 that value will be used instead. (default: 1)
1722
1724
1723 ``estimateinterval``
1725 ``estimateinterval``
1724 Maximum sampling interval in seconds for speed and estimated time
1726 Maximum sampling interval in seconds for speed and estimated time
1725 calculation. (default: 60)
1727 calculation. (default: 60)
1726
1728
1727 ``refresh``
1729 ``refresh``
1728 Time in seconds between refreshes of the progress bar. (default: 0.1)
1730 Time in seconds between refreshes of the progress bar. (default: 0.1)
1729
1731
1730 ``format``
1732 ``format``
1731 Format of the progress bar.
1733 Format of the progress bar.
1732
1734
1733 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1735 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1734 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1736 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1735 last 20 characters of the item, but this can be changed by adding either
1737 last 20 characters of the item, but this can be changed by adding either
1736 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1738 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1737 first num characters.
1739 first num characters.
1738
1740
1739 (default: topic bar number estimate)
1741 (default: topic bar number estimate)
1740
1742
1741 ``width``
1743 ``width``
1742 If set, the maximum width of the progress information (that is, min(width,
1744 If set, the maximum width of the progress information (that is, min(width,
1743 term width) will be used).
1745 term width) will be used).
1744
1746
1745 ``clear-complete``
1747 ``clear-complete``
1746 Clear the progress bar after it's done. (default: True)
1748 Clear the progress bar after it's done. (default: True)
1747
1749
1748 ``disable``
1750 ``disable``
1749 If true, don't show a progress bar.
1751 If true, don't show a progress bar.
1750
1752
1751 ``assume-tty``
1753 ``assume-tty``
1752 If true, ALWAYS show a progress bar, unless disable is given.
1754 If true, ALWAYS show a progress bar, unless disable is given.
1753
1755
1754 ``rebase``
1756 ``rebase``
1755 ----------
1757 ----------
1756
1758
1757 ``evolution.allowdivergence``
1759 ``evolution.allowdivergence``
1758 Default to False, when True allow creating divergence when performing
1760 Default to False, when True allow creating divergence when performing
1759 rebase of obsolete changesets.
1761 rebase of obsolete changesets.
1760
1762
1761 ``revsetalias``
1763 ``revsetalias``
1762 ---------------
1764 ---------------
1763
1765
1764 Alias definitions for revsets. See :hg:`help revsets` for details.
1766 Alias definitions for revsets. See :hg:`help revsets` for details.
1765
1767
1766 ``server``
1768 ``server``
1767 ----------
1769 ----------
1768
1770
1769 Controls generic server settings.
1771 Controls generic server settings.
1770
1772
1771 ``bookmarks-pushkey-compat``
1773 ``bookmarks-pushkey-compat``
1772 Trigger pushkey hook when being pushed bookmark updates. This config exist
1774 Trigger pushkey hook when being pushed bookmark updates. This config exist
1773 for compatibility purpose (default to True)
1775 for compatibility purpose (default to True)
1774
1776
1775 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1777 If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
1776 movement we recommend you migrate them to ``txnclose-bookmark`` and
1778 movement we recommend you migrate them to ``txnclose-bookmark`` and
1777 ``pretxnclose-bookmark``.
1779 ``pretxnclose-bookmark``.
1778
1780
1779 ``compressionengines``
1781 ``compressionengines``
1780 List of compression engines and their relative priority to advertise
1782 List of compression engines and their relative priority to advertise
1781 to clients.
1783 to clients.
1782
1784
1783 The order of compression engines determines their priority, the first
1785 The order of compression engines determines their priority, the first
1784 having the highest priority. If a compression engine is not listed
1786 having the highest priority. If a compression engine is not listed
1785 here, it won't be advertised to clients.
1787 here, it won't be advertised to clients.
1786
1788
1787 If not set (the default), built-in defaults are used. Run
1789 If not set (the default), built-in defaults are used. Run
1788 :hg:`debuginstall` to list available compression engines and their
1790 :hg:`debuginstall` to list available compression engines and their
1789 default wire protocol priority.
1791 default wire protocol priority.
1790
1792
1791 Older Mercurial clients only support zlib compression and this setting
1793 Older Mercurial clients only support zlib compression and this setting
1792 has no effect for legacy clients.
1794 has no effect for legacy clients.
1793
1795
1794 ``uncompressed``
1796 ``uncompressed``
1795 Whether to allow clients to clone a repository using the
1797 Whether to allow clients to clone a repository using the
1796 uncompressed streaming protocol. This transfers about 40% more
1798 uncompressed streaming protocol. This transfers about 40% more
1797 data than a regular clone, but uses less memory and CPU on both
1799 data than a regular clone, but uses less memory and CPU on both
1798 server and client. Over a LAN (100 Mbps or better) or a very fast
1800 server and client. Over a LAN (100 Mbps or better) or a very fast
1799 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1801 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1800 regular clone. Over most WAN connections (anything slower than
1802 regular clone. Over most WAN connections (anything slower than
1801 about 6 Mbps), uncompressed streaming is slower, because of the
1803 about 6 Mbps), uncompressed streaming is slower, because of the
1802 extra data transfer overhead. This mode will also temporarily hold
1804 extra data transfer overhead. This mode will also temporarily hold
1803 the write lock while determining what data to transfer.
1805 the write lock while determining what data to transfer.
1804 (default: True)
1806 (default: True)
1805
1807
1806 ``uncompressedallowsecret``
1808 ``uncompressedallowsecret``
1807 Whether to allow stream clones when the repository contains secret
1809 Whether to allow stream clones when the repository contains secret
1808 changesets. (default: False)
1810 changesets. (default: False)
1809
1811
1810 ``preferuncompressed``
1812 ``preferuncompressed``
1811 When set, clients will try to use the uncompressed streaming
1813 When set, clients will try to use the uncompressed streaming
1812 protocol. (default: False)
1814 protocol. (default: False)
1813
1815
1814 ``disablefullbundle``
1816 ``disablefullbundle``
1815 When set, servers will refuse attempts to do pull-based clones.
1817 When set, servers will refuse attempts to do pull-based clones.
1816 If this option is set, ``preferuncompressed`` and/or clone bundles
1818 If this option is set, ``preferuncompressed`` and/or clone bundles
1817 are highly recommended. Partial clones will still be allowed.
1819 are highly recommended. Partial clones will still be allowed.
1818 (default: False)
1820 (default: False)
1819
1821
1820 ``streamunbundle``
1822 ``streamunbundle``
1821 When set, servers will apply data sent from the client directly,
1823 When set, servers will apply data sent from the client directly,
1822 otherwise it will be written to a temporary file first. This option
1824 otherwise it will be written to a temporary file first. This option
1823 effectively prevents concurrent pushes.
1825 effectively prevents concurrent pushes.
1824
1826
1825 ``pullbundle``
1827 ``pullbundle``
1826 When set, the server will check pullbundle.manifest for bundles
1828 When set, the server will check pullbundle.manifest for bundles
1827 covering the requested heads and common nodes. The first matching
1829 covering the requested heads and common nodes. The first matching
1828 entry will be streamed to the client.
1830 entry will be streamed to the client.
1829
1831
1830 For HTTP transport, the stream will still use zlib compression
1832 For HTTP transport, the stream will still use zlib compression
1831 for older clients.
1833 for older clients.
1832
1834
1833 ``concurrent-push-mode``
1835 ``concurrent-push-mode``
1834 Level of allowed race condition between two pushing clients.
1836 Level of allowed race condition between two pushing clients.
1835
1837
1836 - 'strict': push is abort if another client touched the repository
1838 - 'strict': push is abort if another client touched the repository
1837 while the push was preparing. (default)
1839 while the push was preparing. (default)
1838 - 'check-related': push is only aborted if it affects head that got also
1840 - 'check-related': push is only aborted if it affects head that got also
1839 affected while the push was preparing.
1841 affected while the push was preparing.
1840
1842
1841 This requires compatible client (version 4.3 and later). Old client will
1843 This requires compatible client (version 4.3 and later). Old client will
1842 use 'strict'.
1844 use 'strict'.
1843
1845
1844 ``validate``
1846 ``validate``
1845 Whether to validate the completeness of pushed changesets by
1847 Whether to validate the completeness of pushed changesets by
1846 checking that all new file revisions specified in manifests are
1848 checking that all new file revisions specified in manifests are
1847 present. (default: False)
1849 present. (default: False)
1848
1850
1849 ``maxhttpheaderlen``
1851 ``maxhttpheaderlen``
1850 Instruct HTTP clients not to send request headers longer than this
1852 Instruct HTTP clients not to send request headers longer than this
1851 many bytes. (default: 1024)
1853 many bytes. (default: 1024)
1852
1854
1853 ``bundle1``
1855 ``bundle1``
1854 Whether to allow clients to push and pull using the legacy bundle1
1856 Whether to allow clients to push and pull using the legacy bundle1
1855 exchange format. (default: True)
1857 exchange format. (default: True)
1856
1858
1857 ``bundle1gd``
1859 ``bundle1gd``
1858 Like ``bundle1`` but only used if the repository is using the
1860 Like ``bundle1`` but only used if the repository is using the
1859 *generaldelta* storage format. (default: True)
1861 *generaldelta* storage format. (default: True)
1860
1862
1861 ``bundle1.push``
1863 ``bundle1.push``
1862 Whether to allow clients to push using the legacy bundle1 exchange
1864 Whether to allow clients to push using the legacy bundle1 exchange
1863 format. (default: True)
1865 format. (default: True)
1864
1866
1865 ``bundle1gd.push``
1867 ``bundle1gd.push``
1866 Like ``bundle1.push`` but only used if the repository is using the
1868 Like ``bundle1.push`` but only used if the repository is using the
1867 *generaldelta* storage format. (default: True)
1869 *generaldelta* storage format. (default: True)
1868
1870
1869 ``bundle1.pull``
1871 ``bundle1.pull``
1870 Whether to allow clients to pull using the legacy bundle1 exchange
1872 Whether to allow clients to pull using the legacy bundle1 exchange
1871 format. (default: True)
1873 format. (default: True)
1872
1874
1873 ``bundle1gd.pull``
1875 ``bundle1gd.pull``
1874 Like ``bundle1.pull`` but only used if the repository is using the
1876 Like ``bundle1.pull`` but only used if the repository is using the
1875 *generaldelta* storage format. (default: True)
1877 *generaldelta* storage format. (default: True)
1876
1878
1877 Large repositories using the *generaldelta* storage format should
1879 Large repositories using the *generaldelta* storage format should
1878 consider setting this option because converting *generaldelta*
1880 consider setting this option because converting *generaldelta*
1879 repositories to the exchange format required by the bundle1 data
1881 repositories to the exchange format required by the bundle1 data
1880 format can consume a lot of CPU.
1882 format can consume a lot of CPU.
1881
1883
1882 ``zliblevel``
1884 ``zliblevel``
1883 Integer between ``-1`` and ``9`` that controls the zlib compression level
1885 Integer between ``-1`` and ``9`` that controls the zlib compression level
1884 for wire protocol commands that send zlib compressed output (notably the
1886 for wire protocol commands that send zlib compressed output (notably the
1885 commands that send repository history data).
1887 commands that send repository history data).
1886
1888
1887 The default (``-1``) uses the default zlib compression level, which is
1889 The default (``-1``) uses the default zlib compression level, which is
1888 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1890 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1889 maximum compression.
1891 maximum compression.
1890
1892
1891 Setting this option allows server operators to make trade-offs between
1893 Setting this option allows server operators to make trade-offs between
1892 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1894 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1893 but sends more bytes to clients.
1895 but sends more bytes to clients.
1894
1896
1895 This option only impacts the HTTP server.
1897 This option only impacts the HTTP server.
1896
1898
1897 ``zstdlevel``
1899 ``zstdlevel``
1898 Integer between ``1`` and ``22`` that controls the zstd compression level
1900 Integer between ``1`` and ``22`` that controls the zstd compression level
1899 for wire protocol commands. ``1`` is the minimal amount of compression and
1901 for wire protocol commands. ``1`` is the minimal amount of compression and
1900 ``22`` is the highest amount of compression.
1902 ``22`` is the highest amount of compression.
1901
1903
1902 The default (``3``) should be significantly faster than zlib while likely
1904 The default (``3``) should be significantly faster than zlib while likely
1903 delivering better compression ratios.
1905 delivering better compression ratios.
1904
1906
1905 This option only impacts the HTTP server.
1907 This option only impacts the HTTP server.
1906
1908
1907 See also ``server.zliblevel``.
1909 See also ``server.zliblevel``.
1908
1910
1909 ``smtp``
1911 ``smtp``
1910 --------
1912 --------
1911
1913
1912 Configuration for extensions that need to send email messages.
1914 Configuration for extensions that need to send email messages.
1913
1915
1914 ``host``
1916 ``host``
1915 Host name of mail server, e.g. "mail.example.com".
1917 Host name of mail server, e.g. "mail.example.com".
1916
1918
1917 ``port``
1919 ``port``
1918 Optional. Port to connect to on mail server. (default: 465 if
1920 Optional. Port to connect to on mail server. (default: 465 if
1919 ``tls`` is smtps; 25 otherwise)
1921 ``tls`` is smtps; 25 otherwise)
1920
1922
1921 ``tls``
1923 ``tls``
1922 Optional. Method to enable TLS when connecting to mail server: starttls,
1924 Optional. Method to enable TLS when connecting to mail server: starttls,
1923 smtps or none. (default: none)
1925 smtps or none. (default: none)
1924
1926
1925 ``username``
1927 ``username``
1926 Optional. User name for authenticating with the SMTP server.
1928 Optional. User name for authenticating with the SMTP server.
1927 (default: None)
1929 (default: None)
1928
1930
1929 ``password``
1931 ``password``
1930 Optional. Password for authenticating with the SMTP server. If not
1932 Optional. Password for authenticating with the SMTP server. If not
1931 specified, interactive sessions will prompt the user for a
1933 specified, interactive sessions will prompt the user for a
1932 password; non-interactive sessions will fail. (default: None)
1934 password; non-interactive sessions will fail. (default: None)
1933
1935
1934 ``local_hostname``
1936 ``local_hostname``
1935 Optional. The hostname that the sender can use to identify
1937 Optional. The hostname that the sender can use to identify
1936 itself to the MTA.
1938 itself to the MTA.
1937
1939
1938
1940
1939 ``subpaths``
1941 ``subpaths``
1940 ------------
1942 ------------
1941
1943
1942 Subrepository source URLs can go stale if a remote server changes name
1944 Subrepository source URLs can go stale if a remote server changes name
1943 or becomes temporarily unavailable. This section lets you define
1945 or becomes temporarily unavailable. This section lets you define
1944 rewrite rules of the form::
1946 rewrite rules of the form::
1945
1947
1946 <pattern> = <replacement>
1948 <pattern> = <replacement>
1947
1949
1948 where ``pattern`` is a regular expression matching a subrepository
1950 where ``pattern`` is a regular expression matching a subrepository
1949 source URL and ``replacement`` is the replacement string used to
1951 source URL and ``replacement`` is the replacement string used to
1950 rewrite it. Groups can be matched in ``pattern`` and referenced in
1952 rewrite it. Groups can be matched in ``pattern`` and referenced in
1951 ``replacements``. For instance::
1953 ``replacements``. For instance::
1952
1954
1953 http://server/(.*)-hg/ = http://hg.server/\1/
1955 http://server/(.*)-hg/ = http://hg.server/\1/
1954
1956
1955 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1957 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1956
1958
1957 Relative subrepository paths are first made absolute, and the
1959 Relative subrepository paths are first made absolute, and the
1958 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1960 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1959 doesn't match the full path, an attempt is made to apply it on the
1961 doesn't match the full path, an attempt is made to apply it on the
1960 relative path alone. The rules are applied in definition order.
1962 relative path alone. The rules are applied in definition order.
1961
1963
1962 ``subrepos``
1964 ``subrepos``
1963 ------------
1965 ------------
1964
1966
1965 This section contains options that control the behavior of the
1967 This section contains options that control the behavior of the
1966 subrepositories feature. See also :hg:`help subrepos`.
1968 subrepositories feature. See also :hg:`help subrepos`.
1967
1969
1968 Security note: auditing in Mercurial is known to be insufficient to
1970 Security note: auditing in Mercurial is known to be insufficient to
1969 prevent clone-time code execution with carefully constructed Git
1971 prevent clone-time code execution with carefully constructed Git
1970 subrepos. It is unknown if a similar detect is present in Subversion
1972 subrepos. It is unknown if a similar detect is present in Subversion
1971 subrepos. Both Git and Subversion subrepos are disabled by default
1973 subrepos. Both Git and Subversion subrepos are disabled by default
1972 out of security concerns. These subrepo types can be enabled using
1974 out of security concerns. These subrepo types can be enabled using
1973 the respective options below.
1975 the respective options below.
1974
1976
1975 ``allowed``
1977 ``allowed``
1976 Whether subrepositories are allowed in the working directory.
1978 Whether subrepositories are allowed in the working directory.
1977
1979
1978 When false, commands involving subrepositories (like :hg:`update`)
1980 When false, commands involving subrepositories (like :hg:`update`)
1979 will fail for all subrepository types.
1981 will fail for all subrepository types.
1980 (default: true)
1982 (default: true)
1981
1983
1982 ``hg:allowed``
1984 ``hg:allowed``
1983 Whether Mercurial subrepositories are allowed in the working
1985 Whether Mercurial subrepositories are allowed in the working
1984 directory. This option only has an effect if ``subrepos.allowed``
1986 directory. This option only has an effect if ``subrepos.allowed``
1985 is true.
1987 is true.
1986 (default: true)
1988 (default: true)
1987
1989
1988 ``git:allowed``
1990 ``git:allowed``
1989 Whether Git subrepositories are allowed in the working directory.
1991 Whether Git subrepositories are allowed in the working directory.
1990 This option only has an effect if ``subrepos.allowed`` is true.
1992 This option only has an effect if ``subrepos.allowed`` is true.
1991
1993
1992 See the security note above before enabling Git subrepos.
1994 See the security note above before enabling Git subrepos.
1993 (default: false)
1995 (default: false)
1994
1996
1995 ``svn:allowed``
1997 ``svn:allowed``
1996 Whether Subversion subrepositories are allowed in the working
1998 Whether Subversion subrepositories are allowed in the working
1997 directory. This option only has an effect if ``subrepos.allowed``
1999 directory. This option only has an effect if ``subrepos.allowed``
1998 is true.
2000 is true.
1999
2001
2000 See the security note above before enabling Subversion subrepos.
2002 See the security note above before enabling Subversion subrepos.
2001 (default: false)
2003 (default: false)
2002
2004
2003 ``templatealias``
2005 ``templatealias``
2004 -----------------
2006 -----------------
2005
2007
2006 Alias definitions for templates. See :hg:`help templates` for details.
2008 Alias definitions for templates. See :hg:`help templates` for details.
2007
2009
2008 ``templates``
2010 ``templates``
2009 -------------
2011 -------------
2010
2012
2011 Use the ``[templates]`` section to define template strings.
2013 Use the ``[templates]`` section to define template strings.
2012 See :hg:`help templates` for details.
2014 See :hg:`help templates` for details.
2013
2015
2014 ``trusted``
2016 ``trusted``
2015 -----------
2017 -----------
2016
2018
2017 Mercurial will not use the settings in the
2019 Mercurial will not use the settings in the
2018 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2020 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
2019 user or to a trusted group, as various hgrc features allow arbitrary
2021 user or to a trusted group, as various hgrc features allow arbitrary
2020 commands to be run. This issue is often encountered when configuring
2022 commands to be run. This issue is often encountered when configuring
2021 hooks or extensions for shared repositories or servers. However,
2023 hooks or extensions for shared repositories or servers. However,
2022 the web interface will use some safe settings from the ``[web]``
2024 the web interface will use some safe settings from the ``[web]``
2023 section.
2025 section.
2024
2026
2025 This section specifies what users and groups are trusted. The
2027 This section specifies what users and groups are trusted. The
2026 current user is always trusted. To trust everybody, list a user or a
2028 current user is always trusted. To trust everybody, list a user or a
2027 group with name ``*``. These settings must be placed in an
2029 group with name ``*``. These settings must be placed in an
2028 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2030 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
2029 user or service running Mercurial.
2031 user or service running Mercurial.
2030
2032
2031 ``users``
2033 ``users``
2032 Comma-separated list of trusted users.
2034 Comma-separated list of trusted users.
2033
2035
2034 ``groups``
2036 ``groups``
2035 Comma-separated list of trusted groups.
2037 Comma-separated list of trusted groups.
2036
2038
2037
2039
2038 ``ui``
2040 ``ui``
2039 ------
2041 ------
2040
2042
2041 User interface controls.
2043 User interface controls.
2042
2044
2043 ``archivemeta``
2045 ``archivemeta``
2044 Whether to include the .hg_archival.txt file containing meta data
2046 Whether to include the .hg_archival.txt file containing meta data
2045 (hashes for the repository base and for tip) in archives created
2047 (hashes for the repository base and for tip) in archives created
2046 by the :hg:`archive` command or downloaded via hgweb.
2048 by the :hg:`archive` command or downloaded via hgweb.
2047 (default: True)
2049 (default: True)
2048
2050
2049 ``askusername``
2051 ``askusername``
2050 Whether to prompt for a username when committing. If True, and
2052 Whether to prompt for a username when committing. If True, and
2051 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2053 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
2052 be prompted to enter a username. If no username is entered, the
2054 be prompted to enter a username. If no username is entered, the
2053 default ``USER@HOST`` is used instead.
2055 default ``USER@HOST`` is used instead.
2054 (default: False)
2056 (default: False)
2055
2057
2056 ``clonebundles``
2058 ``clonebundles``
2057 Whether the "clone bundles" feature is enabled.
2059 Whether the "clone bundles" feature is enabled.
2058
2060
2059 When enabled, :hg:`clone` may download and apply a server-advertised
2061 When enabled, :hg:`clone` may download and apply a server-advertised
2060 bundle file from a URL instead of using the normal exchange mechanism.
2062 bundle file from a URL instead of using the normal exchange mechanism.
2061
2063
2062 This can likely result in faster and more reliable clones.
2064 This can likely result in faster and more reliable clones.
2063
2065
2064 (default: True)
2066 (default: True)
2065
2067
2066 ``clonebundlefallback``
2068 ``clonebundlefallback``
2067 Whether failure to apply an advertised "clone bundle" from a server
2069 Whether failure to apply an advertised "clone bundle" from a server
2068 should result in fallback to a regular clone.
2070 should result in fallback to a regular clone.
2069
2071
2070 This is disabled by default because servers advertising "clone
2072 This is disabled by default because servers advertising "clone
2071 bundles" often do so to reduce server load. If advertised bundles
2073 bundles" often do so to reduce server load. If advertised bundles
2072 start mass failing and clients automatically fall back to a regular
2074 start mass failing and clients automatically fall back to a regular
2073 clone, this would add significant and unexpected load to the server
2075 clone, this would add significant and unexpected load to the server
2074 since the server is expecting clone operations to be offloaded to
2076 since the server is expecting clone operations to be offloaded to
2075 pre-generated bundles. Failing fast (the default behavior) ensures
2077 pre-generated bundles. Failing fast (the default behavior) ensures
2076 clients don't overwhelm the server when "clone bundle" application
2078 clients don't overwhelm the server when "clone bundle" application
2077 fails.
2079 fails.
2078
2080
2079 (default: False)
2081 (default: False)
2080
2082
2081 ``clonebundleprefers``
2083 ``clonebundleprefers``
2082 Defines preferences for which "clone bundles" to use.
2084 Defines preferences for which "clone bundles" to use.
2083
2085
2084 Servers advertising "clone bundles" may advertise multiple available
2086 Servers advertising "clone bundles" may advertise multiple available
2085 bundles. Each bundle may have different attributes, such as the bundle
2087 bundles. Each bundle may have different attributes, such as the bundle
2086 type and compression format. This option is used to prefer a particular
2088 type and compression format. This option is used to prefer a particular
2087 bundle over another.
2089 bundle over another.
2088
2090
2089 The following keys are defined by Mercurial:
2091 The following keys are defined by Mercurial:
2090
2092
2091 BUNDLESPEC
2093 BUNDLESPEC
2092 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2094 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
2093 e.g. ``gzip-v2`` or ``bzip2-v1``.
2095 e.g. ``gzip-v2`` or ``bzip2-v1``.
2094
2096
2095 COMPRESSION
2097 COMPRESSION
2096 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2098 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
2097
2099
2098 Server operators may define custom keys.
2100 Server operators may define custom keys.
2099
2101
2100 Example values: ``COMPRESSION=bzip2``,
2102 Example values: ``COMPRESSION=bzip2``,
2101 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2103 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
2102
2104
2103 By default, the first bundle advertised by the server is used.
2105 By default, the first bundle advertised by the server is used.
2104
2106
2105 ``color``
2107 ``color``
2106 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2108 When to colorize output. Possible value are Boolean ("yes" or "no"), or
2107 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2109 "debug", or "always". (default: "yes"). "yes" will use color whenever it
2108 seems possible. See :hg:`help color` for details.
2110 seems possible. See :hg:`help color` for details.
2109
2111
2110 ``commitsubrepos``
2112 ``commitsubrepos``
2111 Whether to commit modified subrepositories when committing the
2113 Whether to commit modified subrepositories when committing the
2112 parent repository. If False and one subrepository has uncommitted
2114 parent repository. If False and one subrepository has uncommitted
2113 changes, abort the commit.
2115 changes, abort the commit.
2114 (default: False)
2116 (default: False)
2115
2117
2116 ``debug``
2118 ``debug``
2117 Print debugging information. (default: False)
2119 Print debugging information. (default: False)
2118
2120
2119 ``editor``
2121 ``editor``
2120 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2122 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
2121
2123
2122 ``fallbackencoding``
2124 ``fallbackencoding``
2123 Encoding to try if it's not possible to decode the changelog using
2125 Encoding to try if it's not possible to decode the changelog using
2124 UTF-8. (default: ISO-8859-1)
2126 UTF-8. (default: ISO-8859-1)
2125
2127
2126 ``graphnodetemplate``
2128 ``graphnodetemplate``
2127 The template used to print changeset nodes in an ASCII revision graph.
2129 The template used to print changeset nodes in an ASCII revision graph.
2128 (default: ``{graphnode}``)
2130 (default: ``{graphnode}``)
2129
2131
2130 ``ignore``
2132 ``ignore``
2131 A file to read per-user ignore patterns from. This file should be
2133 A file to read per-user ignore patterns from. This file should be
2132 in the same format as a repository-wide .hgignore file. Filenames
2134 in the same format as a repository-wide .hgignore file. Filenames
2133 are relative to the repository root. This option supports hook syntax,
2135 are relative to the repository root. This option supports hook syntax,
2134 so if you want to specify multiple ignore files, you can do so by
2136 so if you want to specify multiple ignore files, you can do so by
2135 setting something like ``ignore.other = ~/.hgignore2``. For details
2137 setting something like ``ignore.other = ~/.hgignore2``. For details
2136 of the ignore file format, see the ``hgignore(5)`` man page.
2138 of the ignore file format, see the ``hgignore(5)`` man page.
2137
2139
2138 ``interactive``
2140 ``interactive``
2139 Allow to prompt the user. (default: True)
2141 Allow to prompt the user. (default: True)
2140
2142
2141 ``interface``
2143 ``interface``
2142 Select the default interface for interactive features (default: text).
2144 Select the default interface for interactive features (default: text).
2143 Possible values are 'text' and 'curses'.
2145 Possible values are 'text' and 'curses'.
2144
2146
2145 ``interface.chunkselector``
2147 ``interface.chunkselector``
2146 Select the interface for change recording (e.g. :hg:`commit -i`).
2148 Select the interface for change recording (e.g. :hg:`commit -i`).
2147 Possible values are 'text' and 'curses'.
2149 Possible values are 'text' and 'curses'.
2148 This config overrides the interface specified by ui.interface.
2150 This config overrides the interface specified by ui.interface.
2149
2151
2150 ``large-file-limit``
2152 ``large-file-limit``
2151 Largest file size that gives no memory use warning.
2153 Largest file size that gives no memory use warning.
2152 Possible values are integers or 0 to disable the check.
2154 Possible values are integers or 0 to disable the check.
2153 (default: 10000000)
2155 (default: 10000000)
2154
2156
2155 ``logtemplate``
2157 ``logtemplate``
2156 Template string for commands that print changesets.
2158 Template string for commands that print changesets.
2157
2159
2158 ``merge``
2160 ``merge``
2159 The conflict resolution program to use during a manual merge.
2161 The conflict resolution program to use during a manual merge.
2160 For more information on merge tools see :hg:`help merge-tools`.
2162 For more information on merge tools see :hg:`help merge-tools`.
2161 For configuring merge tools see the ``[merge-tools]`` section.
2163 For configuring merge tools see the ``[merge-tools]`` section.
2162
2164
2163 ``mergemarkers``
2165 ``mergemarkers``
2164 Sets the merge conflict marker label styling. The ``detailed``
2166 Sets the merge conflict marker label styling. The ``detailed``
2165 style uses the ``mergemarkertemplate`` setting to style the labels.
2167 style uses the ``mergemarkertemplate`` setting to style the labels.
2166 The ``basic`` style just uses 'local' and 'other' as the marker label.
2168 The ``basic`` style just uses 'local' and 'other' as the marker label.
2167 One of ``basic`` or ``detailed``.
2169 One of ``basic`` or ``detailed``.
2168 (default: ``basic``)
2170 (default: ``basic``)
2169
2171
2170 ``mergemarkertemplate``
2172 ``mergemarkertemplate``
2171 The template used to print the commit description next to each conflict
2173 The template used to print the commit description next to each conflict
2172 marker during merge conflicts. See :hg:`help templates` for the template
2174 marker during merge conflicts. See :hg:`help templates` for the template
2173 format.
2175 format.
2174
2176
2175 Defaults to showing the hash, tags, branches, bookmarks, author, and
2177 Defaults to showing the hash, tags, branches, bookmarks, author, and
2176 the first line of the commit description.
2178 the first line of the commit description.
2177
2179
2178 If you use non-ASCII characters in names for tags, branches, bookmarks,
2180 If you use non-ASCII characters in names for tags, branches, bookmarks,
2179 authors, and/or commit descriptions, you must pay attention to encodings of
2181 authors, and/or commit descriptions, you must pay attention to encodings of
2180 managed files. At template expansion, non-ASCII characters use the encoding
2182 managed files. At template expansion, non-ASCII characters use the encoding
2181 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2183 specified by the ``--encoding`` global option, ``HGENCODING`` or other
2182 environment variables that govern your locale. If the encoding of the merge
2184 environment variables that govern your locale. If the encoding of the merge
2183 markers is different from the encoding of the merged files,
2185 markers is different from the encoding of the merged files,
2184 serious problems may occur.
2186 serious problems may occur.
2185
2187
2186 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2188 Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
2187
2189
2188 ``origbackuppath``
2190 ``origbackuppath``
2189 The path to a directory used to store generated .orig files. If the path is
2191 The path to a directory used to store generated .orig files. If the path is
2190 not a directory, one will be created. If set, files stored in this
2192 not a directory, one will be created. If set, files stored in this
2191 directory have the same name as the original file and do not have a .orig
2193 directory have the same name as the original file and do not have a .orig
2192 suffix.
2194 suffix.
2193
2195
2194 ``paginate``
2196 ``paginate``
2195 Control the pagination of command output (default: True). See :hg:`help pager`
2197 Control the pagination of command output (default: True). See :hg:`help pager`
2196 for details.
2198 for details.
2197
2199
2198 ``patch``
2200 ``patch``
2199 An optional external tool that ``hg import`` and some extensions
2201 An optional external tool that ``hg import`` and some extensions
2200 will use for applying patches. By default Mercurial uses an
2202 will use for applying patches. By default Mercurial uses an
2201 internal patch utility. The external tool must work as the common
2203 internal patch utility. The external tool must work as the common
2202 Unix ``patch`` program. In particular, it must accept a ``-p``
2204 Unix ``patch`` program. In particular, it must accept a ``-p``
2203 argument to strip patch headers, a ``-d`` argument to specify the
2205 argument to strip patch headers, a ``-d`` argument to specify the
2204 current directory, a file name to patch, and a patch file to take
2206 current directory, a file name to patch, and a patch file to take
2205 from stdin.
2207 from stdin.
2206
2208
2207 It is possible to specify a patch tool together with extra
2209 It is possible to specify a patch tool together with extra
2208 arguments. For example, setting this option to ``patch --merge``
2210 arguments. For example, setting this option to ``patch --merge``
2209 will use the ``patch`` program with its 2-way merge option.
2211 will use the ``patch`` program with its 2-way merge option.
2210
2212
2211 ``portablefilenames``
2213 ``portablefilenames``
2212 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2214 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
2213 (default: ``warn``)
2215 (default: ``warn``)
2214
2216
2215 ``warn``
2217 ``warn``
2216 Print a warning message on POSIX platforms, if a file with a non-portable
2218 Print a warning message on POSIX platforms, if a file with a non-portable
2217 filename is added (e.g. a file with a name that can't be created on
2219 filename is added (e.g. a file with a name that can't be created on
2218 Windows because it contains reserved parts like ``AUX``, reserved
2220 Windows because it contains reserved parts like ``AUX``, reserved
2219 characters like ``:``, or would cause a case collision with an existing
2221 characters like ``:``, or would cause a case collision with an existing
2220 file).
2222 file).
2221
2223
2222 ``ignore``
2224 ``ignore``
2223 Don't print a warning.
2225 Don't print a warning.
2224
2226
2225 ``abort``
2227 ``abort``
2226 The command is aborted.
2228 The command is aborted.
2227
2229
2228 ``true``
2230 ``true``
2229 Alias for ``warn``.
2231 Alias for ``warn``.
2230
2232
2231 ``false``
2233 ``false``
2232 Alias for ``ignore``.
2234 Alias for ``ignore``.
2233
2235
2234 .. container:: windows
2236 .. container:: windows
2235
2237
2236 On Windows, this configuration option is ignored and the command aborted.
2238 On Windows, this configuration option is ignored and the command aborted.
2237
2239
2238 ``quiet``
2240 ``quiet``
2239 Reduce the amount of output printed.
2241 Reduce the amount of output printed.
2240 (default: False)
2242 (default: False)
2241
2243
2242 ``remotecmd``
2244 ``remotecmd``
2243 Remote command to use for clone/push/pull operations.
2245 Remote command to use for clone/push/pull operations.
2244 (default: ``hg``)
2246 (default: ``hg``)
2245
2247
2246 ``report_untrusted``
2248 ``report_untrusted``
2247 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2249 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
2248 trusted user or group.
2250 trusted user or group.
2249 (default: True)
2251 (default: True)
2250
2252
2251 ``slash``
2253 ``slash``
2252 (Deprecated. Use ``slashpath`` template filter instead.)
2254 (Deprecated. Use ``slashpath`` template filter instead.)
2253
2255
2254 Display paths using a slash (``/``) as the path separator. This
2256 Display paths using a slash (``/``) as the path separator. This
2255 only makes a difference on systems where the default path
2257 only makes a difference on systems where the default path
2256 separator is not the slash character (e.g. Windows uses the
2258 separator is not the slash character (e.g. Windows uses the
2257 backslash character (``\``)).
2259 backslash character (``\``)).
2258 (default: False)
2260 (default: False)
2259
2261
2260 ``statuscopies``
2262 ``statuscopies``
2261 Display copies in the status command.
2263 Display copies in the status command.
2262
2264
2263 ``ssh``
2265 ``ssh``
2264 Command to use for SSH connections. (default: ``ssh``)
2266 Command to use for SSH connections. (default: ``ssh``)
2265
2267
2266 ``ssherrorhint``
2268 ``ssherrorhint``
2267 A hint shown to the user in the case of SSH error (e.g.
2269 A hint shown to the user in the case of SSH error (e.g.
2268 ``Please see http://company/internalwiki/ssh.html``)
2270 ``Please see http://company/internalwiki/ssh.html``)
2269
2271
2270 ``strict``
2272 ``strict``
2271 Require exact command names, instead of allowing unambiguous
2273 Require exact command names, instead of allowing unambiguous
2272 abbreviations. (default: False)
2274 abbreviations. (default: False)
2273
2275
2274 ``style``
2276 ``style``
2275 Name of style to use for command output.
2277 Name of style to use for command output.
2276
2278
2277 ``supportcontact``
2279 ``supportcontact``
2278 A URL where users should report a Mercurial traceback. Use this if you are a
2280 A URL where users should report a Mercurial traceback. Use this if you are a
2279 large organisation with its own Mercurial deployment process and crash
2281 large organisation with its own Mercurial deployment process and crash
2280 reports should be addressed to your internal support.
2282 reports should be addressed to your internal support.
2281
2283
2282 ``textwidth``
2284 ``textwidth``
2283 Maximum width of help text. A longer line generated by ``hg help`` or
2285 Maximum width of help text. A longer line generated by ``hg help`` or
2284 ``hg subcommand --help`` will be broken after white space to get this
2286 ``hg subcommand --help`` will be broken after white space to get this
2285 width or the terminal width, whichever comes first.
2287 width or the terminal width, whichever comes first.
2286 A non-positive value will disable this and the terminal width will be
2288 A non-positive value will disable this and the terminal width will be
2287 used. (default: 78)
2289 used. (default: 78)
2288
2290
2289 ``timeout``
2291 ``timeout``
2290 The timeout used when a lock is held (in seconds), a negative value
2292 The timeout used when a lock is held (in seconds), a negative value
2291 means no timeout. (default: 600)
2293 means no timeout. (default: 600)
2292
2294
2293 ``timeout.warn``
2295 ``timeout.warn``
2294 Time (in seconds) before a warning is printed about held lock. A negative
2296 Time (in seconds) before a warning is printed about held lock. A negative
2295 value means no warning. (default: 0)
2297 value means no warning. (default: 0)
2296
2298
2297 ``traceback``
2299 ``traceback``
2298 Mercurial always prints a traceback when an unknown exception
2300 Mercurial always prints a traceback when an unknown exception
2299 occurs. Setting this to True will make Mercurial print a traceback
2301 occurs. Setting this to True will make Mercurial print a traceback
2300 on all exceptions, even those recognized by Mercurial (such as
2302 on all exceptions, even those recognized by Mercurial (such as
2301 IOError or MemoryError). (default: False)
2303 IOError or MemoryError). (default: False)
2302
2304
2303 ``tweakdefaults``
2305 ``tweakdefaults``
2304
2306
2305 By default Mercurial's behavior changes very little from release
2307 By default Mercurial's behavior changes very little from release
2306 to release, but over time the recommended config settings
2308 to release, but over time the recommended config settings
2307 shift. Enable this config to opt in to get automatic tweaks to
2309 shift. Enable this config to opt in to get automatic tweaks to
2308 Mercurial's behavior over time. This config setting will have no
2310 Mercurial's behavior over time. This config setting will have no
2309 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2311 effet if ``HGPLAIN` is set or ``HGPLAINEXCEPT`` is set and does
2310 not include ``tweakdefaults``. (default: False)
2312 not include ``tweakdefaults``. (default: False)
2311
2313
2312 ``username``
2314 ``username``
2313 The committer of a changeset created when running "commit".
2315 The committer of a changeset created when running "commit".
2314 Typically a person's name and email address, e.g. ``Fred Widget
2316 Typically a person's name and email address, e.g. ``Fred Widget
2315 <fred@example.com>``. Environment variables in the
2317 <fred@example.com>``. Environment variables in the
2316 username are expanded.
2318 username are expanded.
2317
2319
2318 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2320 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2319 hgrc is empty, e.g. if the system admin set ``username =`` in the
2321 hgrc is empty, e.g. if the system admin set ``username =`` in the
2320 system hgrc, it has to be specified manually or in a different
2322 system hgrc, it has to be specified manually or in a different
2321 hgrc file)
2323 hgrc file)
2322
2324
2323 ``verbose``
2325 ``verbose``
2324 Increase the amount of output printed. (default: False)
2326 Increase the amount of output printed. (default: False)
2325
2327
2326
2328
2327 ``web``
2329 ``web``
2328 -------
2330 -------
2329
2331
2330 Web interface configuration. The settings in this section apply to
2332 Web interface configuration. The settings in this section apply to
2331 both the builtin webserver (started by :hg:`serve`) and the script you
2333 both the builtin webserver (started by :hg:`serve`) and the script you
2332 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2334 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2333 and WSGI).
2335 and WSGI).
2334
2336
2335 The Mercurial webserver does no authentication (it does not prompt for
2337 The Mercurial webserver does no authentication (it does not prompt for
2336 usernames and passwords to validate *who* users are), but it does do
2338 usernames and passwords to validate *who* users are), but it does do
2337 authorization (it grants or denies access for *authenticated users*
2339 authorization (it grants or denies access for *authenticated users*
2338 based on settings in this section). You must either configure your
2340 based on settings in this section). You must either configure your
2339 webserver to do authentication for you, or disable the authorization
2341 webserver to do authentication for you, or disable the authorization
2340 checks.
2342 checks.
2341
2343
2342 For a quick setup in a trusted environment, e.g., a private LAN, where
2344 For a quick setup in a trusted environment, e.g., a private LAN, where
2343 you want it to accept pushes from anybody, you can use the following
2345 you want it to accept pushes from anybody, you can use the following
2344 command line::
2346 command line::
2345
2347
2346 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2348 $ hg --config web.allow-push=* --config web.push_ssl=False serve
2347
2349
2348 Note that this will allow anybody to push anything to the server and
2350 Note that this will allow anybody to push anything to the server and
2349 that this should not be used for public servers.
2351 that this should not be used for public servers.
2350
2352
2351 The full set of options is:
2353 The full set of options is:
2352
2354
2353 ``accesslog``
2355 ``accesslog``
2354 Where to output the access log. (default: stdout)
2356 Where to output the access log. (default: stdout)
2355
2357
2356 ``address``
2358 ``address``
2357 Interface address to bind to. (default: all)
2359 Interface address to bind to. (default: all)
2358
2360
2359 ``allow-archive``
2361 ``allow-archive``
2360 List of archive format (bz2, gz, zip) allowed for downloading.
2362 List of archive format (bz2, gz, zip) allowed for downloading.
2361 (default: empty)
2363 (default: empty)
2362
2364
2363 ``allowbz2``
2365 ``allowbz2``
2364 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2366 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2365 revisions.
2367 revisions.
2366 (default: False)
2368 (default: False)
2367
2369
2368 ``allowgz``
2370 ``allowgz``
2369 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2371 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2370 revisions.
2372 revisions.
2371 (default: False)
2373 (default: False)
2372
2374
2373 ``allow-pull``
2375 ``allow-pull``
2374 Whether to allow pulling from the repository. (default: True)
2376 Whether to allow pulling from the repository. (default: True)
2375
2377
2376 ``allow-push``
2378 ``allow-push``
2377 Whether to allow pushing to the repository. If empty or not set,
2379 Whether to allow pushing to the repository. If empty or not set,
2378 pushing is not allowed. If the special value ``*``, any remote
2380 pushing is not allowed. If the special value ``*``, any remote
2379 user can push, including unauthenticated users. Otherwise, the
2381 user can push, including unauthenticated users. Otherwise, the
2380 remote user must have been authenticated, and the authenticated
2382 remote user must have been authenticated, and the authenticated
2381 user name must be present in this list. The contents of the
2383 user name must be present in this list. The contents of the
2382 allow-push list are examined after the deny_push list.
2384 allow-push list are examined after the deny_push list.
2383
2385
2384 ``allow_read``
2386 ``allow_read``
2385 If the user has not already been denied repository access due to
2387 If the user has not already been denied repository access due to
2386 the contents of deny_read, this list determines whether to grant
2388 the contents of deny_read, this list determines whether to grant
2387 repository access to the user. If this list is not empty, and the
2389 repository access to the user. If this list is not empty, and the
2388 user is unauthenticated or not present in the list, then access is
2390 user is unauthenticated or not present in the list, then access is
2389 denied for the user. If the list is empty or not set, then access
2391 denied for the user. If the list is empty or not set, then access
2390 is permitted to all users by default. Setting allow_read to the
2392 is permitted to all users by default. Setting allow_read to the
2391 special value ``*`` is equivalent to it not being set (i.e. access
2393 special value ``*`` is equivalent to it not being set (i.e. access
2392 is permitted to all users). The contents of the allow_read list are
2394 is permitted to all users). The contents of the allow_read list are
2393 examined after the deny_read list.
2395 examined after the deny_read list.
2394
2396
2395 ``allowzip``
2397 ``allowzip``
2396 (DEPRECATED) Whether to allow .zip downloading of repository
2398 (DEPRECATED) Whether to allow .zip downloading of repository
2397 revisions. This feature creates temporary files.
2399 revisions. This feature creates temporary files.
2398 (default: False)
2400 (default: False)
2399
2401
2400 ``archivesubrepos``
2402 ``archivesubrepos``
2401 Whether to recurse into subrepositories when archiving.
2403 Whether to recurse into subrepositories when archiving.
2402 (default: False)
2404 (default: False)
2403
2405
2404 ``baseurl``
2406 ``baseurl``
2405 Base URL to use when publishing URLs in other locations, so
2407 Base URL to use when publishing URLs in other locations, so
2406 third-party tools like email notification hooks can construct
2408 third-party tools like email notification hooks can construct
2407 URLs. Example: ``http://hgserver/repos/``.
2409 URLs. Example: ``http://hgserver/repos/``.
2408
2410
2409 ``cacerts``
2411 ``cacerts``
2410 Path to file containing a list of PEM encoded certificate
2412 Path to file containing a list of PEM encoded certificate
2411 authority certificates. Environment variables and ``~user``
2413 authority certificates. Environment variables and ``~user``
2412 constructs are expanded in the filename. If specified on the
2414 constructs are expanded in the filename. If specified on the
2413 client, then it will verify the identity of remote HTTPS servers
2415 client, then it will verify the identity of remote HTTPS servers
2414 with these certificates.
2416 with these certificates.
2415
2417
2416 To disable SSL verification temporarily, specify ``--insecure`` from
2418 To disable SSL verification temporarily, specify ``--insecure`` from
2417 command line.
2419 command line.
2418
2420
2419 You can use OpenSSL's CA certificate file if your platform has
2421 You can use OpenSSL's CA certificate file if your platform has
2420 one. On most Linux systems this will be
2422 one. On most Linux systems this will be
2421 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2423 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2422 generate this file manually. The form must be as follows::
2424 generate this file manually. The form must be as follows::
2423
2425
2424 -----BEGIN CERTIFICATE-----
2426 -----BEGIN CERTIFICATE-----
2425 ... (certificate in base64 PEM encoding) ...
2427 ... (certificate in base64 PEM encoding) ...
2426 -----END CERTIFICATE-----
2428 -----END CERTIFICATE-----
2427 -----BEGIN CERTIFICATE-----
2429 -----BEGIN CERTIFICATE-----
2428 ... (certificate in base64 PEM encoding) ...
2430 ... (certificate in base64 PEM encoding) ...
2429 -----END CERTIFICATE-----
2431 -----END CERTIFICATE-----
2430
2432
2431 ``cache``
2433 ``cache``
2432 Whether to support caching in hgweb. (default: True)
2434 Whether to support caching in hgweb. (default: True)
2433
2435
2434 ``certificate``
2436 ``certificate``
2435 Certificate to use when running :hg:`serve`.
2437 Certificate to use when running :hg:`serve`.
2436
2438
2437 ``collapse``
2439 ``collapse``
2438 With ``descend`` enabled, repositories in subdirectories are shown at
2440 With ``descend`` enabled, repositories in subdirectories are shown at
2439 a single level alongside repositories in the current path. With
2441 a single level alongside repositories in the current path. With
2440 ``collapse`` also enabled, repositories residing at a deeper level than
2442 ``collapse`` also enabled, repositories residing at a deeper level than
2441 the current path are grouped behind navigable directory entries that
2443 the current path are grouped behind navigable directory entries that
2442 lead to the locations of these repositories. In effect, this setting
2444 lead to the locations of these repositories. In effect, this setting
2443 collapses each collection of repositories found within a subdirectory
2445 collapses each collection of repositories found within a subdirectory
2444 into a single entry for that subdirectory. (default: False)
2446 into a single entry for that subdirectory. (default: False)
2445
2447
2446 ``comparisoncontext``
2448 ``comparisoncontext``
2447 Number of lines of context to show in side-by-side file comparison. If
2449 Number of lines of context to show in side-by-side file comparison. If
2448 negative or the value ``full``, whole files are shown. (default: 5)
2450 negative or the value ``full``, whole files are shown. (default: 5)
2449
2451
2450 This setting can be overridden by a ``context`` request parameter to the
2452 This setting can be overridden by a ``context`` request parameter to the
2451 ``comparison`` command, taking the same values.
2453 ``comparison`` command, taking the same values.
2452
2454
2453 ``contact``
2455 ``contact``
2454 Name or email address of the person in charge of the repository.
2456 Name or email address of the person in charge of the repository.
2455 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2457 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2456
2458
2457 ``csp``
2459 ``csp``
2458 Send a ``Content-Security-Policy`` HTTP header with this value.
2460 Send a ``Content-Security-Policy`` HTTP header with this value.
2459
2461
2460 The value may contain a special string ``%nonce%``, which will be replaced
2462 The value may contain a special string ``%nonce%``, which will be replaced
2461 by a randomly-generated one-time use value. If the value contains
2463 by a randomly-generated one-time use value. If the value contains
2462 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2464 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2463 one-time property of the nonce. This nonce will also be inserted into
2465 one-time property of the nonce. This nonce will also be inserted into
2464 ``<script>`` elements containing inline JavaScript.
2466 ``<script>`` elements containing inline JavaScript.
2465
2467
2466 Note: lots of HTML content sent by the server is derived from repository
2468 Note: lots of HTML content sent by the server is derived from repository
2467 data. Please consider the potential for malicious repository data to
2469 data. Please consider the potential for malicious repository data to
2468 "inject" itself into generated HTML content as part of your security
2470 "inject" itself into generated HTML content as part of your security
2469 threat model.
2471 threat model.
2470
2472
2471 ``deny_push``
2473 ``deny_push``
2472 Whether to deny pushing to the repository. If empty or not set,
2474 Whether to deny pushing to the repository. If empty or not set,
2473 push is not denied. If the special value ``*``, all remote users are
2475 push is not denied. If the special value ``*``, all remote users are
2474 denied push. Otherwise, unauthenticated users are all denied, and
2476 denied push. Otherwise, unauthenticated users are all denied, and
2475 any authenticated user name present in this list is also denied. The
2477 any authenticated user name present in this list is also denied. The
2476 contents of the deny_push list are examined before the allow-push list.
2478 contents of the deny_push list are examined before the allow-push list.
2477
2479
2478 ``deny_read``
2480 ``deny_read``
2479 Whether to deny reading/viewing of the repository. If this list is
2481 Whether to deny reading/viewing of the repository. If this list is
2480 not empty, unauthenticated users are all denied, and any
2482 not empty, unauthenticated users are all denied, and any
2481 authenticated user name present in this list is also denied access to
2483 authenticated user name present in this list is also denied access to
2482 the repository. If set to the special value ``*``, all remote users
2484 the repository. If set to the special value ``*``, all remote users
2483 are denied access (rarely needed ;). If deny_read is empty or not set,
2485 are denied access (rarely needed ;). If deny_read is empty or not set,
2484 the determination of repository access depends on the presence and
2486 the determination of repository access depends on the presence and
2485 content of the allow_read list (see description). If both
2487 content of the allow_read list (see description). If both
2486 deny_read and allow_read are empty or not set, then access is
2488 deny_read and allow_read are empty or not set, then access is
2487 permitted to all users by default. If the repository is being
2489 permitted to all users by default. If the repository is being
2488 served via hgwebdir, denied users will not be able to see it in
2490 served via hgwebdir, denied users will not be able to see it in
2489 the list of repositories. The contents of the deny_read list have
2491 the list of repositories. The contents of the deny_read list have
2490 priority over (are examined before) the contents of the allow_read
2492 priority over (are examined before) the contents of the allow_read
2491 list.
2493 list.
2492
2494
2493 ``descend``
2495 ``descend``
2494 hgwebdir indexes will not descend into subdirectories. Only repositories
2496 hgwebdir indexes will not descend into subdirectories. Only repositories
2495 directly in the current path will be shown (other repositories are still
2497 directly in the current path will be shown (other repositories are still
2496 available from the index corresponding to their containing path).
2498 available from the index corresponding to their containing path).
2497
2499
2498 ``description``
2500 ``description``
2499 Textual description of the repository's purpose or contents.
2501 Textual description of the repository's purpose or contents.
2500 (default: "unknown")
2502 (default: "unknown")
2501
2503
2502 ``encoding``
2504 ``encoding``
2503 Character encoding name. (default: the current locale charset)
2505 Character encoding name. (default: the current locale charset)
2504 Example: "UTF-8".
2506 Example: "UTF-8".
2505
2507
2506 ``errorlog``
2508 ``errorlog``
2507 Where to output the error log. (default: stderr)
2509 Where to output the error log. (default: stderr)
2508
2510
2509 ``guessmime``
2511 ``guessmime``
2510 Control MIME types for raw download of file content.
2512 Control MIME types for raw download of file content.
2511 Set to True to let hgweb guess the content type from the file
2513 Set to True to let hgweb guess the content type from the file
2512 extension. This will serve HTML files as ``text/html`` and might
2514 extension. This will serve HTML files as ``text/html`` and might
2513 allow cross-site scripting attacks when serving untrusted
2515 allow cross-site scripting attacks when serving untrusted
2514 repositories. (default: False)
2516 repositories. (default: False)
2515
2517
2516 ``hidden``
2518 ``hidden``
2517 Whether to hide the repository in the hgwebdir index.
2519 Whether to hide the repository in the hgwebdir index.
2518 (default: False)
2520 (default: False)
2519
2521
2520 ``ipv6``
2522 ``ipv6``
2521 Whether to use IPv6. (default: False)
2523 Whether to use IPv6. (default: False)
2522
2524
2523 ``labels``
2525 ``labels``
2524 List of string *labels* associated with the repository.
2526 List of string *labels* associated with the repository.
2525
2527
2526 Labels are exposed as a template keyword and can be used to customize
2528 Labels are exposed as a template keyword and can be used to customize
2527 output. e.g. the ``index`` template can group or filter repositories
2529 output. e.g. the ``index`` template can group or filter repositories
2528 by labels and the ``summary`` template can display additional content
2530 by labels and the ``summary`` template can display additional content
2529 if a specific label is present.
2531 if a specific label is present.
2530
2532
2531 ``logoimg``
2533 ``logoimg``
2532 File name of the logo image that some templates display on each page.
2534 File name of the logo image that some templates display on each page.
2533 The file name is relative to ``staticurl``. That is, the full path to
2535 The file name is relative to ``staticurl``. That is, the full path to
2534 the logo image is "staticurl/logoimg".
2536 the logo image is "staticurl/logoimg".
2535 If unset, ``hglogo.png`` will be used.
2537 If unset, ``hglogo.png`` will be used.
2536
2538
2537 ``logourl``
2539 ``logourl``
2538 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2540 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2539 will be used.
2541 will be used.
2540
2542
2541 ``maxchanges``
2543 ``maxchanges``
2542 Maximum number of changes to list on the changelog. (default: 10)
2544 Maximum number of changes to list on the changelog. (default: 10)
2543
2545
2544 ``maxfiles``
2546 ``maxfiles``
2545 Maximum number of files to list per changeset. (default: 10)
2547 Maximum number of files to list per changeset. (default: 10)
2546
2548
2547 ``maxshortchanges``
2549 ``maxshortchanges``
2548 Maximum number of changes to list on the shortlog, graph or filelog
2550 Maximum number of changes to list on the shortlog, graph or filelog
2549 pages. (default: 60)
2551 pages. (default: 60)
2550
2552
2551 ``name``
2553 ``name``
2552 Repository name to use in the web interface.
2554 Repository name to use in the web interface.
2553 (default: current working directory)
2555 (default: current working directory)
2554
2556
2555 ``port``
2557 ``port``
2556 Port to listen on. (default: 8000)
2558 Port to listen on. (default: 8000)
2557
2559
2558 ``prefix``
2560 ``prefix``
2559 Prefix path to serve from. (default: '' (server root))
2561 Prefix path to serve from. (default: '' (server root))
2560
2562
2561 ``push_ssl``
2563 ``push_ssl``
2562 Whether to require that inbound pushes be transported over SSL to
2564 Whether to require that inbound pushes be transported over SSL to
2563 prevent password sniffing. (default: True)
2565 prevent password sniffing. (default: True)
2564
2566
2565 ``refreshinterval``
2567 ``refreshinterval``
2566 How frequently directory listings re-scan the filesystem for new
2568 How frequently directory listings re-scan the filesystem for new
2567 repositories, in seconds. This is relevant when wildcards are used
2569 repositories, in seconds. This is relevant when wildcards are used
2568 to define paths. Depending on how much filesystem traversal is
2570 to define paths. Depending on how much filesystem traversal is
2569 required, refreshing may negatively impact performance.
2571 required, refreshing may negatively impact performance.
2570
2572
2571 Values less than or equal to 0 always refresh.
2573 Values less than or equal to 0 always refresh.
2572 (default: 20)
2574 (default: 20)
2573
2575
2574 ``server-header``
2576 ``server-header``
2575 Value for HTTP ``Server`` response header.
2577 Value for HTTP ``Server`` response header.
2576
2578
2577 ``staticurl``
2579 ``staticurl``
2578 Base URL to use for static files. If unset, static files (e.g. the
2580 Base URL to use for static files. If unset, static files (e.g. the
2579 hgicon.png favicon) will be served by the CGI script itself. Use
2581 hgicon.png favicon) will be served by the CGI script itself. Use
2580 this setting to serve them directly with the HTTP server.
2582 this setting to serve them directly with the HTTP server.
2581 Example: ``http://hgserver/static/``.
2583 Example: ``http://hgserver/static/``.
2582
2584
2583 ``stripes``
2585 ``stripes``
2584 How many lines a "zebra stripe" should span in multi-line output.
2586 How many lines a "zebra stripe" should span in multi-line output.
2585 Set to 0 to disable. (default: 1)
2587 Set to 0 to disable. (default: 1)
2586
2588
2587 ``style``
2589 ``style``
2588 Which template map style to use. The available options are the names of
2590 Which template map style to use. The available options are the names of
2589 subdirectories in the HTML templates path. (default: ``paper``)
2591 subdirectories in the HTML templates path. (default: ``paper``)
2590 Example: ``monoblue``.
2592 Example: ``monoblue``.
2591
2593
2592 ``templates``
2594 ``templates``
2593 Where to find the HTML templates. The default path to the HTML templates
2595 Where to find the HTML templates. The default path to the HTML templates
2594 can be obtained from ``hg debuginstall``.
2596 can be obtained from ``hg debuginstall``.
2595
2597
2596 ``websub``
2598 ``websub``
2597 ----------
2599 ----------
2598
2600
2599 Web substitution filter definition. You can use this section to
2601 Web substitution filter definition. You can use this section to
2600 define a set of regular expression substitution patterns which
2602 define a set of regular expression substitution patterns which
2601 let you automatically modify the hgweb server output.
2603 let you automatically modify the hgweb server output.
2602
2604
2603 The default hgweb templates only apply these substitution patterns
2605 The default hgweb templates only apply these substitution patterns
2604 on the revision description fields. You can apply them anywhere
2606 on the revision description fields. You can apply them anywhere
2605 you want when you create your own templates by adding calls to the
2607 you want when you create your own templates by adding calls to the
2606 "websub" filter (usually after calling the "escape" filter).
2608 "websub" filter (usually after calling the "escape" filter).
2607
2609
2608 This can be used, for example, to convert issue references to links
2610 This can be used, for example, to convert issue references to links
2609 to your issue tracker, or to convert "markdown-like" syntax into
2611 to your issue tracker, or to convert "markdown-like" syntax into
2610 HTML (see the examples below).
2612 HTML (see the examples below).
2611
2613
2612 Each entry in this section names a substitution filter.
2614 Each entry in this section names a substitution filter.
2613 The value of each entry defines the substitution expression itself.
2615 The value of each entry defines the substitution expression itself.
2614 The websub expressions follow the old interhg extension syntax,
2616 The websub expressions follow the old interhg extension syntax,
2615 which in turn imitates the Unix sed replacement syntax::
2617 which in turn imitates the Unix sed replacement syntax::
2616
2618
2617 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2619 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2618
2620
2619 You can use any separator other than "/". The final "i" is optional
2621 You can use any separator other than "/". The final "i" is optional
2620 and indicates that the search must be case insensitive.
2622 and indicates that the search must be case insensitive.
2621
2623
2622 Examples::
2624 Examples::
2623
2625
2624 [websub]
2626 [websub]
2625 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2627 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2626 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2628 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2627 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2629 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2628
2630
2629 ``worker``
2631 ``worker``
2630 ----------
2632 ----------
2631
2633
2632 Parallel master/worker configuration. We currently perform working
2634 Parallel master/worker configuration. We currently perform working
2633 directory updates in parallel on Unix-like systems, which greatly
2635 directory updates in parallel on Unix-like systems, which greatly
2634 helps performance.
2636 helps performance.
2635
2637
2636 ``enabled``
2638 ``enabled``
2637 Whether to enable workers code to be used.
2639 Whether to enable workers code to be used.
2638 (default: true)
2640 (default: true)
2639
2641
2640 ``numcpus``
2642 ``numcpus``
2641 Number of CPUs to use for parallel operations. A zero or
2643 Number of CPUs to use for parallel operations. A zero or
2642 negative value is treated as ``use the default``.
2644 negative value is treated as ``use the default``.
2643 (default: 4 or the number of CPUs on the system, whichever is larger)
2645 (default: 4 or the number of CPUs on the system, whichever is larger)
2644
2646
2645 ``backgroundclose``
2647 ``backgroundclose``
2646 Whether to enable closing file handles on background threads during certain
2648 Whether to enable closing file handles on background threads during certain
2647 operations. Some platforms aren't very efficient at closing file
2649 operations. Some platforms aren't very efficient at closing file
2648 handles that have been written or appended to. By performing file closing
2650 handles that have been written or appended to. By performing file closing
2649 on background threads, file write rate can increase substantially.
2651 on background threads, file write rate can increase substantially.
2650 (default: true on Windows, false elsewhere)
2652 (default: true on Windows, false elsewhere)
2651
2653
2652 ``backgroundcloseminfilecount``
2654 ``backgroundcloseminfilecount``
2653 Minimum number of files required to trigger background file closing.
2655 Minimum number of files required to trigger background file closing.
2654 Operations not writing this many files won't start background close
2656 Operations not writing this many files won't start background close
2655 threads.
2657 threads.
2656 (default: 2048)
2658 (default: 2048)
2657
2659
2658 ``backgroundclosemaxqueue``
2660 ``backgroundclosemaxqueue``
2659 The maximum number of opened file handles waiting to be closed in the
2661 The maximum number of opened file handles waiting to be closed in the
2660 background. This option only has an effect if ``backgroundclose`` is
2662 background. This option only has an effect if ``backgroundclose`` is
2661 enabled.
2663 enabled.
2662 (default: 384)
2664 (default: 384)
2663
2665
2664 ``backgroundclosethreadcount``
2666 ``backgroundclosethreadcount``
2665 Number of threads to process background file closes. Only relevant if
2667 Number of threads to process background file closes. Only relevant if
2666 ``backgroundclose`` is enabled.
2668 ``backgroundclose`` is enabled.
2667 (default: 4)
2669 (default: 4)
@@ -1,586 +1,593 b''
1 # windows.py - Windows utility function implementations for Mercurial
1 # windows.py - Windows utility function implementations for Mercurial
2 #
2 #
3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
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 __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import errno
10 import errno
11 import msvcrt
11 import msvcrt
12 import os
12 import os
13 import re
13 import re
14 import stat
14 import stat
15 import string
15 import string
16 import sys
16 import sys
17
17
18 from .i18n import _
18 from .i18n import _
19 from . import (
19 from . import (
20 encoding,
20 encoding,
21 error,
21 error,
22 policy,
22 policy,
23 pycompat,
23 pycompat,
24 win32,
24 win32,
25 )
25 )
26
26
27 try:
27 try:
28 import _winreg as winreg
28 import _winreg as winreg
29 winreg.CloseKey
29 winreg.CloseKey
30 except ImportError:
30 except ImportError:
31 import winreg
31 import winreg
32
32
33 osutil = policy.importmod(r'osutil')
33 osutil = policy.importmod(r'osutil')
34
34
35 getfsmountpoint = win32.getvolumename
35 getfsmountpoint = win32.getvolumename
36 getfstype = win32.getfstype
36 getfstype = win32.getfstype
37 getuser = win32.getuser
37 getuser = win32.getuser
38 hidewindow = win32.hidewindow
38 hidewindow = win32.hidewindow
39 makedir = win32.makedir
39 makedir = win32.makedir
40 nlinks = win32.nlinks
40 nlinks = win32.nlinks
41 oslink = win32.oslink
41 oslink = win32.oslink
42 samedevice = win32.samedevice
42 samedevice = win32.samedevice
43 samefile = win32.samefile
43 samefile = win32.samefile
44 setsignalhandler = win32.setsignalhandler
44 setsignalhandler = win32.setsignalhandler
45 spawndetached = win32.spawndetached
45 spawndetached = win32.spawndetached
46 split = os.path.split
46 split = os.path.split
47 testpid = win32.testpid
47 testpid = win32.testpid
48 unlink = win32.unlink
48 unlink = win32.unlink
49
49
50 umask = 0o022
50 umask = 0o022
51
51
52 class mixedfilemodewrapper(object):
52 class mixedfilemodewrapper(object):
53 """Wraps a file handle when it is opened in read/write mode.
53 """Wraps a file handle when it is opened in read/write mode.
54
54
55 fopen() and fdopen() on Windows have a specific-to-Windows requirement
55 fopen() and fdopen() on Windows have a specific-to-Windows requirement
56 that files opened with mode r+, w+, or a+ make a call to a file positioning
56 that files opened with mode r+, w+, or a+ make a call to a file positioning
57 function when switching between reads and writes. Without this extra call,
57 function when switching between reads and writes. Without this extra call,
58 Python will raise a not very intuitive "IOError: [Errno 0] Error."
58 Python will raise a not very intuitive "IOError: [Errno 0] Error."
59
59
60 This class wraps posixfile instances when the file is opened in read/write
60 This class wraps posixfile instances when the file is opened in read/write
61 mode and automatically adds checks or inserts appropriate file positioning
61 mode and automatically adds checks or inserts appropriate file positioning
62 calls when necessary.
62 calls when necessary.
63 """
63 """
64 OPNONE = 0
64 OPNONE = 0
65 OPREAD = 1
65 OPREAD = 1
66 OPWRITE = 2
66 OPWRITE = 2
67
67
68 def __init__(self, fp):
68 def __init__(self, fp):
69 object.__setattr__(self, r'_fp', fp)
69 object.__setattr__(self, r'_fp', fp)
70 object.__setattr__(self, r'_lastop', 0)
70 object.__setattr__(self, r'_lastop', 0)
71
71
72 def __enter__(self):
72 def __enter__(self):
73 return self._fp.__enter__()
73 return self._fp.__enter__()
74
74
75 def __exit__(self, exc_type, exc_val, exc_tb):
75 def __exit__(self, exc_type, exc_val, exc_tb):
76 self._fp.__exit__(exc_type, exc_val, exc_tb)
76 self._fp.__exit__(exc_type, exc_val, exc_tb)
77
77
78 def __getattr__(self, name):
78 def __getattr__(self, name):
79 return getattr(self._fp, name)
79 return getattr(self._fp, name)
80
80
81 def __setattr__(self, name, value):
81 def __setattr__(self, name, value):
82 return self._fp.__setattr__(name, value)
82 return self._fp.__setattr__(name, value)
83
83
84 def _noopseek(self):
84 def _noopseek(self):
85 self._fp.seek(0, os.SEEK_CUR)
85 self._fp.seek(0, os.SEEK_CUR)
86
86
87 def seek(self, *args, **kwargs):
87 def seek(self, *args, **kwargs):
88 object.__setattr__(self, r'_lastop', self.OPNONE)
88 object.__setattr__(self, r'_lastop', self.OPNONE)
89 return self._fp.seek(*args, **kwargs)
89 return self._fp.seek(*args, **kwargs)
90
90
91 def write(self, d):
91 def write(self, d):
92 if self._lastop == self.OPREAD:
92 if self._lastop == self.OPREAD:
93 self._noopseek()
93 self._noopseek()
94
94
95 object.__setattr__(self, r'_lastop', self.OPWRITE)
95 object.__setattr__(self, r'_lastop', self.OPWRITE)
96 return self._fp.write(d)
96 return self._fp.write(d)
97
97
98 def writelines(self, *args, **kwargs):
98 def writelines(self, *args, **kwargs):
99 if self._lastop == self.OPREAD:
99 if self._lastop == self.OPREAD:
100 self._noopeseek()
100 self._noopeseek()
101
101
102 object.__setattr__(self, r'_lastop', self.OPWRITE)
102 object.__setattr__(self, r'_lastop', self.OPWRITE)
103 return self._fp.writelines(*args, **kwargs)
103 return self._fp.writelines(*args, **kwargs)
104
104
105 def read(self, *args, **kwargs):
105 def read(self, *args, **kwargs):
106 if self._lastop == self.OPWRITE:
106 if self._lastop == self.OPWRITE:
107 self._noopseek()
107 self._noopseek()
108
108
109 object.__setattr__(self, r'_lastop', self.OPREAD)
109 object.__setattr__(self, r'_lastop', self.OPREAD)
110 return self._fp.read(*args, **kwargs)
110 return self._fp.read(*args, **kwargs)
111
111
112 def readline(self, *args, **kwargs):
112 def readline(self, *args, **kwargs):
113 if self._lastop == self.OPWRITE:
113 if self._lastop == self.OPWRITE:
114 self._noopseek()
114 self._noopseek()
115
115
116 object.__setattr__(self, r'_lastop', self.OPREAD)
116 object.__setattr__(self, r'_lastop', self.OPREAD)
117 return self._fp.readline(*args, **kwargs)
117 return self._fp.readline(*args, **kwargs)
118
118
119 def readlines(self, *args, **kwargs):
119 def readlines(self, *args, **kwargs):
120 if self._lastop == self.OPWRITE:
120 if self._lastop == self.OPWRITE:
121 self._noopseek()
121 self._noopseek()
122
122
123 object.__setattr__(self, r'_lastop', self.OPREAD)
123 object.__setattr__(self, r'_lastop', self.OPREAD)
124 return self._fp.readlines(*args, **kwargs)
124 return self._fp.readlines(*args, **kwargs)
125
125
126 def posixfile(name, mode='r', buffering=-1):
126 def posixfile(name, mode='r', buffering=-1):
127 '''Open a file with even more POSIX-like semantics'''
127 '''Open a file with even more POSIX-like semantics'''
128 try:
128 try:
129 fp = osutil.posixfile(name, mode, buffering) # may raise WindowsError
129 fp = osutil.posixfile(name, mode, buffering) # may raise WindowsError
130
130
131 # The position when opening in append mode is implementation defined, so
131 # The position when opening in append mode is implementation defined, so
132 # make it consistent with other platforms, which position at EOF.
132 # make it consistent with other platforms, which position at EOF.
133 if 'a' in mode:
133 if 'a' in mode:
134 fp.seek(0, os.SEEK_END)
134 fp.seek(0, os.SEEK_END)
135
135
136 if '+' in mode:
136 if '+' in mode:
137 return mixedfilemodewrapper(fp)
137 return mixedfilemodewrapper(fp)
138
138
139 return fp
139 return fp
140 except WindowsError as err:
140 except WindowsError as err:
141 # convert to a friendlier exception
141 # convert to a friendlier exception
142 raise IOError(err.errno, '%s: %s' % (
142 raise IOError(err.errno, '%s: %s' % (
143 name, encoding.strtolocal(err.strerror)))
143 name, encoding.strtolocal(err.strerror)))
144
144
145 # may be wrapped by win32mbcs extension
145 # may be wrapped by win32mbcs extension
146 listdir = osutil.listdir
146 listdir = osutil.listdir
147
147
148 class winstdout(object):
148 class winstdout(object):
149 '''stdout on windows misbehaves if sent through a pipe'''
149 '''stdout on windows misbehaves if sent through a pipe'''
150
150
151 def __init__(self, fp):
151 def __init__(self, fp):
152 self.fp = fp
152 self.fp = fp
153
153
154 def __getattr__(self, key):
154 def __getattr__(self, key):
155 return getattr(self.fp, key)
155 return getattr(self.fp, key)
156
156
157 def close(self):
157 def close(self):
158 try:
158 try:
159 self.fp.close()
159 self.fp.close()
160 except IOError:
160 except IOError:
161 pass
161 pass
162
162
163 def write(self, s):
163 def write(self, s):
164 try:
164 try:
165 # This is workaround for "Not enough space" error on
165 # This is workaround for "Not enough space" error on
166 # writing large size of data to console.
166 # writing large size of data to console.
167 limit = 16000
167 limit = 16000
168 l = len(s)
168 l = len(s)
169 start = 0
169 start = 0
170 self.softspace = 0
170 self.softspace = 0
171 while start < l:
171 while start < l:
172 end = start + limit
172 end = start + limit
173 self.fp.write(s[start:end])
173 self.fp.write(s[start:end])
174 start = end
174 start = end
175 except IOError as inst:
175 except IOError as inst:
176 if inst.errno != 0 and not win32.lasterrorwaspipeerror(inst):
176 if inst.errno != 0 and not win32.lasterrorwaspipeerror(inst):
177 raise
177 raise
178 self.close()
178 self.close()
179 raise IOError(errno.EPIPE, 'Broken pipe')
179 raise IOError(errno.EPIPE, 'Broken pipe')
180
180
181 def flush(self):
181 def flush(self):
182 try:
182 try:
183 return self.fp.flush()
183 return self.fp.flush()
184 except IOError as inst:
184 except IOError as inst:
185 if not win32.lasterrorwaspipeerror(inst):
185 if not win32.lasterrorwaspipeerror(inst):
186 raise
186 raise
187 raise IOError(errno.EPIPE, 'Broken pipe')
187 raise IOError(errno.EPIPE, 'Broken pipe')
188
188
189 def _is_win_9x():
189 def _is_win_9x():
190 '''return true if run on windows 95, 98 or me.'''
190 '''return true if run on windows 95, 98 or me.'''
191 try:
191 try:
192 return sys.getwindowsversion()[3] == 1
192 return sys.getwindowsversion()[3] == 1
193 except AttributeError:
193 except AttributeError:
194 return 'command' in encoding.environ.get('comspec', '')
194 return 'command' in encoding.environ.get('comspec', '')
195
195
196 def openhardlinks():
196 def openhardlinks():
197 return not _is_win_9x()
197 return not _is_win_9x()
198
198
199 def parsepatchoutput(output_line):
199 def parsepatchoutput(output_line):
200 """parses the output produced by patch and returns the filename"""
200 """parses the output produced by patch and returns the filename"""
201 pf = output_line[14:]
201 pf = output_line[14:]
202 if pf[0] == '`':
202 if pf[0] == '`':
203 pf = pf[1:-1] # Remove the quotes
203 pf = pf[1:-1] # Remove the quotes
204 return pf
204 return pf
205
205
206 def sshargs(sshcmd, host, user, port):
206 def sshargs(sshcmd, host, user, port):
207 '''Build argument list for ssh or Plink'''
207 '''Build argument list for ssh or Plink'''
208 pflag = 'plink' in sshcmd.lower() and '-P' or '-p'
208 pflag = 'plink' in sshcmd.lower() and '-P' or '-p'
209 args = user and ("%s@%s" % (user, host)) or host
209 args = user and ("%s@%s" % (user, host)) or host
210 if args.startswith('-') or args.startswith('/'):
210 if args.startswith('-') or args.startswith('/'):
211 raise error.Abort(
211 raise error.Abort(
212 _('illegal ssh hostname or username starting with - or /: %s') %
212 _('illegal ssh hostname or username starting with - or /: %s') %
213 args)
213 args)
214 args = shellquote(args)
214 args = shellquote(args)
215 if port:
215 if port:
216 args = '%s %s %s' % (pflag, shellquote(port), args)
216 args = '%s %s %s' % (pflag, shellquote(port), args)
217 return args
217 return args
218
218
219 def setflags(f, l, x):
219 def setflags(f, l, x):
220 pass
220 pass
221
221
222 def copymode(src, dst, mode=None):
222 def copymode(src, dst, mode=None):
223 pass
223 pass
224
224
225 def checkexec(path):
225 def checkexec(path):
226 return False
226 return False
227
227
228 def checklink(path):
228 def checklink(path):
229 return False
229 return False
230
230
231 def setbinary(fd):
231 def setbinary(fd):
232 # When run without console, pipes may expose invalid
232 # When run without console, pipes may expose invalid
233 # fileno(), usually set to -1.
233 # fileno(), usually set to -1.
234 fno = getattr(fd, 'fileno', None)
234 fno = getattr(fd, 'fileno', None)
235 if fno is not None and fno() >= 0:
235 if fno is not None and fno() >= 0:
236 msvcrt.setmode(fno(), os.O_BINARY)
236 msvcrt.setmode(fno(), os.O_BINARY)
237
237
238 def pconvert(path):
238 def pconvert(path):
239 return path.replace(pycompat.ossep, '/')
239 return path.replace(pycompat.ossep, '/')
240
240
241 def localpath(path):
241 def localpath(path):
242 return path.replace('/', '\\')
242 return path.replace('/', '\\')
243
243
244 def normpath(path):
244 def normpath(path):
245 return pconvert(os.path.normpath(path))
245 return pconvert(os.path.normpath(path))
246
246
247 def normcase(path):
247 def normcase(path):
248 return encoding.upper(path) # NTFS compares via upper()
248 return encoding.upper(path) # NTFS compares via upper()
249
249
250 # see posix.py for definitions
250 # see posix.py for definitions
251 normcasespec = encoding.normcasespecs.upper
251 normcasespec = encoding.normcasespecs.upper
252 normcasefallback = encoding.upperfallback
252 normcasefallback = encoding.upperfallback
253
253
254 def samestat(s1, s2):
254 def samestat(s1, s2):
255 return False
255 return False
256
256
257 def shelltocmdexe(path, env):
257 def shelltocmdexe(path, env):
258 r"""Convert shell variables in the form $var and ${var} inside ``path``
258 r"""Convert shell variables in the form $var and ${var} inside ``path``
259 to %var% form. Existing Windows style variables are left unchanged.
259 to %var% form. Existing Windows style variables are left unchanged.
260
260
261 The variables are limited to the given environment. Unknown variables are
261 The variables are limited to the given environment. Unknown variables are
262 left unchanged.
262 left unchanged.
263
263
264 >>> e = {b'var1': b'v1', b'var2': b'v2', b'var3': b'v3'}
264 >>> e = {b'var1': b'v1', b'var2': b'v2', b'var3': b'v3'}
265 >>> # Only valid values are expanded
265 >>> # Only valid values are expanded
266 >>> shelltocmdexe(b'cmd $var1 ${var2} %var3% $missing ${missing} %missing%',
266 >>> shelltocmdexe(b'cmd $var1 ${var2} %var3% $missing ${missing} %missing%',
267 ... e)
267 ... e)
268 'cmd %var1% %var2% %var3% $missing ${missing} %missing%'
268 'cmd %var1% %var2% %var3% $missing ${missing} %missing%'
269 >>> # Single quote prevents expansion, as does \$ escaping
269 >>> # Single quote prevents expansion, as does \$ escaping
270 >>> shelltocmdexe(b"cmd '$var1 ${var2} %var3%' \$var1 \${var2} \\", e)
270 >>> shelltocmdexe(b"cmd '$var1 ${var2} %var3%' \$var1 \${var2} \\", e)
271 'cmd "$var1 ${var2} %var3%" $var1 ${var2} \\'
271 'cmd "$var1 ${var2} %var3%" $var1 ${var2} \\'
272 >>> # $$ is not special. %% is not special either, but can be the end and
272 >>> # $$ is not special. %% is not special either, but can be the end and
273 >>> # start of consecutive variables
273 >>> # start of consecutive variables
274 >>> shelltocmdexe(b"cmd $$ %% %var1%%var2%", e)
274 >>> shelltocmdexe(b"cmd $$ %% %var1%%var2%", e)
275 'cmd $$ %% %var1%%var2%'
275 'cmd $$ %% %var1%%var2%'
276 >>> # No double substitution
276 >>> # No double substitution
277 >>> shelltocmdexe(b"$var1 %var1%", {b'var1': b'%var2%', b'var2': b'boom'})
277 >>> shelltocmdexe(b"$var1 %var1%", {b'var1': b'%var2%', b'var2': b'boom'})
278 '%var1% %var1%'
278 '%var1% %var1%'
279 >>> # Tilde expansion
280 >>> shelltocmdexe(b"~/dir ~\dir2 ~tmpfile \~/", {})
281 '%USERPROFILE%/dir %USERPROFILE%\\dir2 ~tmpfile ~/'
279 """
282 """
280 if not any(c in path for c in b"$'"):
283 if not any(c in path for c in b"$'~"):
281 return path
284 return path
282
285
283 varchars = pycompat.sysbytes(string.ascii_letters + string.digits) + b'_-'
286 varchars = pycompat.sysbytes(string.ascii_letters + string.digits) + b'_-'
284
287
285 res = b''
288 res = b''
286 index = 0
289 index = 0
287 pathlen = len(path)
290 pathlen = len(path)
288 while index < pathlen:
291 while index < pathlen:
289 c = path[index]
292 c = path[index]
290 if c == b'\'': # no expansion within single quotes
293 if c == b'\'': # no expansion within single quotes
291 path = path[index + 1:]
294 path = path[index + 1:]
292 pathlen = len(path)
295 pathlen = len(path)
293 try:
296 try:
294 index = path.index(b'\'')
297 index = path.index(b'\'')
295 res += b'"' + path[:index] + b'"'
298 res += b'"' + path[:index] + b'"'
296 except ValueError:
299 except ValueError:
297 res += c + path
300 res += c + path
298 index = pathlen - 1
301 index = pathlen - 1
299 elif c == b'%': # variable
302 elif c == b'%': # variable
300 path = path[index + 1:]
303 path = path[index + 1:]
301 pathlen = len(path)
304 pathlen = len(path)
302 try:
305 try:
303 index = path.index(b'%')
306 index = path.index(b'%')
304 except ValueError:
307 except ValueError:
305 res += b'%' + path
308 res += b'%' + path
306 index = pathlen - 1
309 index = pathlen - 1
307 else:
310 else:
308 var = path[:index]
311 var = path[:index]
309 res += b'%' + var + b'%'
312 res += b'%' + var + b'%'
310 elif c == b'$': # variable
313 elif c == b'$': # variable
311 if path[index + 1:index + 2] == b'{':
314 if path[index + 1:index + 2] == b'{':
312 path = path[index + 2:]
315 path = path[index + 2:]
313 pathlen = len(path)
316 pathlen = len(path)
314 try:
317 try:
315 index = path.index(b'}')
318 index = path.index(b'}')
316 var = path[:index]
319 var = path[:index]
317
320
318 # See below for why empty variables are handled specially
321 # See below for why empty variables are handled specially
319 if env.get(var, '') != '':
322 if env.get(var, '') != '':
320 res += b'%' + var + b'%'
323 res += b'%' + var + b'%'
321 else:
324 else:
322 res += b'${' + var + b'}'
325 res += b'${' + var + b'}'
323 except ValueError:
326 except ValueError:
324 res += b'${' + path
327 res += b'${' + path
325 index = pathlen - 1
328 index = pathlen - 1
326 else:
329 else:
327 var = b''
330 var = b''
328 index += 1
331 index += 1
329 c = path[index:index + 1]
332 c = path[index:index + 1]
330 while c != b'' and c in varchars:
333 while c != b'' and c in varchars:
331 var += c
334 var += c
332 index += 1
335 index += 1
333 c = path[index:index + 1]
336 c = path[index:index + 1]
334 # Some variables (like HG_OLDNODE) may be defined, but have an
337 # Some variables (like HG_OLDNODE) may be defined, but have an
335 # empty value. Those need to be skipped because when spawning
338 # empty value. Those need to be skipped because when spawning
336 # cmd.exe to run the hook, it doesn't replace %VAR% for an empty
339 # cmd.exe to run the hook, it doesn't replace %VAR% for an empty
337 # VAR, and that really confuses things like revset expressions.
340 # VAR, and that really confuses things like revset expressions.
338 # OTOH, if it's left in Unix format and the hook runs sh.exe, it
341 # OTOH, if it's left in Unix format and the hook runs sh.exe, it
339 # will substitute to an empty string, and everything is happy.
342 # will substitute to an empty string, and everything is happy.
340 if env.get(var, '') != '':
343 if env.get(var, '') != '':
341 res += b'%' + var + b'%'
344 res += b'%' + var + b'%'
342 else:
345 else:
343 res += b'$' + var
346 res += b'$' + var
344
347
345 if c != '':
348 if c != '':
346 index -= 1
349 index -= 1
347 elif c == b'\\' and index + 1 < pathlen and path[index + 1] == b'$':
350 elif (c == b'~' and index + 1 < pathlen
348 # Skip '\', but only if it is escaping $
351 and path[index + 1] in (b'\\', b'/')):
349 res += b'$'
352 res += "%USERPROFILE%"
353 elif (c == b'\\' and index + 1 < pathlen
354 and path[index + 1] in (b'$', b'~')):
355 # Skip '\', but only if it is escaping $ or ~
356 res += path[index + 1]
350 index += 1
357 index += 1
351 else:
358 else:
352 res += c
359 res += c
353
360
354 index += 1
361 index += 1
355 return res
362 return res
356
363
357 # A sequence of backslashes is special iff it precedes a double quote:
364 # A sequence of backslashes is special iff it precedes a double quote:
358 # - if there's an even number of backslashes, the double quote is not
365 # - if there's an even number of backslashes, the double quote is not
359 # quoted (i.e. it ends the quoted region)
366 # quoted (i.e. it ends the quoted region)
360 # - if there's an odd number of backslashes, the double quote is quoted
367 # - if there's an odd number of backslashes, the double quote is quoted
361 # - in both cases, every pair of backslashes is unquoted into a single
368 # - in both cases, every pair of backslashes is unquoted into a single
362 # backslash
369 # backslash
363 # (See http://msdn2.microsoft.com/en-us/library/a1y7w461.aspx )
370 # (See http://msdn2.microsoft.com/en-us/library/a1y7w461.aspx )
364 # So, to quote a string, we must surround it in double quotes, double
371 # So, to quote a string, we must surround it in double quotes, double
365 # the number of backslashes that precede double quotes and add another
372 # the number of backslashes that precede double quotes and add another
366 # backslash before every double quote (being careful with the double
373 # backslash before every double quote (being careful with the double
367 # quote we've appended to the end)
374 # quote we've appended to the end)
368 _quotere = None
375 _quotere = None
369 _needsshellquote = None
376 _needsshellquote = None
370 def shellquote(s):
377 def shellquote(s):
371 r"""
378 r"""
372 >>> shellquote(br'C:\Users\xyz')
379 >>> shellquote(br'C:\Users\xyz')
373 '"C:\\Users\\xyz"'
380 '"C:\\Users\\xyz"'
374 >>> shellquote(br'C:\Users\xyz/mixed')
381 >>> shellquote(br'C:\Users\xyz/mixed')
375 '"C:\\Users\\xyz/mixed"'
382 '"C:\\Users\\xyz/mixed"'
376 >>> # Would be safe not to quote too, since it is all double backslashes
383 >>> # Would be safe not to quote too, since it is all double backslashes
377 >>> shellquote(br'C:\\Users\\xyz')
384 >>> shellquote(br'C:\\Users\\xyz')
378 '"C:\\\\Users\\\\xyz"'
385 '"C:\\\\Users\\\\xyz"'
379 >>> # But this must be quoted
386 >>> # But this must be quoted
380 >>> shellquote(br'C:\\Users\\xyz/abc')
387 >>> shellquote(br'C:\\Users\\xyz/abc')
381 '"C:\\\\Users\\\\xyz/abc"'
388 '"C:\\\\Users\\\\xyz/abc"'
382 """
389 """
383 global _quotere
390 global _quotere
384 if _quotere is None:
391 if _quotere is None:
385 _quotere = re.compile(r'(\\*)("|\\$)')
392 _quotere = re.compile(r'(\\*)("|\\$)')
386 global _needsshellquote
393 global _needsshellquote
387 if _needsshellquote is None:
394 if _needsshellquote is None:
388 # ":" is also treated as "safe character", because it is used as a part
395 # ":" is also treated as "safe character", because it is used as a part
389 # of path name on Windows. "\" is also part of a path name, but isn't
396 # of path name on Windows. "\" is also part of a path name, but isn't
390 # safe because shlex.split() (kind of) treats it as an escape char and
397 # safe because shlex.split() (kind of) treats it as an escape char and
391 # drops it. It will leave the next character, even if it is another
398 # drops it. It will leave the next character, even if it is another
392 # "\".
399 # "\".
393 _needsshellquote = re.compile(r'[^a-zA-Z0-9._:/-]').search
400 _needsshellquote = re.compile(r'[^a-zA-Z0-9._:/-]').search
394 if s and not _needsshellquote(s) and not _quotere.search(s):
401 if s and not _needsshellquote(s) and not _quotere.search(s):
395 # "s" shouldn't have to be quoted
402 # "s" shouldn't have to be quoted
396 return s
403 return s
397 return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
404 return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
398
405
399 def _unquote(s):
406 def _unquote(s):
400 if s.startswith(b'"') and s.endswith(b'"'):
407 if s.startswith(b'"') and s.endswith(b'"'):
401 return s[1:-1]
408 return s[1:-1]
402 return s
409 return s
403
410
404 def shellsplit(s):
411 def shellsplit(s):
405 """Parse a command string in cmd.exe way (best-effort)"""
412 """Parse a command string in cmd.exe way (best-effort)"""
406 return pycompat.maplist(_unquote, pycompat.shlexsplit(s, posix=False))
413 return pycompat.maplist(_unquote, pycompat.shlexsplit(s, posix=False))
407
414
408 def quotecommand(cmd):
415 def quotecommand(cmd):
409 """Build a command string suitable for os.popen* calls."""
416 """Build a command string suitable for os.popen* calls."""
410 if sys.version_info < (2, 7, 1):
417 if sys.version_info < (2, 7, 1):
411 # Python versions since 2.7.1 do this extra quoting themselves
418 # Python versions since 2.7.1 do this extra quoting themselves
412 return '"' + cmd + '"'
419 return '"' + cmd + '"'
413 return cmd
420 return cmd
414
421
415 # if you change this stub into a real check, please try to implement the
422 # if you change this stub into a real check, please try to implement the
416 # username and groupname functions above, too.
423 # username and groupname functions above, too.
417 def isowner(st):
424 def isowner(st):
418 return True
425 return True
419
426
420 def findexe(command):
427 def findexe(command):
421 '''Find executable for command searching like cmd.exe does.
428 '''Find executable for command searching like cmd.exe does.
422 If command is a basename then PATH is searched for command.
429 If command is a basename then PATH is searched for command.
423 PATH isn't searched if command is an absolute or relative path.
430 PATH isn't searched if command is an absolute or relative path.
424 An extension from PATHEXT is found and added if not present.
431 An extension from PATHEXT is found and added if not present.
425 If command isn't found None is returned.'''
432 If command isn't found None is returned.'''
426 pathext = encoding.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD')
433 pathext = encoding.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD')
427 pathexts = [ext for ext in pathext.lower().split(pycompat.ospathsep)]
434 pathexts = [ext for ext in pathext.lower().split(pycompat.ospathsep)]
428 if os.path.splitext(command)[1].lower() in pathexts:
435 if os.path.splitext(command)[1].lower() in pathexts:
429 pathexts = ['']
436 pathexts = ['']
430
437
431 def findexisting(pathcommand):
438 def findexisting(pathcommand):
432 'Will append extension (if needed) and return existing file'
439 'Will append extension (if needed) and return existing file'
433 for ext in pathexts:
440 for ext in pathexts:
434 executable = pathcommand + ext
441 executable = pathcommand + ext
435 if os.path.exists(executable):
442 if os.path.exists(executable):
436 return executable
443 return executable
437 return None
444 return None
438
445
439 if pycompat.ossep in command:
446 if pycompat.ossep in command:
440 return findexisting(command)
447 return findexisting(command)
441
448
442 for path in encoding.environ.get('PATH', '').split(pycompat.ospathsep):
449 for path in encoding.environ.get('PATH', '').split(pycompat.ospathsep):
443 executable = findexisting(os.path.join(path, command))
450 executable = findexisting(os.path.join(path, command))
444 if executable is not None:
451 if executable is not None:
445 return executable
452 return executable
446 return findexisting(os.path.expanduser(os.path.expandvars(command)))
453 return findexisting(os.path.expanduser(os.path.expandvars(command)))
447
454
448 _wantedkinds = {stat.S_IFREG, stat.S_IFLNK}
455 _wantedkinds = {stat.S_IFREG, stat.S_IFLNK}
449
456
450 def statfiles(files):
457 def statfiles(files):
451 '''Stat each file in files. Yield each stat, or None if a file
458 '''Stat each file in files. Yield each stat, or None if a file
452 does not exist or has a type we don't care about.
459 does not exist or has a type we don't care about.
453
460
454 Cluster and cache stat per directory to minimize number of OS stat calls.'''
461 Cluster and cache stat per directory to minimize number of OS stat calls.'''
455 dircache = {} # dirname -> filename -> status | None if file does not exist
462 dircache = {} # dirname -> filename -> status | None if file does not exist
456 getkind = stat.S_IFMT
463 getkind = stat.S_IFMT
457 for nf in files:
464 for nf in files:
458 nf = normcase(nf)
465 nf = normcase(nf)
459 dir, base = os.path.split(nf)
466 dir, base = os.path.split(nf)
460 if not dir:
467 if not dir:
461 dir = '.'
468 dir = '.'
462 cache = dircache.get(dir, None)
469 cache = dircache.get(dir, None)
463 if cache is None:
470 if cache is None:
464 try:
471 try:
465 dmap = dict([(normcase(n), s)
472 dmap = dict([(normcase(n), s)
466 for n, k, s in listdir(dir, True)
473 for n, k, s in listdir(dir, True)
467 if getkind(s.st_mode) in _wantedkinds])
474 if getkind(s.st_mode) in _wantedkinds])
468 except OSError as err:
475 except OSError as err:
469 # Python >= 2.5 returns ENOENT and adds winerror field
476 # Python >= 2.5 returns ENOENT and adds winerror field
470 # EINVAL is raised if dir is not a directory.
477 # EINVAL is raised if dir is not a directory.
471 if err.errno not in (errno.ENOENT, errno.EINVAL,
478 if err.errno not in (errno.ENOENT, errno.EINVAL,
472 errno.ENOTDIR):
479 errno.ENOTDIR):
473 raise
480 raise
474 dmap = {}
481 dmap = {}
475 cache = dircache.setdefault(dir, dmap)
482 cache = dircache.setdefault(dir, dmap)
476 yield cache.get(base, None)
483 yield cache.get(base, None)
477
484
478 def username(uid=None):
485 def username(uid=None):
479 """Return the name of the user with the given uid.
486 """Return the name of the user with the given uid.
480
487
481 If uid is None, return the name of the current user."""
488 If uid is None, return the name of the current user."""
482 return None
489 return None
483
490
484 def groupname(gid=None):
491 def groupname(gid=None):
485 """Return the name of the group with the given gid.
492 """Return the name of the group with the given gid.
486
493
487 If gid is None, return the name of the current group."""
494 If gid is None, return the name of the current group."""
488 return None
495 return None
489
496
490 def removedirs(name):
497 def removedirs(name):
491 """special version of os.removedirs that does not remove symlinked
498 """special version of os.removedirs that does not remove symlinked
492 directories or junction points if they actually contain files"""
499 directories or junction points if they actually contain files"""
493 if listdir(name):
500 if listdir(name):
494 return
501 return
495 os.rmdir(name)
502 os.rmdir(name)
496 head, tail = os.path.split(name)
503 head, tail = os.path.split(name)
497 if not tail:
504 if not tail:
498 head, tail = os.path.split(head)
505 head, tail = os.path.split(head)
499 while head and tail:
506 while head and tail:
500 try:
507 try:
501 if listdir(head):
508 if listdir(head):
502 return
509 return
503 os.rmdir(head)
510 os.rmdir(head)
504 except (ValueError, OSError):
511 except (ValueError, OSError):
505 break
512 break
506 head, tail = os.path.split(head)
513 head, tail = os.path.split(head)
507
514
508 def rename(src, dst):
515 def rename(src, dst):
509 '''atomically rename file src to dst, replacing dst if it exists'''
516 '''atomically rename file src to dst, replacing dst if it exists'''
510 try:
517 try:
511 os.rename(src, dst)
518 os.rename(src, dst)
512 except OSError as e:
519 except OSError as e:
513 if e.errno != errno.EEXIST:
520 if e.errno != errno.EEXIST:
514 raise
521 raise
515 unlink(dst)
522 unlink(dst)
516 os.rename(src, dst)
523 os.rename(src, dst)
517
524
518 def gethgcmd():
525 def gethgcmd():
519 return [sys.executable] + sys.argv[:1]
526 return [sys.executable] + sys.argv[:1]
520
527
521 def groupmembers(name):
528 def groupmembers(name):
522 # Don't support groups on Windows for now
529 # Don't support groups on Windows for now
523 raise KeyError
530 raise KeyError
524
531
525 def isexec(f):
532 def isexec(f):
526 return False
533 return False
527
534
528 class cachestat(object):
535 class cachestat(object):
529 def __init__(self, path):
536 def __init__(self, path):
530 pass
537 pass
531
538
532 def cacheable(self):
539 def cacheable(self):
533 return False
540 return False
534
541
535 def lookupreg(key, valname=None, scope=None):
542 def lookupreg(key, valname=None, scope=None):
536 ''' Look up a key/value name in the Windows registry.
543 ''' Look up a key/value name in the Windows registry.
537
544
538 valname: value name. If unspecified, the default value for the key
545 valname: value name. If unspecified, the default value for the key
539 is used.
546 is used.
540 scope: optionally specify scope for registry lookup, this can be
547 scope: optionally specify scope for registry lookup, this can be
541 a sequence of scopes to look up in order. Default (CURRENT_USER,
548 a sequence of scopes to look up in order. Default (CURRENT_USER,
542 LOCAL_MACHINE).
549 LOCAL_MACHINE).
543 '''
550 '''
544 if scope is None:
551 if scope is None:
545 scope = (winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE)
552 scope = (winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE)
546 elif not isinstance(scope, (list, tuple)):
553 elif not isinstance(scope, (list, tuple)):
547 scope = (scope,)
554 scope = (scope,)
548 for s in scope:
555 for s in scope:
549 try:
556 try:
550 val = winreg.QueryValueEx(winreg.OpenKey(s, key), valname)[0]
557 val = winreg.QueryValueEx(winreg.OpenKey(s, key), valname)[0]
551 # never let a Unicode string escape into the wild
558 # never let a Unicode string escape into the wild
552 return encoding.unitolocal(val)
559 return encoding.unitolocal(val)
553 except EnvironmentError:
560 except EnvironmentError:
554 pass
561 pass
555
562
556 expandglobs = True
563 expandglobs = True
557
564
558 def statislink(st):
565 def statislink(st):
559 '''check whether a stat result is a symlink'''
566 '''check whether a stat result is a symlink'''
560 return False
567 return False
561
568
562 def statisexec(st):
569 def statisexec(st):
563 '''check whether a stat result is an executable file'''
570 '''check whether a stat result is an executable file'''
564 return False
571 return False
565
572
566 def poll(fds):
573 def poll(fds):
567 # see posix.py for description
574 # see posix.py for description
568 raise NotImplementedError()
575 raise NotImplementedError()
569
576
570 def readpipe(pipe):
577 def readpipe(pipe):
571 """Read all available data from a pipe."""
578 """Read all available data from a pipe."""
572 chunks = []
579 chunks = []
573 while True:
580 while True:
574 size = win32.peekpipe(pipe)
581 size = win32.peekpipe(pipe)
575 if not size:
582 if not size:
576 break
583 break
577
584
578 s = pipe.read(size)
585 s = pipe.read(size)
579 if not s:
586 if not s:
580 break
587 break
581 chunks.append(s)
588 chunks.append(s)
582
589
583 return ''.join(chunks)
590 return ''.join(chunks)
584
591
585 def bindunixsocket(sock, path):
592 def bindunixsocket(sock, path):
586 raise NotImplementedError('unsupported platform')
593 raise NotImplementedError('unsupported platform')
General Comments 0
You need to be logged in to leave comments. Login now