##// END OF EJS Templates
url: support auth.cookiesfile for adding cookies to HTTP requests...
Gregory Szorc -
r31936:806f9a88 default
parent child Browse files
Show More
@@ -1,2369 +1,2389 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 ``ignorewsamount``
316 ``ignorewsamount``
317 Ignore changes in the amount of white space.
317 Ignore changes in the amount of white space.
318
318
319 ``ignoreblanklines``
319 ``ignoreblanklines``
320 Ignore changes whose lines are all blank.
320 Ignore changes whose lines are all blank.
321
321
322
322
323 ``auth``
323 ``auth``
324 --------
324 --------
325
325
326 Authentication credentials for HTTP authentication. This section
326 Authentication credentials and other authentication-like configuration
327 allows you to store usernames and passwords for use when logging
327 for HTTP connections. This section allows you to store usernames and
328 *into* HTTP servers. See :hg:`help config.web` if
328 passwords for use when logging *into* HTTP servers. See
329 you want to configure *who* can login to your HTTP server.
329 :hg:`help config.web` if you want to configure *who* can login to
330
330 your HTTP server.
331 Each line has the following format::
331
332 The following options apply to all hosts.
333
334 ``cookiefile``
335 Path to a file containing HTTP cookie lines. Cookies matching a
336 host will be sent automatically.
337
338 The file format uses the Mozilla cookies.txt format, which defines cookies
339 on their own lines. Each line contains 7 fields delimited by the tab
340 character (domain, is_domain_cookie, path, is_secure, expires, name,
341 value). For more info, do an Internet search for "Netscape cookies.txt
342 format."
343
344 Note: the cookies parser does not handle port numbers on domains. You
345 will need to remove ports from the domain for the cookie to be recognized.
346 This could result in a cookie being disclosed to an unwanted server.
347
348 The cookies file is read-only.
349
350 Other options in this section are grouped by name and have the following
351 format::
332
352
333 <name>.<argument> = <value>
353 <name>.<argument> = <value>
334
354
335 where ``<name>`` is used to group arguments into authentication
355 where ``<name>`` is used to group arguments into authentication
336 entries. Example::
356 entries. Example::
337
357
338 foo.prefix = hg.intevation.de/mercurial
358 foo.prefix = hg.intevation.de/mercurial
339 foo.username = foo
359 foo.username = foo
340 foo.password = bar
360 foo.password = bar
341 foo.schemes = http https
361 foo.schemes = http https
342
362
343 bar.prefix = secure.example.org
363 bar.prefix = secure.example.org
344 bar.key = path/to/file.key
364 bar.key = path/to/file.key
345 bar.cert = path/to/file.cert
365 bar.cert = path/to/file.cert
346 bar.schemes = https
366 bar.schemes = https
347
367
348 Supported arguments:
368 Supported arguments:
349
369
350 ``prefix``
370 ``prefix``
351 Either ``*`` or a URI prefix with or without the scheme part.
371 Either ``*`` or a URI prefix with or without the scheme part.
352 The authentication entry with the longest matching prefix is used
372 The authentication entry with the longest matching prefix is used
353 (where ``*`` matches everything and counts as a match of length
373 (where ``*`` matches everything and counts as a match of length
354 1). If the prefix doesn't include a scheme, the match is performed
374 1). If the prefix doesn't include a scheme, the match is performed
355 against the URI with its scheme stripped as well, and the schemes
375 against the URI with its scheme stripped as well, and the schemes
356 argument, q.v., is then subsequently consulted.
376 argument, q.v., is then subsequently consulted.
357
377
358 ``username``
378 ``username``
359 Optional. Username to authenticate with. If not given, and the
379 Optional. Username to authenticate with. If not given, and the
360 remote site requires basic or digest authentication, the user will
380 remote site requires basic or digest authentication, the user will
361 be prompted for it. Environment variables are expanded in the
381 be prompted for it. Environment variables are expanded in the
362 username letting you do ``foo.username = $USER``. If the URI
382 username letting you do ``foo.username = $USER``. If the URI
363 includes a username, only ``[auth]`` entries with a matching
383 includes a username, only ``[auth]`` entries with a matching
364 username or without a username will be considered.
384 username or without a username will be considered.
365
385
366 ``password``
386 ``password``
367 Optional. Password to authenticate with. If not given, and the
387 Optional. Password to authenticate with. If not given, and the
368 remote site requires basic or digest authentication, the user
388 remote site requires basic or digest authentication, the user
369 will be prompted for it.
389 will be prompted for it.
370
390
371 ``key``
391 ``key``
372 Optional. PEM encoded client certificate key file. Environment
392 Optional. PEM encoded client certificate key file. Environment
373 variables are expanded in the filename.
393 variables are expanded in the filename.
374
394
375 ``cert``
395 ``cert``
376 Optional. PEM encoded client certificate chain file. Environment
396 Optional. PEM encoded client certificate chain file. Environment
377 variables are expanded in the filename.
397 variables are expanded in the filename.
378
398
379 ``schemes``
399 ``schemes``
380 Optional. Space separated list of URI schemes to use this
400 Optional. Space separated list of URI schemes to use this
381 authentication entry with. Only used if the prefix doesn't include
401 authentication entry with. Only used if the prefix doesn't include
382 a scheme. Supported schemes are http and https. They will match
402 a scheme. Supported schemes are http and https. They will match
383 static-http and static-https respectively, as well.
403 static-http and static-https respectively, as well.
384 (default: https)
404 (default: https)
385
405
386 If no suitable authentication entry is found, the user is prompted
406 If no suitable authentication entry is found, the user is prompted
387 for credentials as usual if required by the remote.
407 for credentials as usual if required by the remote.
388
408
389 ``color``
409 ``color``
390 ---------
410 ---------
391
411
392 Configure the Mercurial color mode. For details about how to define your custom
412 Configure the Mercurial color mode. For details about how to define your custom
393 effect and style see :hg:`help color`.
413 effect and style see :hg:`help color`.
394
414
395 ``mode``
415 ``mode``
396 String: control the method used to output color. One of ``auto``, ``ansi``,
416 String: control the method used to output color. One of ``auto``, ``ansi``,
397 ``win32``, ``terminfo`` or ``debug``. In auto mode the color extension will
417 ``win32``, ``terminfo`` or ``debug``. In auto mode the color extension will
398 use ANSI mode by default (or win32 mode on Windows) if it detects a
418 use ANSI mode by default (or win32 mode on Windows) if it detects a
399 terminal. Any invalid value will disable color.
419 terminal. Any invalid value will disable color.
400
420
401 ``pagermode``
421 ``pagermode``
402 String: optinal override of ``color.mode`` used with pager (from the pager
422 String: optinal override of ``color.mode`` used with pager (from the pager
403 extensions).
423 extensions).
404
424
405 On some systems, terminfo mode may cause problems when using
425 On some systems, terminfo mode may cause problems when using
406 color with the pager extension and less -R. less with the -R option
426 color with the pager extension and less -R. less with the -R option
407 will only display ECMA-48 color codes, and terminfo mode may sometimes
427 will only display ECMA-48 color codes, and terminfo mode may sometimes
408 emit codes that less doesn't understand. You can work around this by
428 emit codes that less doesn't understand. You can work around this by
409 either using ansi mode (or auto mode), or by using less -r (which will
429 either using ansi mode (or auto mode), or by using less -r (which will
410 pass through all terminal control codes, not just color control
430 pass through all terminal control codes, not just color control
411 codes).
431 codes).
412
432
413 On some systems (such as MSYS in Windows), the terminal may support
433 On some systems (such as MSYS in Windows), the terminal may support
414 a different color mode than the pager (activated via the "pager"
434 a different color mode than the pager (activated via the "pager"
415 extension).
435 extension).
416
436
417 ``commands``
437 ``commands``
418 ------------
438 ------------
419
439
420 ``status.relative``
440 ``status.relative``
421 Make paths in ``hg status`` output relative to the current directory.
441 Make paths in ``hg status`` output relative to the current directory.
422 (default: False)
442 (default: False)
423
443
424 ``update.requiredest``
444 ``update.requiredest``
425 Require that the user pass a destination when running ``hg update``.
445 Require that the user pass a destination when running ``hg update``.
426 For example, ``hg update .::`` will be allowed, but a plain ``hg update``
446 For example, ``hg update .::`` will be allowed, but a plain ``hg update``
427 will be disallowed.
447 will be disallowed.
428 (default: False)
448 (default: False)
429
449
430 ``committemplate``
450 ``committemplate``
431 ------------------
451 ------------------
432
452
433 ``changeset``
453 ``changeset``
434 String: configuration in this section is used as the template to
454 String: configuration in this section is used as the template to
435 customize the text shown in the editor when committing.
455 customize the text shown in the editor when committing.
436
456
437 In addition to pre-defined template keywords, commit log specific one
457 In addition to pre-defined template keywords, commit log specific one
438 below can be used for customization:
458 below can be used for customization:
439
459
440 ``extramsg``
460 ``extramsg``
441 String: Extra message (typically 'Leave message empty to abort
461 String: Extra message (typically 'Leave message empty to abort
442 commit.'). This may be changed by some commands or extensions.
462 commit.'). This may be changed by some commands or extensions.
443
463
444 For example, the template configuration below shows as same text as
464 For example, the template configuration below shows as same text as
445 one shown by default::
465 one shown by default::
446
466
447 [committemplate]
467 [committemplate]
448 changeset = {desc}\n\n
468 changeset = {desc}\n\n
449 HG: Enter commit message. Lines beginning with 'HG:' are removed.
469 HG: Enter commit message. Lines beginning with 'HG:' are removed.
450 HG: {extramsg}
470 HG: {extramsg}
451 HG: --
471 HG: --
452 HG: user: {author}\n{ifeq(p2rev, "-1", "",
472 HG: user: {author}\n{ifeq(p2rev, "-1", "",
453 "HG: branch merge\n")
473 "HG: branch merge\n")
454 }HG: branch '{branch}'\n{if(activebookmark,
474 }HG: branch '{branch}'\n{if(activebookmark,
455 "HG: bookmark '{activebookmark}'\n") }{subrepos %
475 "HG: bookmark '{activebookmark}'\n") }{subrepos %
456 "HG: subrepo {subrepo}\n" }{file_adds %
476 "HG: subrepo {subrepo}\n" }{file_adds %
457 "HG: added {file}\n" }{file_mods %
477 "HG: added {file}\n" }{file_mods %
458 "HG: changed {file}\n" }{file_dels %
478 "HG: changed {file}\n" }{file_dels %
459 "HG: removed {file}\n" }{if(files, "",
479 "HG: removed {file}\n" }{if(files, "",
460 "HG: no files changed\n")}
480 "HG: no files changed\n")}
461
481
462 ``diff()``
482 ``diff()``
463 String: show the diff (see :hg:`help templates` for detail)
483 String: show the diff (see :hg:`help templates` for detail)
464
484
465 Sometimes it is helpful to show the diff of the changeset in the editor without
485 Sometimes it is helpful to show the diff of the changeset in the editor without
466 having to prefix 'HG: ' to each line so that highlighting works correctly. For
486 having to prefix 'HG: ' to each line so that highlighting works correctly. For
467 this, Mercurial provides a special string which will ignore everything below
487 this, Mercurial provides a special string which will ignore everything below
468 it::
488 it::
469
489
470 HG: ------------------------ >8 ------------------------
490 HG: ------------------------ >8 ------------------------
471
491
472 For example, the template configuration below will show the diff below the
492 For example, the template configuration below will show the diff below the
473 extra message::
493 extra message::
474
494
475 [committemplate]
495 [committemplate]
476 changeset = {desc}\n\n
496 changeset = {desc}\n\n
477 HG: Enter commit message. Lines beginning with 'HG:' are removed.
497 HG: Enter commit message. Lines beginning with 'HG:' are removed.
478 HG: {extramsg}
498 HG: {extramsg}
479 HG: ------------------------ >8 ------------------------
499 HG: ------------------------ >8 ------------------------
480 HG: Do not touch the line above.
500 HG: Do not touch the line above.
481 HG: Everything below will be removed.
501 HG: Everything below will be removed.
482 {diff()}
502 {diff()}
483
503
484 .. note::
504 .. note::
485
505
486 For some problematic encodings (see :hg:`help win32mbcs` for
506 For some problematic encodings (see :hg:`help win32mbcs` for
487 detail), this customization should be configured carefully, to
507 detail), this customization should be configured carefully, to
488 avoid showing broken characters.
508 avoid showing broken characters.
489
509
490 For example, if a multibyte character ending with backslash (0x5c) is
510 For example, if a multibyte character ending with backslash (0x5c) is
491 followed by the ASCII character 'n' in the customized template,
511 followed by the ASCII character 'n' in the customized template,
492 the sequence of backslash and 'n' is treated as line-feed unexpectedly
512 the sequence of backslash and 'n' is treated as line-feed unexpectedly
493 (and the multibyte character is broken, too).
513 (and the multibyte character is broken, too).
494
514
495 Customized template is used for commands below (``--edit`` may be
515 Customized template is used for commands below (``--edit`` may be
496 required):
516 required):
497
517
498 - :hg:`backout`
518 - :hg:`backout`
499 - :hg:`commit`
519 - :hg:`commit`
500 - :hg:`fetch` (for merge commit only)
520 - :hg:`fetch` (for merge commit only)
501 - :hg:`graft`
521 - :hg:`graft`
502 - :hg:`histedit`
522 - :hg:`histedit`
503 - :hg:`import`
523 - :hg:`import`
504 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
524 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
505 - :hg:`rebase`
525 - :hg:`rebase`
506 - :hg:`shelve`
526 - :hg:`shelve`
507 - :hg:`sign`
527 - :hg:`sign`
508 - :hg:`tag`
528 - :hg:`tag`
509 - :hg:`transplant`
529 - :hg:`transplant`
510
530
511 Configuring items below instead of ``changeset`` allows showing
531 Configuring items below instead of ``changeset`` allows showing
512 customized message only for specific actions, or showing different
532 customized message only for specific actions, or showing different
513 messages for each action.
533 messages for each action.
514
534
515 - ``changeset.backout`` for :hg:`backout`
535 - ``changeset.backout`` for :hg:`backout`
516 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
536 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
517 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
537 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
518 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
538 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
519 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
539 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
520 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
540 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
521 - ``changeset.gpg.sign`` for :hg:`sign`
541 - ``changeset.gpg.sign`` for :hg:`sign`
522 - ``changeset.graft`` for :hg:`graft`
542 - ``changeset.graft`` for :hg:`graft`
523 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
543 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
524 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
544 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
525 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
545 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
526 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
546 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
527 - ``changeset.import.bypass`` for :hg:`import --bypass`
547 - ``changeset.import.bypass`` for :hg:`import --bypass`
528 - ``changeset.import.normal.merge`` for :hg:`import` on merges
548 - ``changeset.import.normal.merge`` for :hg:`import` on merges
529 - ``changeset.import.normal.normal`` for :hg:`import` on other
549 - ``changeset.import.normal.normal`` for :hg:`import` on other
530 - ``changeset.mq.qnew`` for :hg:`qnew`
550 - ``changeset.mq.qnew`` for :hg:`qnew`
531 - ``changeset.mq.qfold`` for :hg:`qfold`
551 - ``changeset.mq.qfold`` for :hg:`qfold`
532 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
552 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
533 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
553 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
534 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
554 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
535 - ``changeset.rebase.normal`` for :hg:`rebase` on other
555 - ``changeset.rebase.normal`` for :hg:`rebase` on other
536 - ``changeset.shelve.shelve`` for :hg:`shelve`
556 - ``changeset.shelve.shelve`` for :hg:`shelve`
537 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
557 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
538 - ``changeset.tag.remove`` for :hg:`tag --remove`
558 - ``changeset.tag.remove`` for :hg:`tag --remove`
539 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
559 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
540 - ``changeset.transplant.normal`` for :hg:`transplant` on other
560 - ``changeset.transplant.normal`` for :hg:`transplant` on other
541
561
542 These dot-separated lists of names are treated as hierarchical ones.
562 These dot-separated lists of names are treated as hierarchical ones.
543 For example, ``changeset.tag.remove`` customizes the commit message
563 For example, ``changeset.tag.remove`` customizes the commit message
544 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
564 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
545 commit message for :hg:`tag` regardless of ``--remove`` option.
565 commit message for :hg:`tag` regardless of ``--remove`` option.
546
566
547 When the external editor is invoked for a commit, the corresponding
567 When the external editor is invoked for a commit, the corresponding
548 dot-separated list of names without the ``changeset.`` prefix
568 dot-separated list of names without the ``changeset.`` prefix
549 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
569 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
550 variable.
570 variable.
551
571
552 In this section, items other than ``changeset`` can be referred from
572 In this section, items other than ``changeset`` can be referred from
553 others. For example, the configuration to list committed files up
573 others. For example, the configuration to list committed files up
554 below can be referred as ``{listupfiles}``::
574 below can be referred as ``{listupfiles}``::
555
575
556 [committemplate]
576 [committemplate]
557 listupfiles = {file_adds %
577 listupfiles = {file_adds %
558 "HG: added {file}\n" }{file_mods %
578 "HG: added {file}\n" }{file_mods %
559 "HG: changed {file}\n" }{file_dels %
579 "HG: changed {file}\n" }{file_dels %
560 "HG: removed {file}\n" }{if(files, "",
580 "HG: removed {file}\n" }{if(files, "",
561 "HG: no files changed\n")}
581 "HG: no files changed\n")}
562
582
563 ``decode/encode``
583 ``decode/encode``
564 -----------------
584 -----------------
565
585
566 Filters for transforming files on checkout/checkin. This would
586 Filters for transforming files on checkout/checkin. This would
567 typically be used for newline processing or other
587 typically be used for newline processing or other
568 localization/canonicalization of files.
588 localization/canonicalization of files.
569
589
570 Filters consist of a filter pattern followed by a filter command.
590 Filters consist of a filter pattern followed by a filter command.
571 Filter patterns are globs by default, rooted at the repository root.
591 Filter patterns are globs by default, rooted at the repository root.
572 For example, to match any file ending in ``.txt`` in the root
592 For example, to match any file ending in ``.txt`` in the root
573 directory only, use the pattern ``*.txt``. To match any file ending
593 directory only, use the pattern ``*.txt``. To match any file ending
574 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
594 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
575 For each file only the first matching filter applies.
595 For each file only the first matching filter applies.
576
596
577 The filter command can start with a specifier, either ``pipe:`` or
597 The filter command can start with a specifier, either ``pipe:`` or
578 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
598 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
579
599
580 A ``pipe:`` command must accept data on stdin and return the transformed
600 A ``pipe:`` command must accept data on stdin and return the transformed
581 data on stdout.
601 data on stdout.
582
602
583 Pipe example::
603 Pipe example::
584
604
585 [encode]
605 [encode]
586 # uncompress gzip files on checkin to improve delta compression
606 # uncompress gzip files on checkin to improve delta compression
587 # note: not necessarily a good idea, just an example
607 # note: not necessarily a good idea, just an example
588 *.gz = pipe: gunzip
608 *.gz = pipe: gunzip
589
609
590 [decode]
610 [decode]
591 # recompress gzip files when writing them to the working dir (we
611 # recompress gzip files when writing them to the working dir (we
592 # can safely omit "pipe:", because it's the default)
612 # can safely omit "pipe:", because it's the default)
593 *.gz = gzip
613 *.gz = gzip
594
614
595 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
615 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
596 with the name of a temporary file that contains the data to be
616 with the name of a temporary file that contains the data to be
597 filtered by the command. The string ``OUTFILE`` is replaced with the name
617 filtered by the command. The string ``OUTFILE`` is replaced with the name
598 of an empty temporary file, where the filtered data must be written by
618 of an empty temporary file, where the filtered data must be written by
599 the command.
619 the command.
600
620
601 .. container:: windows
621 .. container:: windows
602
622
603 .. note::
623 .. note::
604
624
605 The tempfile mechanism is recommended for Windows systems,
625 The tempfile mechanism is recommended for Windows systems,
606 where the standard shell I/O redirection operators often have
626 where the standard shell I/O redirection operators often have
607 strange effects and may corrupt the contents of your files.
627 strange effects and may corrupt the contents of your files.
608
628
609 This filter mechanism is used internally by the ``eol`` extension to
629 This filter mechanism is used internally by the ``eol`` extension to
610 translate line ending characters between Windows (CRLF) and Unix (LF)
630 translate line ending characters between Windows (CRLF) and Unix (LF)
611 format. We suggest you use the ``eol`` extension for convenience.
631 format. We suggest you use the ``eol`` extension for convenience.
612
632
613
633
614 ``defaults``
634 ``defaults``
615 ------------
635 ------------
616
636
617 (defaults are deprecated. Don't use them. Use aliases instead.)
637 (defaults are deprecated. Don't use them. Use aliases instead.)
618
638
619 Use the ``[defaults]`` section to define command defaults, i.e. the
639 Use the ``[defaults]`` section to define command defaults, i.e. the
620 default options/arguments to pass to the specified commands.
640 default options/arguments to pass to the specified commands.
621
641
622 The following example makes :hg:`log` run in verbose mode, and
642 The following example makes :hg:`log` run in verbose mode, and
623 :hg:`status` show only the modified files, by default::
643 :hg:`status` show only the modified files, by default::
624
644
625 [defaults]
645 [defaults]
626 log = -v
646 log = -v
627 status = -m
647 status = -m
628
648
629 The actual commands, instead of their aliases, must be used when
649 The actual commands, instead of their aliases, must be used when
630 defining command defaults. The command defaults will also be applied
650 defining command defaults. The command defaults will also be applied
631 to the aliases of the commands defined.
651 to the aliases of the commands defined.
632
652
633
653
634 ``diff``
654 ``diff``
635 --------
655 --------
636
656
637 Settings used when displaying diffs. Everything except for ``unified``
657 Settings used when displaying diffs. Everything except for ``unified``
638 is a Boolean and defaults to False. See :hg:`help config.annotate`
658 is a Boolean and defaults to False. See :hg:`help config.annotate`
639 for related options for the annotate command.
659 for related options for the annotate command.
640
660
641 ``git``
661 ``git``
642 Use git extended diff format.
662 Use git extended diff format.
643
663
644 ``nobinary``
664 ``nobinary``
645 Omit git binary patches.
665 Omit git binary patches.
646
666
647 ``nodates``
667 ``nodates``
648 Don't include dates in diff headers.
668 Don't include dates in diff headers.
649
669
650 ``noprefix``
670 ``noprefix``
651 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
671 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
652
672
653 ``showfunc``
673 ``showfunc``
654 Show which function each change is in.
674 Show which function each change is in.
655
675
656 ``ignorews``
676 ``ignorews``
657 Ignore white space when comparing lines.
677 Ignore white space when comparing lines.
658
678
659 ``ignorewsamount``
679 ``ignorewsamount``
660 Ignore changes in the amount of white space.
680 Ignore changes in the amount of white space.
661
681
662 ``ignoreblanklines``
682 ``ignoreblanklines``
663 Ignore changes whose lines are all blank.
683 Ignore changes whose lines are all blank.
664
684
665 ``unified``
685 ``unified``
666 Number of lines of context to show.
686 Number of lines of context to show.
667
687
668 ``email``
688 ``email``
669 ---------
689 ---------
670
690
671 Settings for extensions that send email messages.
691 Settings for extensions that send email messages.
672
692
673 ``from``
693 ``from``
674 Optional. Email address to use in "From" header and SMTP envelope
694 Optional. Email address to use in "From" header and SMTP envelope
675 of outgoing messages.
695 of outgoing messages.
676
696
677 ``to``
697 ``to``
678 Optional. Comma-separated list of recipients' email addresses.
698 Optional. Comma-separated list of recipients' email addresses.
679
699
680 ``cc``
700 ``cc``
681 Optional. Comma-separated list of carbon copy recipients'
701 Optional. Comma-separated list of carbon copy recipients'
682 email addresses.
702 email addresses.
683
703
684 ``bcc``
704 ``bcc``
685 Optional. Comma-separated list of blind carbon copy recipients'
705 Optional. Comma-separated list of blind carbon copy recipients'
686 email addresses.
706 email addresses.
687
707
688 ``method``
708 ``method``
689 Optional. Method to use to send email messages. If value is ``smtp``
709 Optional. Method to use to send email messages. If value is ``smtp``
690 (default), use SMTP (see the ``[smtp]`` section for configuration).
710 (default), use SMTP (see the ``[smtp]`` section for configuration).
691 Otherwise, use as name of program to run that acts like sendmail
711 Otherwise, use as name of program to run that acts like sendmail
692 (takes ``-f`` option for sender, list of recipients on command line,
712 (takes ``-f`` option for sender, list of recipients on command line,
693 message on stdin). Normally, setting this to ``sendmail`` or
713 message on stdin). Normally, setting this to ``sendmail`` or
694 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
714 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
695
715
696 ``charsets``
716 ``charsets``
697 Optional. Comma-separated list of character sets considered
717 Optional. Comma-separated list of character sets considered
698 convenient for recipients. Addresses, headers, and parts not
718 convenient for recipients. Addresses, headers, and parts not
699 containing patches of outgoing messages will be encoded in the
719 containing patches of outgoing messages will be encoded in the
700 first character set to which conversion from local encoding
720 first character set to which conversion from local encoding
701 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
721 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
702 conversion fails, the text in question is sent as is.
722 conversion fails, the text in question is sent as is.
703 (default: '')
723 (default: '')
704
724
705 Order of outgoing email character sets:
725 Order of outgoing email character sets:
706
726
707 1. ``us-ascii``: always first, regardless of settings
727 1. ``us-ascii``: always first, regardless of settings
708 2. ``email.charsets``: in order given by user
728 2. ``email.charsets``: in order given by user
709 3. ``ui.fallbackencoding``: if not in email.charsets
729 3. ``ui.fallbackencoding``: if not in email.charsets
710 4. ``$HGENCODING``: if not in email.charsets
730 4. ``$HGENCODING``: if not in email.charsets
711 5. ``utf-8``: always last, regardless of settings
731 5. ``utf-8``: always last, regardless of settings
712
732
713 Email example::
733 Email example::
714
734
715 [email]
735 [email]
716 from = Joseph User <joe.user@example.com>
736 from = Joseph User <joe.user@example.com>
717 method = /usr/sbin/sendmail
737 method = /usr/sbin/sendmail
718 # charsets for western Europeans
738 # charsets for western Europeans
719 # us-ascii, utf-8 omitted, as they are tried first and last
739 # us-ascii, utf-8 omitted, as they are tried first and last
720 charsets = iso-8859-1, iso-8859-15, windows-1252
740 charsets = iso-8859-1, iso-8859-15, windows-1252
721
741
722
742
723 ``extensions``
743 ``extensions``
724 --------------
744 --------------
725
745
726 Mercurial has an extension mechanism for adding new features. To
746 Mercurial has an extension mechanism for adding new features. To
727 enable an extension, create an entry for it in this section.
747 enable an extension, create an entry for it in this section.
728
748
729 If you know that the extension is already in Python's search path,
749 If you know that the extension is already in Python's search path,
730 you can give the name of the module, followed by ``=``, with nothing
750 you can give the name of the module, followed by ``=``, with nothing
731 after the ``=``.
751 after the ``=``.
732
752
733 Otherwise, give a name that you choose, followed by ``=``, followed by
753 Otherwise, give a name that you choose, followed by ``=``, followed by
734 the path to the ``.py`` file (including the file name extension) that
754 the path to the ``.py`` file (including the file name extension) that
735 defines the extension.
755 defines the extension.
736
756
737 To explicitly disable an extension that is enabled in an hgrc of
757 To explicitly disable an extension that is enabled in an hgrc of
738 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
758 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
739 or ``foo = !`` when path is not supplied.
759 or ``foo = !`` when path is not supplied.
740
760
741 Example for ``~/.hgrc``::
761 Example for ``~/.hgrc``::
742
762
743 [extensions]
763 [extensions]
744 # (the churn extension will get loaded from Mercurial's path)
764 # (the churn extension will get loaded from Mercurial's path)
745 churn =
765 churn =
746 # (this extension will get loaded from the file specified)
766 # (this extension will get loaded from the file specified)
747 myfeature = ~/.hgext/myfeature.py
767 myfeature = ~/.hgext/myfeature.py
748
768
749
769
750 ``format``
770 ``format``
751 ----------
771 ----------
752
772
753 ``usegeneraldelta``
773 ``usegeneraldelta``
754 Enable or disable the "generaldelta" repository format which improves
774 Enable or disable the "generaldelta" repository format which improves
755 repository compression by allowing "revlog" to store delta against arbitrary
775 repository compression by allowing "revlog" to store delta against arbitrary
756 revision instead of the previous stored one. This provides significant
776 revision instead of the previous stored one. This provides significant
757 improvement for repositories with branches.
777 improvement for repositories with branches.
758
778
759 Repositories with this on-disk format require Mercurial version 1.9.
779 Repositories with this on-disk format require Mercurial version 1.9.
760
780
761 Enabled by default.
781 Enabled by default.
762
782
763 ``dotencode``
783 ``dotencode``
764 Enable or disable the "dotencode" repository format which enhances
784 Enable or disable the "dotencode" repository format which enhances
765 the "fncache" repository format (which has to be enabled to use
785 the "fncache" repository format (which has to be enabled to use
766 dotencode) to avoid issues with filenames starting with ._ on
786 dotencode) to avoid issues with filenames starting with ._ on
767 Mac OS X and spaces on Windows.
787 Mac OS X and spaces on Windows.
768
788
769 Repositories with this on-disk format require Mercurial version 1.7.
789 Repositories with this on-disk format require Mercurial version 1.7.
770
790
771 Enabled by default.
791 Enabled by default.
772
792
773 ``usefncache``
793 ``usefncache``
774 Enable or disable the "fncache" repository format which enhances
794 Enable or disable the "fncache" repository format which enhances
775 the "store" repository format (which has to be enabled to use
795 the "store" repository format (which has to be enabled to use
776 fncache) to allow longer filenames and avoids using Windows
796 fncache) to allow longer filenames and avoids using Windows
777 reserved names, e.g. "nul".
797 reserved names, e.g. "nul".
778
798
779 Repositories with this on-disk format require Mercurial version 1.1.
799 Repositories with this on-disk format require Mercurial version 1.1.
780
800
781 Enabled by default.
801 Enabled by default.
782
802
783 ``usestore``
803 ``usestore``
784 Enable or disable the "store" repository format which improves
804 Enable or disable the "store" repository format which improves
785 compatibility with systems that fold case or otherwise mangle
805 compatibility with systems that fold case or otherwise mangle
786 filenames. Disabling this option will allow you to store longer filenames
806 filenames. Disabling this option will allow you to store longer filenames
787 in some situations at the expense of compatibility.
807 in some situations at the expense of compatibility.
788
808
789 Repositories with this on-disk format require Mercurial version 0.9.4.
809 Repositories with this on-disk format require Mercurial version 0.9.4.
790
810
791 Enabled by default.
811 Enabled by default.
792
812
793 ``graph``
813 ``graph``
794 ---------
814 ---------
795
815
796 Web graph view configuration. This section let you change graph
816 Web graph view configuration. This section let you change graph
797 elements display properties by branches, for instance to make the
817 elements display properties by branches, for instance to make the
798 ``default`` branch stand out.
818 ``default`` branch stand out.
799
819
800 Each line has the following format::
820 Each line has the following format::
801
821
802 <branch>.<argument> = <value>
822 <branch>.<argument> = <value>
803
823
804 where ``<branch>`` is the name of the branch being
824 where ``<branch>`` is the name of the branch being
805 customized. Example::
825 customized. Example::
806
826
807 [graph]
827 [graph]
808 # 2px width
828 # 2px width
809 default.width = 2
829 default.width = 2
810 # red color
830 # red color
811 default.color = FF0000
831 default.color = FF0000
812
832
813 Supported arguments:
833 Supported arguments:
814
834
815 ``width``
835 ``width``
816 Set branch edges width in pixels.
836 Set branch edges width in pixels.
817
837
818 ``color``
838 ``color``
819 Set branch edges color in hexadecimal RGB notation.
839 Set branch edges color in hexadecimal RGB notation.
820
840
821 ``hooks``
841 ``hooks``
822 ---------
842 ---------
823
843
824 Commands or Python functions that get automatically executed by
844 Commands or Python functions that get automatically executed by
825 various actions such as starting or finishing a commit. Multiple
845 various actions such as starting or finishing a commit. Multiple
826 hooks can be run for the same action by appending a suffix to the
846 hooks can be run for the same action by appending a suffix to the
827 action. Overriding a site-wide hook can be done by changing its
847 action. Overriding a site-wide hook can be done by changing its
828 value or setting it to an empty string. Hooks can be prioritized
848 value or setting it to an empty string. Hooks can be prioritized
829 by adding a prefix of ``priority.`` to the hook name on a new line
849 by adding a prefix of ``priority.`` to the hook name on a new line
830 and setting the priority. The default priority is 0.
850 and setting the priority. The default priority is 0.
831
851
832 Example ``.hg/hgrc``::
852 Example ``.hg/hgrc``::
833
853
834 [hooks]
854 [hooks]
835 # update working directory after adding changesets
855 # update working directory after adding changesets
836 changegroup.update = hg update
856 changegroup.update = hg update
837 # do not use the site-wide hook
857 # do not use the site-wide hook
838 incoming =
858 incoming =
839 incoming.email = /my/email/hook
859 incoming.email = /my/email/hook
840 incoming.autobuild = /my/build/hook
860 incoming.autobuild = /my/build/hook
841 # force autobuild hook to run before other incoming hooks
861 # force autobuild hook to run before other incoming hooks
842 priority.incoming.autobuild = 1
862 priority.incoming.autobuild = 1
843
863
844 Most hooks are run with environment variables set that give useful
864 Most hooks are run with environment variables set that give useful
845 additional information. For each hook below, the environment variables
865 additional information. For each hook below, the environment variables
846 it is passed are listed with names of the form ``$HG_foo``. The
866 it is passed are listed with names of the form ``$HG_foo``. The
847 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
867 ``$HG_HOOKTYPE`` and ``$HG_HOOKNAME`` variables are set for all hooks.
848 their respectively contains the type of hook which triggered the run and
868 their respectively contains the type of hook which triggered the run and
849 the full name of the hooks in the config. In the example about this will
869 the full name of the hooks in the config. In the example about this will
850 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
870 be ``$HG_HOOKTYPE=incoming`` and ``$HG_HOOKNAME=incoming.email``.
851
871
852 ``changegroup``
872 ``changegroup``
853 Run after a changegroup has been added via push, pull or unbundle. ID of the
873 Run after a changegroup has been added via push, pull or unbundle. ID of the
854 first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL
874 first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL
855 from which changes came is in ``$HG_URL``.
875 from which changes came is in ``$HG_URL``.
856
876
857 ``commit``
877 ``commit``
858 Run after a changeset has been created in the local repository. ID
878 Run after a changeset has been created in the local repository. ID
859 of the newly created changeset is in ``$HG_NODE``. Parent changeset
879 of the newly created changeset is in ``$HG_NODE``. Parent changeset
860 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
880 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
861
881
862 ``incoming``
882 ``incoming``
863 Run after a changeset has been pulled, pushed, or unbundled into
883 Run after a changeset has been pulled, pushed, or unbundled into
864 the local repository. The ID of the newly arrived changeset is in
884 the local repository. The ID of the newly arrived changeset is in
865 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
885 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
866
886
867 ``outgoing``
887 ``outgoing``
868 Run after sending changes from local repository to another. ID of
888 Run after sending changes from local repository to another. ID of
869 first changeset sent is in ``$HG_NODE``. Source of operation is in
889 first changeset sent is in ``$HG_NODE``. Source of operation is in
870 ``$HG_SOURCE``; Also see :hg:`help config.hooks.preoutgoing` hook.
890 ``$HG_SOURCE``; Also see :hg:`help config.hooks.preoutgoing` hook.
871
891
872 ``post-<command>``
892 ``post-<command>``
873 Run after successful invocations of the associated command. The
893 Run after successful invocations of the associated command. The
874 contents of the command line are passed as ``$HG_ARGS`` and the result
894 contents of the command line are passed as ``$HG_ARGS`` and the result
875 code in ``$HG_RESULT``. Parsed command line arguments are passed as
895 code in ``$HG_RESULT``. Parsed command line arguments are passed as
876 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
896 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
877 the python data internally passed to <command>. ``$HG_OPTS`` is a
897 the python data internally passed to <command>. ``$HG_OPTS`` is a
878 dictionary of options (with unspecified options set to their defaults).
898 dictionary of options (with unspecified options set to their defaults).
879 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
899 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
880
900
881 ``fail-<command>``
901 ``fail-<command>``
882 Run after a failed invocation of an associated command. The contents
902 Run after a failed invocation of an associated command. The contents
883 of the command line are passed as ``$HG_ARGS``. Parsed command line
903 of the command line are passed as ``$HG_ARGS``. Parsed command line
884 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
904 arguments are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain
885 string representations of the python data internally passed to
905 string representations of the python data internally passed to
886 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
906 <command>. ``$HG_OPTS`` is a dictionary of options (with unspecified
887 options set to their defaults). ``$HG_PATS`` is a list of arguments.
907 options set to their defaults). ``$HG_PATS`` is a list of arguments.
888 Hook failure is ignored.
908 Hook failure is ignored.
889
909
890 ``pre-<command>``
910 ``pre-<command>``
891 Run before executing the associated command. The contents of the
911 Run before executing the associated command. The contents of the
892 command line are passed as ``$HG_ARGS``. Parsed command line arguments
912 command line are passed as ``$HG_ARGS``. Parsed command line arguments
893 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
913 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
894 representations of the data internally passed to <command>. ``$HG_OPTS``
914 representations of the data internally passed to <command>. ``$HG_OPTS``
895 is a dictionary of options (with unspecified options set to their
915 is a dictionary of options (with unspecified options set to their
896 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
916 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
897 failure, the command doesn't execute and Mercurial returns the failure
917 failure, the command doesn't execute and Mercurial returns the failure
898 code.
918 code.
899
919
900 ``prechangegroup``
920 ``prechangegroup``
901 Run before a changegroup is added via push, pull or unbundle. Exit
921 Run before a changegroup is added via push, pull or unbundle. Exit
902 status 0 allows the changegroup to proceed. Non-zero status will
922 status 0 allows the changegroup to proceed. Non-zero status will
903 cause the push, pull or unbundle to fail. URL from which changes
923 cause the push, pull or unbundle to fail. URL from which changes
904 will come is in ``$HG_URL``.
924 will come is in ``$HG_URL``.
905
925
906 ``precommit``
926 ``precommit``
907 Run before starting a local commit. Exit status 0 allows the
927 Run before starting a local commit. Exit status 0 allows the
908 commit to proceed. Non-zero status will cause the commit to fail.
928 commit to proceed. Non-zero status will cause the commit to fail.
909 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
929 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
910
930
911 ``prelistkeys``
931 ``prelistkeys``
912 Run before listing pushkeys (like bookmarks) in the
932 Run before listing pushkeys (like bookmarks) in the
913 repository. Non-zero status will cause failure. The key namespace is
933 repository. Non-zero status will cause failure. The key namespace is
914 in ``$HG_NAMESPACE``.
934 in ``$HG_NAMESPACE``.
915
935
916 ``preoutgoing``
936 ``preoutgoing``
917 Run before collecting changes to send from the local repository to
937 Run before collecting changes to send from the local repository to
918 another. Non-zero status will cause failure. This lets you prevent
938 another. Non-zero status will cause failure. This lets you prevent
919 pull over HTTP or SSH. Also prevents against local pull, push
939 pull over HTTP or SSH. Also prevents against local pull, push
920 (outbound) or bundle commands, but not effective, since you can
940 (outbound) or bundle commands, but not effective, since you can
921 just copy files instead then. Source of operation is in
941 just copy files instead then. Source of operation is in
922 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
942 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
923 SSH or HTTP repository. If "push", "pull" or "bundle", operation
943 SSH or HTTP repository. If "push", "pull" or "bundle", operation
924 is happening on behalf of repository on same system.
944 is happening on behalf of repository on same system.
925
945
926 ``prepushkey``
946 ``prepushkey``
927 Run before a pushkey (like a bookmark) is added to the
947 Run before a pushkey (like a bookmark) is added to the
928 repository. Non-zero status will cause the key to be rejected. The
948 repository. Non-zero status will cause the key to be rejected. The
929 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
949 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
930 the old value (if any) is in ``$HG_OLD``, and the new value is in
950 the old value (if any) is in ``$HG_OLD``, and the new value is in
931 ``$HG_NEW``.
951 ``$HG_NEW``.
932
952
933 ``pretag``
953 ``pretag``
934 Run before creating a tag. Exit status 0 allows the tag to be
954 Run before creating a tag. Exit status 0 allows the tag to be
935 created. Non-zero status will cause the tag to fail. ID of
955 created. Non-zero status will cause the tag to fail. ID of
936 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
956 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
937 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
957 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
938
958
939 ``pretxnopen``
959 ``pretxnopen``
940 Run before any new repository transaction is open. The reason for the
960 Run before any new repository transaction is open. The reason for the
941 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
961 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
942 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
962 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
943 transaction from being opened.
963 transaction from being opened.
944
964
945 ``pretxnclose``
965 ``pretxnclose``
946 Run right before the transaction is actually finalized. Any repository change
966 Run right before the transaction is actually finalized. Any repository change
947 will be visible to the hook program. This lets you validate the transaction
967 will be visible to the hook program. This lets you validate the transaction
948 content or change it. Exit status 0 allows the commit to proceed. Non-zero
968 content or change it. Exit status 0 allows the commit to proceed. Non-zero
949 status will cause the transaction to be rolled back. The reason for the
969 status will cause the transaction to be rolled back. The reason for the
950 transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for
970 transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for
951 the transaction will be in ``HG_TXNID``. The rest of the available data will
971 the transaction will be in ``HG_TXNID``. The rest of the available data will
952 vary according the transaction type. New changesets will add ``$HG_NODE`` (id
972 vary according the transaction type. New changesets will add ``$HG_NODE`` (id
953 of the first added changeset), ``$HG_NODE_LAST`` (id of the last added
973 of the first added changeset), ``$HG_NODE_LAST`` (id of the last added
954 changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases
974 changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases
955 changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
975 changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
956
976
957 ``txnclose``
977 ``txnclose``
958 Run after any repository transaction has been committed. At this
978 Run after any repository transaction has been committed. At this
959 point, the transaction can no longer be rolled back. The hook will run
979 point, the transaction can no longer be rolled back. The hook will run
960 after the lock is released. See :hg:`help config.hooks.pretxnclose` docs for
980 after the lock is released. See :hg:`help config.hooks.pretxnclose` docs for
961 details about available variables.
981 details about available variables.
962
982
963 ``txnabort``
983 ``txnabort``
964 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
984 Run when a transaction is aborted. See :hg:`help config.hooks.pretxnclose`
965 docs for details about available variables.
985 docs for details about available variables.
966
986
967 ``pretxnchangegroup``
987 ``pretxnchangegroup``
968 Run after a changegroup has been added via push, pull or unbundle, but before
988 Run after a changegroup has been added via push, pull or unbundle, but before
969 the transaction has been committed. Changegroup is visible to hook program.
989 the transaction has been committed. Changegroup is visible to hook program.
970 This lets you validate incoming changes before accepting them. Passed the ID
990 This lets you validate incoming changes before accepting them. Passed the ID
971 of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``.
991 of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``.
972 Exit status 0 allows the transaction to commit. Non-zero status will cause
992 Exit status 0 allows the transaction to commit. Non-zero status will cause
973 the transaction to be rolled back and the push, pull or unbundle will fail.
993 the transaction to be rolled back and the push, pull or unbundle will fail.
974 URL that was source of changes is in ``$HG_URL``.
994 URL that was source of changes is in ``$HG_URL``.
975
995
976 ``pretxncommit``
996 ``pretxncommit``
977 Run after a changeset has been created but the transaction not yet
997 Run after a changeset has been created but the transaction not yet
978 committed. Changeset is visible to hook program. This lets you
998 committed. Changeset is visible to hook program. This lets you
979 validate commit message and changes. Exit status 0 allows the
999 validate commit message and changes. Exit status 0 allows the
980 commit to proceed. Non-zero status will cause the transaction to
1000 commit to proceed. Non-zero status will cause the transaction to
981 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
1001 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
982 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
1002 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
983
1003
984 ``preupdate``
1004 ``preupdate``
985 Run before updating the working directory. Exit status 0 allows
1005 Run before updating the working directory. Exit status 0 allows
986 the update to proceed. Non-zero status will prevent the update.
1006 the update to proceed. Non-zero status will prevent the update.
987 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
1007 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
988 of second new parent is in ``$HG_PARENT2``.
1008 of second new parent is in ``$HG_PARENT2``.
989
1009
990 ``listkeys``
1010 ``listkeys``
991 Run after listing pushkeys (like bookmarks) in the repository. The
1011 Run after listing pushkeys (like bookmarks) in the repository. The
992 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
1012 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
993 dictionary containing the keys and values.
1013 dictionary containing the keys and values.
994
1014
995 ``pushkey``
1015 ``pushkey``
996 Run after a pushkey (like a bookmark) is added to the
1016 Run after a pushkey (like a bookmark) is added to the
997 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
1017 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
998 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
1018 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
999 value is in ``$HG_NEW``.
1019 value is in ``$HG_NEW``.
1000
1020
1001 ``tag``
1021 ``tag``
1002 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
1022 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
1003 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
1023 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
1004 repository if ``$HG_LOCAL=0``.
1024 repository if ``$HG_LOCAL=0``.
1005
1025
1006 ``update``
1026 ``update``
1007 Run after updating the working directory. Changeset ID of first
1027 Run after updating the working directory. Changeset ID of first
1008 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
1028 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
1009 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1029 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
1010 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
1030 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
1011
1031
1012 .. note::
1032 .. note::
1013
1033
1014 It is generally better to use standard hooks rather than the
1034 It is generally better to use standard hooks rather than the
1015 generic pre- and post- command hooks as they are guaranteed to be
1035 generic pre- and post- command hooks as they are guaranteed to be
1016 called in the appropriate contexts for influencing transactions.
1036 called in the appropriate contexts for influencing transactions.
1017 Also, hooks like "commit" will be called in all contexts that
1037 Also, hooks like "commit" will be called in all contexts that
1018 generate a commit (e.g. tag) and not just the commit command.
1038 generate a commit (e.g. tag) and not just the commit command.
1019
1039
1020 .. note::
1040 .. note::
1021
1041
1022 Environment variables with empty values may not be passed to
1042 Environment variables with empty values may not be passed to
1023 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1043 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
1024 will have an empty value under Unix-like platforms for non-merge
1044 will have an empty value under Unix-like platforms for non-merge
1025 changesets, while it will not be available at all under Windows.
1045 changesets, while it will not be available at all under Windows.
1026
1046
1027 The syntax for Python hooks is as follows::
1047 The syntax for Python hooks is as follows::
1028
1048
1029 hookname = python:modulename.submodule.callable
1049 hookname = python:modulename.submodule.callable
1030 hookname = python:/path/to/python/module.py:callable
1050 hookname = python:/path/to/python/module.py:callable
1031
1051
1032 Python hooks are run within the Mercurial process. Each hook is
1052 Python hooks are run within the Mercurial process. Each hook is
1033 called with at least three keyword arguments: a ui object (keyword
1053 called with at least three keyword arguments: a ui object (keyword
1034 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1054 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
1035 keyword that tells what kind of hook is used. Arguments listed as
1055 keyword that tells what kind of hook is used. Arguments listed as
1036 environment variables above are passed as keyword arguments, with no
1056 environment variables above are passed as keyword arguments, with no
1037 ``HG_`` prefix, and names in lower case.
1057 ``HG_`` prefix, and names in lower case.
1038
1058
1039 If a Python hook returns a "true" value or raises an exception, this
1059 If a Python hook returns a "true" value or raises an exception, this
1040 is treated as a failure.
1060 is treated as a failure.
1041
1061
1042
1062
1043 ``hostfingerprints``
1063 ``hostfingerprints``
1044 --------------------
1064 --------------------
1045
1065
1046 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1066 (Deprecated. Use ``[hostsecurity]``'s ``fingerprints`` options instead.)
1047
1067
1048 Fingerprints of the certificates of known HTTPS servers.
1068 Fingerprints of the certificates of known HTTPS servers.
1049
1069
1050 A HTTPS connection to a server with a fingerprint configured here will
1070 A HTTPS connection to a server with a fingerprint configured here will
1051 only succeed if the servers certificate matches the fingerprint.
1071 only succeed if the servers certificate matches the fingerprint.
1052 This is very similar to how ssh known hosts works.
1072 This is very similar to how ssh known hosts works.
1053
1073
1054 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1074 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
1055 Multiple values can be specified (separated by spaces or commas). This can
1075 Multiple values can be specified (separated by spaces or commas). This can
1056 be used to define both old and new fingerprints while a host transitions
1076 be used to define both old and new fingerprints while a host transitions
1057 to a new certificate.
1077 to a new certificate.
1058
1078
1059 The CA chain and web.cacerts is not used for servers with a fingerprint.
1079 The CA chain and web.cacerts is not used for servers with a fingerprint.
1060
1080
1061 For example::
1081 For example::
1062
1082
1063 [hostfingerprints]
1083 [hostfingerprints]
1064 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1084 hg.intevation.de = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1065 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1085 hg.intevation.org = fc:e2:8d:d9:51:cd:cb:c1:4d:18:6b:b7:44:8d:49:72:57:e6:cd:33
1066
1086
1067 ``hostsecurity``
1087 ``hostsecurity``
1068 ----------------
1088 ----------------
1069
1089
1070 Used to specify global and per-host security settings for connecting to
1090 Used to specify global and per-host security settings for connecting to
1071 other machines.
1091 other machines.
1072
1092
1073 The following options control default behavior for all hosts.
1093 The following options control default behavior for all hosts.
1074
1094
1075 ``ciphers``
1095 ``ciphers``
1076 Defines the cryptographic ciphers to use for connections.
1096 Defines the cryptographic ciphers to use for connections.
1077
1097
1078 Value must be a valid OpenSSL Cipher List Format as documented at
1098 Value must be a valid OpenSSL Cipher List Format as documented at
1079 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1099 https://www.openssl.org/docs/manmaster/apps/ciphers.html#CIPHER-LIST-FORMAT.
1080
1100
1081 This setting is for advanced users only. Setting to incorrect values
1101 This setting is for advanced users only. Setting to incorrect values
1082 can significantly lower connection security or decrease performance.
1102 can significantly lower connection security or decrease performance.
1083 You have been warned.
1103 You have been warned.
1084
1104
1085 This option requires Python 2.7.
1105 This option requires Python 2.7.
1086
1106
1087 ``minimumprotocol``
1107 ``minimumprotocol``
1088 Defines the minimum channel encryption protocol to use.
1108 Defines the minimum channel encryption protocol to use.
1089
1109
1090 By default, the highest version of TLS supported by both client and server
1110 By default, the highest version of TLS supported by both client and server
1091 is used.
1111 is used.
1092
1112
1093 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1113 Allowed values are: ``tls1.0``, ``tls1.1``, ``tls1.2``.
1094
1114
1095 When running on an old Python version, only ``tls1.0`` is allowed since
1115 When running on an old Python version, only ``tls1.0`` is allowed since
1096 old versions of Python only support up to TLS 1.0.
1116 old versions of Python only support up to TLS 1.0.
1097
1117
1098 When running a Python that supports modern TLS versions, the default is
1118 When running a Python that supports modern TLS versions, the default is
1099 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1119 ``tls1.1``. ``tls1.0`` can still be used to allow TLS 1.0. However, this
1100 weakens security and should only be used as a feature of last resort if
1120 weakens security and should only be used as a feature of last resort if
1101 a server does not support TLS 1.1+.
1121 a server does not support TLS 1.1+.
1102
1122
1103 Options in the ``[hostsecurity]`` section can have the form
1123 Options in the ``[hostsecurity]`` section can have the form
1104 ``hostname``:``setting``. This allows multiple settings to be defined on a
1124 ``hostname``:``setting``. This allows multiple settings to be defined on a
1105 per-host basis.
1125 per-host basis.
1106
1126
1107 The following per-host settings can be defined.
1127 The following per-host settings can be defined.
1108
1128
1109 ``ciphers``
1129 ``ciphers``
1110 This behaves like ``ciphers`` as described above except it only applies
1130 This behaves like ``ciphers`` as described above except it only applies
1111 to the host on which it is defined.
1131 to the host on which it is defined.
1112
1132
1113 ``fingerprints``
1133 ``fingerprints``
1114 A list of hashes of the DER encoded peer/remote certificate. Values have
1134 A list of hashes of the DER encoded peer/remote certificate. Values have
1115 the form ``algorithm``:``fingerprint``. e.g.
1135 the form ``algorithm``:``fingerprint``. e.g.
1116 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1136 ``sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2``.
1117
1137
1118 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1138 The following algorithms/prefixes are supported: ``sha1``, ``sha256``,
1119 ``sha512``.
1139 ``sha512``.
1120
1140
1121 Use of ``sha256`` or ``sha512`` is preferred.
1141 Use of ``sha256`` or ``sha512`` is preferred.
1122
1142
1123 If a fingerprint is specified, the CA chain is not validated for this
1143 If a fingerprint is specified, the CA chain is not validated for this
1124 host and Mercurial will require the remote certificate to match one
1144 host and Mercurial will require the remote certificate to match one
1125 of the fingerprints specified. This means if the server updates its
1145 of the fingerprints specified. This means if the server updates its
1126 certificate, Mercurial will abort until a new fingerprint is defined.
1146 certificate, Mercurial will abort until a new fingerprint is defined.
1127 This can provide stronger security than traditional CA-based validation
1147 This can provide stronger security than traditional CA-based validation
1128 at the expense of convenience.
1148 at the expense of convenience.
1129
1149
1130 This option takes precedence over ``verifycertsfile``.
1150 This option takes precedence over ``verifycertsfile``.
1131
1151
1132 ``minimumprotocol``
1152 ``minimumprotocol``
1133 This behaves like ``minimumprotocol`` as described above except it
1153 This behaves like ``minimumprotocol`` as described above except it
1134 only applies to the host on which it is defined.
1154 only applies to the host on which it is defined.
1135
1155
1136 ``verifycertsfile``
1156 ``verifycertsfile``
1137 Path to file a containing a list of PEM encoded certificates used to
1157 Path to file a containing a list of PEM encoded certificates used to
1138 verify the server certificate. Environment variables and ``~user``
1158 verify the server certificate. Environment variables and ``~user``
1139 constructs are expanded in the filename.
1159 constructs are expanded in the filename.
1140
1160
1141 The server certificate or the certificate's certificate authority (CA)
1161 The server certificate or the certificate's certificate authority (CA)
1142 must match a certificate from this file or certificate verification
1162 must match a certificate from this file or certificate verification
1143 will fail and connections to the server will be refused.
1163 will fail and connections to the server will be refused.
1144
1164
1145 If defined, only certificates provided by this file will be used:
1165 If defined, only certificates provided by this file will be used:
1146 ``web.cacerts`` and any system/default certificates will not be
1166 ``web.cacerts`` and any system/default certificates will not be
1147 used.
1167 used.
1148
1168
1149 This option has no effect if the per-host ``fingerprints`` option
1169 This option has no effect if the per-host ``fingerprints`` option
1150 is set.
1170 is set.
1151
1171
1152 The format of the file is as follows::
1172 The format of the file is as follows::
1153
1173
1154 -----BEGIN CERTIFICATE-----
1174 -----BEGIN CERTIFICATE-----
1155 ... (certificate in base64 PEM encoding) ...
1175 ... (certificate in base64 PEM encoding) ...
1156 -----END CERTIFICATE-----
1176 -----END CERTIFICATE-----
1157 -----BEGIN CERTIFICATE-----
1177 -----BEGIN CERTIFICATE-----
1158 ... (certificate in base64 PEM encoding) ...
1178 ... (certificate in base64 PEM encoding) ...
1159 -----END CERTIFICATE-----
1179 -----END CERTIFICATE-----
1160
1180
1161 For example::
1181 For example::
1162
1182
1163 [hostsecurity]
1183 [hostsecurity]
1164 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1184 hg.example.com:fingerprints = sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2
1165 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
1185 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
1166 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1186 foo.example.com:verifycertsfile = /etc/ssl/trusted-ca-certs.pem
1167
1187
1168 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1188 To change the default minimum protocol version to TLS 1.2 but to allow TLS 1.1
1169 when connecting to ``hg.example.com``::
1189 when connecting to ``hg.example.com``::
1170
1190
1171 [hostsecurity]
1191 [hostsecurity]
1172 minimumprotocol = tls1.2
1192 minimumprotocol = tls1.2
1173 hg.example.com:minimumprotocol = tls1.1
1193 hg.example.com:minimumprotocol = tls1.1
1174
1194
1175 ``http_proxy``
1195 ``http_proxy``
1176 --------------
1196 --------------
1177
1197
1178 Used to access web-based Mercurial repositories through a HTTP
1198 Used to access web-based Mercurial repositories through a HTTP
1179 proxy.
1199 proxy.
1180
1200
1181 ``host``
1201 ``host``
1182 Host name and (optional) port of the proxy server, for example
1202 Host name and (optional) port of the proxy server, for example
1183 "myproxy:8000".
1203 "myproxy:8000".
1184
1204
1185 ``no``
1205 ``no``
1186 Optional. Comma-separated list of host names that should bypass
1206 Optional. Comma-separated list of host names that should bypass
1187 the proxy.
1207 the proxy.
1188
1208
1189 ``passwd``
1209 ``passwd``
1190 Optional. Password to authenticate with at the proxy server.
1210 Optional. Password to authenticate with at the proxy server.
1191
1211
1192 ``user``
1212 ``user``
1193 Optional. User name to authenticate with at the proxy server.
1213 Optional. User name to authenticate with at the proxy server.
1194
1214
1195 ``always``
1215 ``always``
1196 Optional. Always use the proxy, even for localhost and any entries
1216 Optional. Always use the proxy, even for localhost and any entries
1197 in ``http_proxy.no``. (default: False)
1217 in ``http_proxy.no``. (default: False)
1198
1218
1199 ``merge``
1219 ``merge``
1200 ---------
1220 ---------
1201
1221
1202 This section specifies behavior during merges and updates.
1222 This section specifies behavior during merges and updates.
1203
1223
1204 ``checkignored``
1224 ``checkignored``
1205 Controls behavior when an ignored file on disk has the same name as a tracked
1225 Controls behavior when an ignored file on disk has the same name as a tracked
1206 file in the changeset being merged or updated to, and has different
1226 file in the changeset being merged or updated to, and has different
1207 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1227 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
1208 abort on such files. With ``warn``, warn on such files and back them up as
1228 abort on such files. With ``warn``, warn on such files and back them up as
1209 ``.orig``. With ``ignore``, don't print a warning and back them up as
1229 ``.orig``. With ``ignore``, don't print a warning and back them up as
1210 ``.orig``. (default: ``abort``)
1230 ``.orig``. (default: ``abort``)
1211
1231
1212 ``checkunknown``
1232 ``checkunknown``
1213 Controls behavior when an unknown file that isn't ignored has the same name
1233 Controls behavior when an unknown file that isn't ignored has the same name
1214 as a tracked file in the changeset being merged or updated to, and has
1234 as a tracked file in the changeset being merged or updated to, and has
1215 different contents. Similar to ``merge.checkignored``, except for files that
1235 different contents. Similar to ``merge.checkignored``, except for files that
1216 are not ignored. (default: ``abort``)
1236 are not ignored. (default: ``abort``)
1217
1237
1218 ``merge-patterns``
1238 ``merge-patterns``
1219 ------------------
1239 ------------------
1220
1240
1221 This section specifies merge tools to associate with particular file
1241 This section specifies merge tools to associate with particular file
1222 patterns. Tools matched here will take precedence over the default
1242 patterns. Tools matched here will take precedence over the default
1223 merge tool. Patterns are globs by default, rooted at the repository
1243 merge tool. Patterns are globs by default, rooted at the repository
1224 root.
1244 root.
1225
1245
1226 Example::
1246 Example::
1227
1247
1228 [merge-patterns]
1248 [merge-patterns]
1229 **.c = kdiff3
1249 **.c = kdiff3
1230 **.jpg = myimgmerge
1250 **.jpg = myimgmerge
1231
1251
1232 ``merge-tools``
1252 ``merge-tools``
1233 ---------------
1253 ---------------
1234
1254
1235 This section configures external merge tools to use for file-level
1255 This section configures external merge tools to use for file-level
1236 merges. This section has likely been preconfigured at install time.
1256 merges. This section has likely been preconfigured at install time.
1237 Use :hg:`config merge-tools` to check the existing configuration.
1257 Use :hg:`config merge-tools` to check the existing configuration.
1238 Also see :hg:`help merge-tools` for more details.
1258 Also see :hg:`help merge-tools` for more details.
1239
1259
1240 Example ``~/.hgrc``::
1260 Example ``~/.hgrc``::
1241
1261
1242 [merge-tools]
1262 [merge-tools]
1243 # Override stock tool location
1263 # Override stock tool location
1244 kdiff3.executable = ~/bin/kdiff3
1264 kdiff3.executable = ~/bin/kdiff3
1245 # Specify command line
1265 # Specify command line
1246 kdiff3.args = $base $local $other -o $output
1266 kdiff3.args = $base $local $other -o $output
1247 # Give higher priority
1267 # Give higher priority
1248 kdiff3.priority = 1
1268 kdiff3.priority = 1
1249
1269
1250 # Changing the priority of preconfigured tool
1270 # Changing the priority of preconfigured tool
1251 meld.priority = 0
1271 meld.priority = 0
1252
1272
1253 # Disable a preconfigured tool
1273 # Disable a preconfigured tool
1254 vimdiff.disabled = yes
1274 vimdiff.disabled = yes
1255
1275
1256 # Define new tool
1276 # Define new tool
1257 myHtmlTool.args = -m $local $other $base $output
1277 myHtmlTool.args = -m $local $other $base $output
1258 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1278 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1259 myHtmlTool.priority = 1
1279 myHtmlTool.priority = 1
1260
1280
1261 Supported arguments:
1281 Supported arguments:
1262
1282
1263 ``priority``
1283 ``priority``
1264 The priority in which to evaluate this tool.
1284 The priority in which to evaluate this tool.
1265 (default: 0)
1285 (default: 0)
1266
1286
1267 ``executable``
1287 ``executable``
1268 Either just the name of the executable or its pathname.
1288 Either just the name of the executable or its pathname.
1269
1289
1270 .. container:: windows
1290 .. container:: windows
1271
1291
1272 On Windows, the path can use environment variables with ${ProgramFiles}
1292 On Windows, the path can use environment variables with ${ProgramFiles}
1273 syntax.
1293 syntax.
1274
1294
1275 (default: the tool name)
1295 (default: the tool name)
1276
1296
1277 ``args``
1297 ``args``
1278 The arguments to pass to the tool executable. You can refer to the
1298 The arguments to pass to the tool executable. You can refer to the
1279 files being merged as well as the output file through these
1299 files being merged as well as the output file through these
1280 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1300 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1281 of ``$local`` and ``$other`` can vary depending on which action is being
1301 of ``$local`` and ``$other`` can vary depending on which action is being
1282 performed. During and update or merge, ``$local`` represents the original
1302 performed. During and update or merge, ``$local`` represents the original
1283 state of the file, while ``$other`` represents the commit you are updating
1303 state of the file, while ``$other`` represents the commit you are updating
1284 to or the commit you are merging with. During a rebase ``$local``
1304 to or the commit you are merging with. During a rebase ``$local``
1285 represents the destination of the rebase, and ``$other`` represents the
1305 represents the destination of the rebase, and ``$other`` represents the
1286 commit being rebased.
1306 commit being rebased.
1287 (default: ``$local $base $other``)
1307 (default: ``$local $base $other``)
1288
1308
1289 ``premerge``
1309 ``premerge``
1290 Attempt to run internal non-interactive 3-way merge tool before
1310 Attempt to run internal non-interactive 3-way merge tool before
1291 launching external tool. Options are ``true``, ``false``, ``keep`` or
1311 launching external tool. Options are ``true``, ``false``, ``keep`` or
1292 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1312 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1293 premerge fails. The ``keep-merge3`` will do the same but include information
1313 premerge fails. The ``keep-merge3`` will do the same but include information
1294 about the base of the merge in the marker (see internal :merge3 in
1314 about the base of the merge in the marker (see internal :merge3 in
1295 :hg:`help merge-tools`).
1315 :hg:`help merge-tools`).
1296 (default: True)
1316 (default: True)
1297
1317
1298 ``binary``
1318 ``binary``
1299 This tool can merge binary files. (default: False, unless tool
1319 This tool can merge binary files. (default: False, unless tool
1300 was selected by file pattern match)
1320 was selected by file pattern match)
1301
1321
1302 ``symlink``
1322 ``symlink``
1303 This tool can merge symlinks. (default: False)
1323 This tool can merge symlinks. (default: False)
1304
1324
1305 ``check``
1325 ``check``
1306 A list of merge success-checking options:
1326 A list of merge success-checking options:
1307
1327
1308 ``changed``
1328 ``changed``
1309 Ask whether merge was successful when the merged file shows no changes.
1329 Ask whether merge was successful when the merged file shows no changes.
1310 ``conflicts``
1330 ``conflicts``
1311 Check whether there are conflicts even though the tool reported success.
1331 Check whether there are conflicts even though the tool reported success.
1312 ``prompt``
1332 ``prompt``
1313 Always prompt for merge success, regardless of success reported by tool.
1333 Always prompt for merge success, regardless of success reported by tool.
1314
1334
1315 ``fixeol``
1335 ``fixeol``
1316 Attempt to fix up EOL changes caused by the merge tool.
1336 Attempt to fix up EOL changes caused by the merge tool.
1317 (default: False)
1337 (default: False)
1318
1338
1319 ``gui``
1339 ``gui``
1320 This tool requires a graphical interface to run. (default: False)
1340 This tool requires a graphical interface to run. (default: False)
1321
1341
1322 .. container:: windows
1342 .. container:: windows
1323
1343
1324 ``regkey``
1344 ``regkey``
1325 Windows registry key which describes install location of this
1345 Windows registry key which describes install location of this
1326 tool. Mercurial will search for this key first under
1346 tool. Mercurial will search for this key first under
1327 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1347 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1328 (default: None)
1348 (default: None)
1329
1349
1330 ``regkeyalt``
1350 ``regkeyalt``
1331 An alternate Windows registry key to try if the first key is not
1351 An alternate Windows registry key to try if the first key is not
1332 found. The alternate key uses the same ``regname`` and ``regappend``
1352 found. The alternate key uses the same ``regname`` and ``regappend``
1333 semantics of the primary key. The most common use for this key
1353 semantics of the primary key. The most common use for this key
1334 is to search for 32bit applications on 64bit operating systems.
1354 is to search for 32bit applications on 64bit operating systems.
1335 (default: None)
1355 (default: None)
1336
1356
1337 ``regname``
1357 ``regname``
1338 Name of value to read from specified registry key.
1358 Name of value to read from specified registry key.
1339 (default: the unnamed (default) value)
1359 (default: the unnamed (default) value)
1340
1360
1341 ``regappend``
1361 ``regappend``
1342 String to append to the value read from the registry, typically
1362 String to append to the value read from the registry, typically
1343 the executable name of the tool.
1363 the executable name of the tool.
1344 (default: None)
1364 (default: None)
1345
1365
1346
1366
1347 ``patch``
1367 ``patch``
1348 ---------
1368 ---------
1349
1369
1350 Settings used when applying patches, for instance through the 'import'
1370 Settings used when applying patches, for instance through the 'import'
1351 command or with Mercurial Queues extension.
1371 command or with Mercurial Queues extension.
1352
1372
1353 ``eol``
1373 ``eol``
1354 When set to 'strict' patch content and patched files end of lines
1374 When set to 'strict' patch content and patched files end of lines
1355 are preserved. When set to ``lf`` or ``crlf``, both files end of
1375 are preserved. When set to ``lf`` or ``crlf``, both files end of
1356 lines are ignored when patching and the result line endings are
1376 lines are ignored when patching and the result line endings are
1357 normalized to either LF (Unix) or CRLF (Windows). When set to
1377 normalized to either LF (Unix) or CRLF (Windows). When set to
1358 ``auto``, end of lines are again ignored while patching but line
1378 ``auto``, end of lines are again ignored while patching but line
1359 endings in patched files are normalized to their original setting
1379 endings in patched files are normalized to their original setting
1360 on a per-file basis. If target file does not exist or has no end
1380 on a per-file basis. If target file does not exist or has no end
1361 of line, patch line endings are preserved.
1381 of line, patch line endings are preserved.
1362 (default: strict)
1382 (default: strict)
1363
1383
1364 ``fuzz``
1384 ``fuzz``
1365 The number of lines of 'fuzz' to allow when applying patches. This
1385 The number of lines of 'fuzz' to allow when applying patches. This
1366 controls how much context the patcher is allowed to ignore when
1386 controls how much context the patcher is allowed to ignore when
1367 trying to apply a patch.
1387 trying to apply a patch.
1368 (default: 2)
1388 (default: 2)
1369
1389
1370 ``paths``
1390 ``paths``
1371 ---------
1391 ---------
1372
1392
1373 Assigns symbolic names and behavior to repositories.
1393 Assigns symbolic names and behavior to repositories.
1374
1394
1375 Options are symbolic names defining the URL or directory that is the
1395 Options are symbolic names defining the URL or directory that is the
1376 location of the repository. Example::
1396 location of the repository. Example::
1377
1397
1378 [paths]
1398 [paths]
1379 my_server = https://example.com/my_repo
1399 my_server = https://example.com/my_repo
1380 local_path = /home/me/repo
1400 local_path = /home/me/repo
1381
1401
1382 These symbolic names can be used from the command line. To pull
1402 These symbolic names can be used from the command line. To pull
1383 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1403 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1384 :hg:`push local_path`.
1404 :hg:`push local_path`.
1385
1405
1386 Options containing colons (``:``) denote sub-options that can influence
1406 Options containing colons (``:``) denote sub-options that can influence
1387 behavior for that specific path. Example::
1407 behavior for that specific path. Example::
1388
1408
1389 [paths]
1409 [paths]
1390 my_server = https://example.com/my_path
1410 my_server = https://example.com/my_path
1391 my_server:pushurl = ssh://example.com/my_path
1411 my_server:pushurl = ssh://example.com/my_path
1392
1412
1393 The following sub-options can be defined:
1413 The following sub-options can be defined:
1394
1414
1395 ``pushurl``
1415 ``pushurl``
1396 The URL to use for push operations. If not defined, the location
1416 The URL to use for push operations. If not defined, the location
1397 defined by the path's main entry is used.
1417 defined by the path's main entry is used.
1398
1418
1399 ``pushrev``
1419 ``pushrev``
1400 A revset defining which revisions to push by default.
1420 A revset defining which revisions to push by default.
1401
1421
1402 When :hg:`push` is executed without a ``-r`` argument, the revset
1422 When :hg:`push` is executed without a ``-r`` argument, the revset
1403 defined by this sub-option is evaluated to determine what to push.
1423 defined by this sub-option is evaluated to determine what to push.
1404
1424
1405 For example, a value of ``.`` will push the working directory's
1425 For example, a value of ``.`` will push the working directory's
1406 revision by default.
1426 revision by default.
1407
1427
1408 Revsets specifying bookmarks will not result in the bookmark being
1428 Revsets specifying bookmarks will not result in the bookmark being
1409 pushed.
1429 pushed.
1410
1430
1411 The following special named paths exist:
1431 The following special named paths exist:
1412
1432
1413 ``default``
1433 ``default``
1414 The URL or directory to use when no source or remote is specified.
1434 The URL or directory to use when no source or remote is specified.
1415
1435
1416 :hg:`clone` will automatically define this path to the location the
1436 :hg:`clone` will automatically define this path to the location the
1417 repository was cloned from.
1437 repository was cloned from.
1418
1438
1419 ``default-push``
1439 ``default-push``
1420 (deprecated) The URL or directory for the default :hg:`push` location.
1440 (deprecated) The URL or directory for the default :hg:`push` location.
1421 ``default:pushurl`` should be used instead.
1441 ``default:pushurl`` should be used instead.
1422
1442
1423 ``phases``
1443 ``phases``
1424 ----------
1444 ----------
1425
1445
1426 Specifies default handling of phases. See :hg:`help phases` for more
1446 Specifies default handling of phases. See :hg:`help phases` for more
1427 information about working with phases.
1447 information about working with phases.
1428
1448
1429 ``publish``
1449 ``publish``
1430 Controls draft phase behavior when working as a server. When true,
1450 Controls draft phase behavior when working as a server. When true,
1431 pushed changesets are set to public in both client and server and
1451 pushed changesets are set to public in both client and server and
1432 pulled or cloned changesets are set to public in the client.
1452 pulled or cloned changesets are set to public in the client.
1433 (default: True)
1453 (default: True)
1434
1454
1435 ``new-commit``
1455 ``new-commit``
1436 Phase of newly-created commits.
1456 Phase of newly-created commits.
1437 (default: draft)
1457 (default: draft)
1438
1458
1439 ``checksubrepos``
1459 ``checksubrepos``
1440 Check the phase of the current revision of each subrepository. Allowed
1460 Check the phase of the current revision of each subrepository. Allowed
1441 values are "ignore", "follow" and "abort". For settings other than
1461 values are "ignore", "follow" and "abort". For settings other than
1442 "ignore", the phase of the current revision of each subrepository is
1462 "ignore", the phase of the current revision of each subrepository is
1443 checked before committing the parent repository. If any of those phases is
1463 checked before committing the parent repository. If any of those phases is
1444 greater than the phase of the parent repository (e.g. if a subrepo is in a
1464 greater than the phase of the parent repository (e.g. if a subrepo is in a
1445 "secret" phase while the parent repo is in "draft" phase), the commit is
1465 "secret" phase while the parent repo is in "draft" phase), the commit is
1446 either aborted (if checksubrepos is set to "abort") or the higher phase is
1466 either aborted (if checksubrepos is set to "abort") or the higher phase is
1447 used for the parent repository commit (if set to "follow").
1467 used for the parent repository commit (if set to "follow").
1448 (default: follow)
1468 (default: follow)
1449
1469
1450
1470
1451 ``profiling``
1471 ``profiling``
1452 -------------
1472 -------------
1453
1473
1454 Specifies profiling type, format, and file output. Two profilers are
1474 Specifies profiling type, format, and file output. Two profilers are
1455 supported: an instrumenting profiler (named ``ls``), and a sampling
1475 supported: an instrumenting profiler (named ``ls``), and a sampling
1456 profiler (named ``stat``).
1476 profiler (named ``stat``).
1457
1477
1458 In this section description, 'profiling data' stands for the raw data
1478 In this section description, 'profiling data' stands for the raw data
1459 collected during profiling, while 'profiling report' stands for a
1479 collected during profiling, while 'profiling report' stands for a
1460 statistical text report generated from the profiling data. The
1480 statistical text report generated from the profiling data. The
1461 profiling is done using lsprof.
1481 profiling is done using lsprof.
1462
1482
1463 ``enabled``
1483 ``enabled``
1464 Enable the profiler.
1484 Enable the profiler.
1465 (default: false)
1485 (default: false)
1466
1486
1467 This is equivalent to passing ``--profile`` on the command line.
1487 This is equivalent to passing ``--profile`` on the command line.
1468
1488
1469 ``type``
1489 ``type``
1470 The type of profiler to use.
1490 The type of profiler to use.
1471 (default: stat)
1491 (default: stat)
1472
1492
1473 ``ls``
1493 ``ls``
1474 Use Python's built-in instrumenting profiler. This profiler
1494 Use Python's built-in instrumenting profiler. This profiler
1475 works on all platforms, but each line number it reports is the
1495 works on all platforms, but each line number it reports is the
1476 first line of a function. This restriction makes it difficult to
1496 first line of a function. This restriction makes it difficult to
1477 identify the expensive parts of a non-trivial function.
1497 identify the expensive parts of a non-trivial function.
1478 ``stat``
1498 ``stat``
1479 Use a statistical profiler, statprof. This profiler is most
1499 Use a statistical profiler, statprof. This profiler is most
1480 useful for profiling commands that run for longer than about 0.1
1500 useful for profiling commands that run for longer than about 0.1
1481 seconds.
1501 seconds.
1482
1502
1483 ``format``
1503 ``format``
1484 Profiling format. Specific to the ``ls`` instrumenting profiler.
1504 Profiling format. Specific to the ``ls`` instrumenting profiler.
1485 (default: text)
1505 (default: text)
1486
1506
1487 ``text``
1507 ``text``
1488 Generate a profiling report. When saving to a file, it should be
1508 Generate a profiling report. When saving to a file, it should be
1489 noted that only the report is saved, and the profiling data is
1509 noted that only the report is saved, and the profiling data is
1490 not kept.
1510 not kept.
1491 ``kcachegrind``
1511 ``kcachegrind``
1492 Format profiling data for kcachegrind use: when saving to a
1512 Format profiling data for kcachegrind use: when saving to a
1493 file, the generated file can directly be loaded into
1513 file, the generated file can directly be loaded into
1494 kcachegrind.
1514 kcachegrind.
1495
1515
1496 ``statformat``
1516 ``statformat``
1497 Profiling format for the ``stat`` profiler.
1517 Profiling format for the ``stat`` profiler.
1498 (default: hotpath)
1518 (default: hotpath)
1499
1519
1500 ``hotpath``
1520 ``hotpath``
1501 Show a tree-based display containing the hot path of execution (where
1521 Show a tree-based display containing the hot path of execution (where
1502 most time was spent).
1522 most time was spent).
1503 ``bymethod``
1523 ``bymethod``
1504 Show a table of methods ordered by how frequently they are active.
1524 Show a table of methods ordered by how frequently they are active.
1505 ``byline``
1525 ``byline``
1506 Show a table of lines in files ordered by how frequently they are active.
1526 Show a table of lines in files ordered by how frequently they are active.
1507 ``json``
1527 ``json``
1508 Render profiling data as JSON.
1528 Render profiling data as JSON.
1509
1529
1510 ``frequency``
1530 ``frequency``
1511 Sampling frequency. Specific to the ``stat`` sampling profiler.
1531 Sampling frequency. Specific to the ``stat`` sampling profiler.
1512 (default: 1000)
1532 (default: 1000)
1513
1533
1514 ``output``
1534 ``output``
1515 File path where profiling data or report should be saved. If the
1535 File path where profiling data or report should be saved. If the
1516 file exists, it is replaced. (default: None, data is printed on
1536 file exists, it is replaced. (default: None, data is printed on
1517 stderr)
1537 stderr)
1518
1538
1519 ``sort``
1539 ``sort``
1520 Sort field. Specific to the ``ls`` instrumenting profiler.
1540 Sort field. Specific to the ``ls`` instrumenting profiler.
1521 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1541 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1522 ``inlinetime``.
1542 ``inlinetime``.
1523 (default: inlinetime)
1543 (default: inlinetime)
1524
1544
1525 ``limit``
1545 ``limit``
1526 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1546 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1527 (default: 30)
1547 (default: 30)
1528
1548
1529 ``nested``
1549 ``nested``
1530 Show at most this number of lines of drill-down info after each main entry.
1550 Show at most this number of lines of drill-down info after each main entry.
1531 This can help explain the difference between Total and Inline.
1551 This can help explain the difference between Total and Inline.
1532 Specific to the ``ls`` instrumenting profiler.
1552 Specific to the ``ls`` instrumenting profiler.
1533 (default: 5)
1553 (default: 5)
1534
1554
1535 ``progress``
1555 ``progress``
1536 ------------
1556 ------------
1537
1557
1538 Mercurial commands can draw progress bars that are as informative as
1558 Mercurial commands can draw progress bars that are as informative as
1539 possible. Some progress bars only offer indeterminate information, while others
1559 possible. Some progress bars only offer indeterminate information, while others
1540 have a definite end point.
1560 have a definite end point.
1541
1561
1542 ``delay``
1562 ``delay``
1543 Number of seconds (float) before showing the progress bar. (default: 3)
1563 Number of seconds (float) before showing the progress bar. (default: 3)
1544
1564
1545 ``changedelay``
1565 ``changedelay``
1546 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1566 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1547 that value will be used instead. (default: 1)
1567 that value will be used instead. (default: 1)
1548
1568
1549 ``refresh``
1569 ``refresh``
1550 Time in seconds between refreshes of the progress bar. (default: 0.1)
1570 Time in seconds between refreshes of the progress bar. (default: 0.1)
1551
1571
1552 ``format``
1572 ``format``
1553 Format of the progress bar.
1573 Format of the progress bar.
1554
1574
1555 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1575 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1556 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1576 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1557 last 20 characters of the item, but this can be changed by adding either
1577 last 20 characters of the item, but this can be changed by adding either
1558 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1578 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1559 first num characters.
1579 first num characters.
1560
1580
1561 (default: topic bar number estimate)
1581 (default: topic bar number estimate)
1562
1582
1563 ``width``
1583 ``width``
1564 If set, the maximum width of the progress information (that is, min(width,
1584 If set, the maximum width of the progress information (that is, min(width,
1565 term width) will be used).
1585 term width) will be used).
1566
1586
1567 ``clear-complete``
1587 ``clear-complete``
1568 Clear the progress bar after it's done. (default: True)
1588 Clear the progress bar after it's done. (default: True)
1569
1589
1570 ``disable``
1590 ``disable``
1571 If true, don't show a progress bar.
1591 If true, don't show a progress bar.
1572
1592
1573 ``assume-tty``
1593 ``assume-tty``
1574 If true, ALWAYS show a progress bar, unless disable is given.
1594 If true, ALWAYS show a progress bar, unless disable is given.
1575
1595
1576 ``rebase``
1596 ``rebase``
1577 ----------
1597 ----------
1578
1598
1579 ``allowdivergence``
1599 ``allowdivergence``
1580 Default to False, when True allow creating divergence when performing
1600 Default to False, when True allow creating divergence when performing
1581 rebase of obsolete changesets.
1601 rebase of obsolete changesets.
1582
1602
1583 ``revsetalias``
1603 ``revsetalias``
1584 ---------------
1604 ---------------
1585
1605
1586 Alias definitions for revsets. See :hg:`help revsets` for details.
1606 Alias definitions for revsets. See :hg:`help revsets` for details.
1587
1607
1588 ``server``
1608 ``server``
1589 ----------
1609 ----------
1590
1610
1591 Controls generic server settings.
1611 Controls generic server settings.
1592
1612
1593 ``compressionengines``
1613 ``compressionengines``
1594 List of compression engines and their relative priority to advertise
1614 List of compression engines and their relative priority to advertise
1595 to clients.
1615 to clients.
1596
1616
1597 The order of compression engines determines their priority, the first
1617 The order of compression engines determines their priority, the first
1598 having the highest priority. If a compression engine is not listed
1618 having the highest priority. If a compression engine is not listed
1599 here, it won't be advertised to clients.
1619 here, it won't be advertised to clients.
1600
1620
1601 If not set (the default), built-in defaults are used. Run
1621 If not set (the default), built-in defaults are used. Run
1602 :hg:`debuginstall` to list available compression engines and their
1622 :hg:`debuginstall` to list available compression engines and their
1603 default wire protocol priority.
1623 default wire protocol priority.
1604
1624
1605 Older Mercurial clients only support zlib compression and this setting
1625 Older Mercurial clients only support zlib compression and this setting
1606 has no effect for legacy clients.
1626 has no effect for legacy clients.
1607
1627
1608 ``uncompressed``
1628 ``uncompressed``
1609 Whether to allow clients to clone a repository using the
1629 Whether to allow clients to clone a repository using the
1610 uncompressed streaming protocol. This transfers about 40% more
1630 uncompressed streaming protocol. This transfers about 40% more
1611 data than a regular clone, but uses less memory and CPU on both
1631 data than a regular clone, but uses less memory and CPU on both
1612 server and client. Over a LAN (100 Mbps or better) or a very fast
1632 server and client. Over a LAN (100 Mbps or better) or a very fast
1613 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1633 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1614 regular clone. Over most WAN connections (anything slower than
1634 regular clone. Over most WAN connections (anything slower than
1615 about 6 Mbps), uncompressed streaming is slower, because of the
1635 about 6 Mbps), uncompressed streaming is slower, because of the
1616 extra data transfer overhead. This mode will also temporarily hold
1636 extra data transfer overhead. This mode will also temporarily hold
1617 the write lock while determining what data to transfer.
1637 the write lock while determining what data to transfer.
1618 (default: True)
1638 (default: True)
1619
1639
1620 ``preferuncompressed``
1640 ``preferuncompressed``
1621 When set, clients will try to use the uncompressed streaming
1641 When set, clients will try to use the uncompressed streaming
1622 protocol. (default: False)
1642 protocol. (default: False)
1623
1643
1624 ``validate``
1644 ``validate``
1625 Whether to validate the completeness of pushed changesets by
1645 Whether to validate the completeness of pushed changesets by
1626 checking that all new file revisions specified in manifests are
1646 checking that all new file revisions specified in manifests are
1627 present. (default: False)
1647 present. (default: False)
1628
1648
1629 ``maxhttpheaderlen``
1649 ``maxhttpheaderlen``
1630 Instruct HTTP clients not to send request headers longer than this
1650 Instruct HTTP clients not to send request headers longer than this
1631 many bytes. (default: 1024)
1651 many bytes. (default: 1024)
1632
1652
1633 ``bundle1``
1653 ``bundle1``
1634 Whether to allow clients to push and pull using the legacy bundle1
1654 Whether to allow clients to push and pull using the legacy bundle1
1635 exchange format. (default: True)
1655 exchange format. (default: True)
1636
1656
1637 ``bundle1gd``
1657 ``bundle1gd``
1638 Like ``bundle1`` but only used if the repository is using the
1658 Like ``bundle1`` but only used if the repository is using the
1639 *generaldelta* storage format. (default: True)
1659 *generaldelta* storage format. (default: True)
1640
1660
1641 ``bundle1.push``
1661 ``bundle1.push``
1642 Whether to allow clients to push using the legacy bundle1 exchange
1662 Whether to allow clients to push using the legacy bundle1 exchange
1643 format. (default: True)
1663 format. (default: True)
1644
1664
1645 ``bundle1gd.push``
1665 ``bundle1gd.push``
1646 Like ``bundle1.push`` but only used if the repository is using the
1666 Like ``bundle1.push`` but only used if the repository is using the
1647 *generaldelta* storage format. (default: True)
1667 *generaldelta* storage format. (default: True)
1648
1668
1649 ``bundle1.pull``
1669 ``bundle1.pull``
1650 Whether to allow clients to pull using the legacy bundle1 exchange
1670 Whether to allow clients to pull using the legacy bundle1 exchange
1651 format. (default: True)
1671 format. (default: True)
1652
1672
1653 ``bundle1gd.pull``
1673 ``bundle1gd.pull``
1654 Like ``bundle1.pull`` but only used if the repository is using the
1674 Like ``bundle1.pull`` but only used if the repository is using the
1655 *generaldelta* storage format. (default: True)
1675 *generaldelta* storage format. (default: True)
1656
1676
1657 Large repositories using the *generaldelta* storage format should
1677 Large repositories using the *generaldelta* storage format should
1658 consider setting this option because converting *generaldelta*
1678 consider setting this option because converting *generaldelta*
1659 repositories to the exchange format required by the bundle1 data
1679 repositories to the exchange format required by the bundle1 data
1660 format can consume a lot of CPU.
1680 format can consume a lot of CPU.
1661
1681
1662 ``zliblevel``
1682 ``zliblevel``
1663 Integer between ``-1`` and ``9`` that controls the zlib compression level
1683 Integer between ``-1`` and ``9`` that controls the zlib compression level
1664 for wire protocol commands that send zlib compressed output (notably the
1684 for wire protocol commands that send zlib compressed output (notably the
1665 commands that send repository history data).
1685 commands that send repository history data).
1666
1686
1667 The default (``-1``) uses the default zlib compression level, which is
1687 The default (``-1``) uses the default zlib compression level, which is
1668 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1688 likely equivalent to ``6``. ``0`` means no compression. ``9`` means
1669 maximum compression.
1689 maximum compression.
1670
1690
1671 Setting this option allows server operators to make trade-offs between
1691 Setting this option allows server operators to make trade-offs between
1672 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1692 bandwidth and CPU used. Lowering the compression lowers CPU utilization
1673 but sends more bytes to clients.
1693 but sends more bytes to clients.
1674
1694
1675 This option only impacts the HTTP server.
1695 This option only impacts the HTTP server.
1676
1696
1677 ``zstdlevel``
1697 ``zstdlevel``
1678 Integer between ``1`` and ``22`` that controls the zstd compression level
1698 Integer between ``1`` and ``22`` that controls the zstd compression level
1679 for wire protocol commands. ``1`` is the minimal amount of compression and
1699 for wire protocol commands. ``1`` is the minimal amount of compression and
1680 ``22`` is the highest amount of compression.
1700 ``22`` is the highest amount of compression.
1681
1701
1682 The default (``3``) should be significantly faster than zlib while likely
1702 The default (``3``) should be significantly faster than zlib while likely
1683 delivering better compression ratios.
1703 delivering better compression ratios.
1684
1704
1685 This option only impacts the HTTP server.
1705 This option only impacts the HTTP server.
1686
1706
1687 See also ``server.zliblevel``.
1707 See also ``server.zliblevel``.
1688
1708
1689 ``smtp``
1709 ``smtp``
1690 --------
1710 --------
1691
1711
1692 Configuration for extensions that need to send email messages.
1712 Configuration for extensions that need to send email messages.
1693
1713
1694 ``host``
1714 ``host``
1695 Host name of mail server, e.g. "mail.example.com".
1715 Host name of mail server, e.g. "mail.example.com".
1696
1716
1697 ``port``
1717 ``port``
1698 Optional. Port to connect to on mail server. (default: 465 if
1718 Optional. Port to connect to on mail server. (default: 465 if
1699 ``tls`` is smtps; 25 otherwise)
1719 ``tls`` is smtps; 25 otherwise)
1700
1720
1701 ``tls``
1721 ``tls``
1702 Optional. Method to enable TLS when connecting to mail server: starttls,
1722 Optional. Method to enable TLS when connecting to mail server: starttls,
1703 smtps or none. (default: none)
1723 smtps or none. (default: none)
1704
1724
1705 ``username``
1725 ``username``
1706 Optional. User name for authenticating with the SMTP server.
1726 Optional. User name for authenticating with the SMTP server.
1707 (default: None)
1727 (default: None)
1708
1728
1709 ``password``
1729 ``password``
1710 Optional. Password for authenticating with the SMTP server. If not
1730 Optional. Password for authenticating with the SMTP server. If not
1711 specified, interactive sessions will prompt the user for a
1731 specified, interactive sessions will prompt the user for a
1712 password; non-interactive sessions will fail. (default: None)
1732 password; non-interactive sessions will fail. (default: None)
1713
1733
1714 ``local_hostname``
1734 ``local_hostname``
1715 Optional. The hostname that the sender can use to identify
1735 Optional. The hostname that the sender can use to identify
1716 itself to the MTA.
1736 itself to the MTA.
1717
1737
1718
1738
1719 ``subpaths``
1739 ``subpaths``
1720 ------------
1740 ------------
1721
1741
1722 Subrepository source URLs can go stale if a remote server changes name
1742 Subrepository source URLs can go stale if a remote server changes name
1723 or becomes temporarily unavailable. This section lets you define
1743 or becomes temporarily unavailable. This section lets you define
1724 rewrite rules of the form::
1744 rewrite rules of the form::
1725
1745
1726 <pattern> = <replacement>
1746 <pattern> = <replacement>
1727
1747
1728 where ``pattern`` is a regular expression matching a subrepository
1748 where ``pattern`` is a regular expression matching a subrepository
1729 source URL and ``replacement`` is the replacement string used to
1749 source URL and ``replacement`` is the replacement string used to
1730 rewrite it. Groups can be matched in ``pattern`` and referenced in
1750 rewrite it. Groups can be matched in ``pattern`` and referenced in
1731 ``replacements``. For instance::
1751 ``replacements``. For instance::
1732
1752
1733 http://server/(.*)-hg/ = http://hg.server/\1/
1753 http://server/(.*)-hg/ = http://hg.server/\1/
1734
1754
1735 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1755 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1736
1756
1737 Relative subrepository paths are first made absolute, and the
1757 Relative subrepository paths are first made absolute, and the
1738 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1758 rewrite rules are then applied on the full (absolute) path. If ``pattern``
1739 doesn't match the full path, an attempt is made to apply it on the
1759 doesn't match the full path, an attempt is made to apply it on the
1740 relative path alone. The rules are applied in definition order.
1760 relative path alone. The rules are applied in definition order.
1741
1761
1742 ``templatealias``
1762 ``templatealias``
1743 -----------------
1763 -----------------
1744
1764
1745 Alias definitions for templates. See :hg:`help templates` for details.
1765 Alias definitions for templates. See :hg:`help templates` for details.
1746
1766
1747 ``templates``
1767 ``templates``
1748 -------------
1768 -------------
1749
1769
1750 Use the ``[templates]`` section to define template strings.
1770 Use the ``[templates]`` section to define template strings.
1751 See :hg:`help templates` for details.
1771 See :hg:`help templates` for details.
1752
1772
1753 ``trusted``
1773 ``trusted``
1754 -----------
1774 -----------
1755
1775
1756 Mercurial will not use the settings in the
1776 Mercurial will not use the settings in the
1757 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1777 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1758 user or to a trusted group, as various hgrc features allow arbitrary
1778 user or to a trusted group, as various hgrc features allow arbitrary
1759 commands to be run. This issue is often encountered when configuring
1779 commands to be run. This issue is often encountered when configuring
1760 hooks or extensions for shared repositories or servers. However,
1780 hooks or extensions for shared repositories or servers. However,
1761 the web interface will use some safe settings from the ``[web]``
1781 the web interface will use some safe settings from the ``[web]``
1762 section.
1782 section.
1763
1783
1764 This section specifies what users and groups are trusted. The
1784 This section specifies what users and groups are trusted. The
1765 current user is always trusted. To trust everybody, list a user or a
1785 current user is always trusted. To trust everybody, list a user or a
1766 group with name ``*``. These settings must be placed in an
1786 group with name ``*``. These settings must be placed in an
1767 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1787 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1768 user or service running Mercurial.
1788 user or service running Mercurial.
1769
1789
1770 ``users``
1790 ``users``
1771 Comma-separated list of trusted users.
1791 Comma-separated list of trusted users.
1772
1792
1773 ``groups``
1793 ``groups``
1774 Comma-separated list of trusted groups.
1794 Comma-separated list of trusted groups.
1775
1795
1776
1796
1777 ``ui``
1797 ``ui``
1778 ------
1798 ------
1779
1799
1780 User interface controls.
1800 User interface controls.
1781
1801
1782 ``archivemeta``
1802 ``archivemeta``
1783 Whether to include the .hg_archival.txt file containing meta data
1803 Whether to include the .hg_archival.txt file containing meta data
1784 (hashes for the repository base and for tip) in archives created
1804 (hashes for the repository base and for tip) in archives created
1785 by the :hg:`archive` command or downloaded via hgweb.
1805 by the :hg:`archive` command or downloaded via hgweb.
1786 (default: True)
1806 (default: True)
1787
1807
1788 ``askusername``
1808 ``askusername``
1789 Whether to prompt for a username when committing. If True, and
1809 Whether to prompt for a username when committing. If True, and
1790 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1810 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1791 be prompted to enter a username. If no username is entered, the
1811 be prompted to enter a username. If no username is entered, the
1792 default ``USER@HOST`` is used instead.
1812 default ``USER@HOST`` is used instead.
1793 (default: False)
1813 (default: False)
1794
1814
1795 ``clonebundles``
1815 ``clonebundles``
1796 Whether the "clone bundles" feature is enabled.
1816 Whether the "clone bundles" feature is enabled.
1797
1817
1798 When enabled, :hg:`clone` may download and apply a server-advertised
1818 When enabled, :hg:`clone` may download and apply a server-advertised
1799 bundle file from a URL instead of using the normal exchange mechanism.
1819 bundle file from a URL instead of using the normal exchange mechanism.
1800
1820
1801 This can likely result in faster and more reliable clones.
1821 This can likely result in faster and more reliable clones.
1802
1822
1803 (default: True)
1823 (default: True)
1804
1824
1805 ``clonebundlefallback``
1825 ``clonebundlefallback``
1806 Whether failure to apply an advertised "clone bundle" from a server
1826 Whether failure to apply an advertised "clone bundle" from a server
1807 should result in fallback to a regular clone.
1827 should result in fallback to a regular clone.
1808
1828
1809 This is disabled by default because servers advertising "clone
1829 This is disabled by default because servers advertising "clone
1810 bundles" often do so to reduce server load. If advertised bundles
1830 bundles" often do so to reduce server load. If advertised bundles
1811 start mass failing and clients automatically fall back to a regular
1831 start mass failing and clients automatically fall back to a regular
1812 clone, this would add significant and unexpected load to the server
1832 clone, this would add significant and unexpected load to the server
1813 since the server is expecting clone operations to be offloaded to
1833 since the server is expecting clone operations to be offloaded to
1814 pre-generated bundles. Failing fast (the default behavior) ensures
1834 pre-generated bundles. Failing fast (the default behavior) ensures
1815 clients don't overwhelm the server when "clone bundle" application
1835 clients don't overwhelm the server when "clone bundle" application
1816 fails.
1836 fails.
1817
1837
1818 (default: False)
1838 (default: False)
1819
1839
1820 ``clonebundleprefers``
1840 ``clonebundleprefers``
1821 Defines preferences for which "clone bundles" to use.
1841 Defines preferences for which "clone bundles" to use.
1822
1842
1823 Servers advertising "clone bundles" may advertise multiple available
1843 Servers advertising "clone bundles" may advertise multiple available
1824 bundles. Each bundle may have different attributes, such as the bundle
1844 bundles. Each bundle may have different attributes, such as the bundle
1825 type and compression format. This option is used to prefer a particular
1845 type and compression format. This option is used to prefer a particular
1826 bundle over another.
1846 bundle over another.
1827
1847
1828 The following keys are defined by Mercurial:
1848 The following keys are defined by Mercurial:
1829
1849
1830 BUNDLESPEC
1850 BUNDLESPEC
1831 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
1851 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
1832 e.g. ``gzip-v2`` or ``bzip2-v1``.
1852 e.g. ``gzip-v2`` or ``bzip2-v1``.
1833
1853
1834 COMPRESSION
1854 COMPRESSION
1835 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
1855 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
1836
1856
1837 Server operators may define custom keys.
1857 Server operators may define custom keys.
1838
1858
1839 Example values: ``COMPRESSION=bzip2``,
1859 Example values: ``COMPRESSION=bzip2``,
1840 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
1860 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
1841
1861
1842 By default, the first bundle advertised by the server is used.
1862 By default, the first bundle advertised by the server is used.
1843
1863
1844 ``color``
1864 ``color``
1845 String: when to use to colorize output. possible value are auto, always,
1865 String: when to use to colorize output. possible value are auto, always,
1846 never, or debug (default: never). 'auto' will use color whenever it seems
1866 never, or debug (default: never). 'auto' will use color whenever it seems
1847 possible. See :hg:`help color` for details.
1867 possible. See :hg:`help color` for details.
1848
1868
1849 (in addition a boolean can be used in place always/never)
1869 (in addition a boolean can be used in place always/never)
1850
1870
1851 ``commitsubrepos``
1871 ``commitsubrepos``
1852 Whether to commit modified subrepositories when committing the
1872 Whether to commit modified subrepositories when committing the
1853 parent repository. If False and one subrepository has uncommitted
1873 parent repository. If False and one subrepository has uncommitted
1854 changes, abort the commit.
1874 changes, abort the commit.
1855 (default: False)
1875 (default: False)
1856
1876
1857 ``debug``
1877 ``debug``
1858 Print debugging information. (default: False)
1878 Print debugging information. (default: False)
1859
1879
1860 ``editor``
1880 ``editor``
1861 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
1881 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
1862
1882
1863 ``fallbackencoding``
1883 ``fallbackencoding``
1864 Encoding to try if it's not possible to decode the changelog using
1884 Encoding to try if it's not possible to decode the changelog using
1865 UTF-8. (default: ISO-8859-1)
1885 UTF-8. (default: ISO-8859-1)
1866
1886
1867 ``graphnodetemplate``
1887 ``graphnodetemplate``
1868 The template used to print changeset nodes in an ASCII revision graph.
1888 The template used to print changeset nodes in an ASCII revision graph.
1869 (default: ``{graphnode}``)
1889 (default: ``{graphnode}``)
1870
1890
1871 ``ignore``
1891 ``ignore``
1872 A file to read per-user ignore patterns from. This file should be
1892 A file to read per-user ignore patterns from. This file should be
1873 in the same format as a repository-wide .hgignore file. Filenames
1893 in the same format as a repository-wide .hgignore file. Filenames
1874 are relative to the repository root. This option supports hook syntax,
1894 are relative to the repository root. This option supports hook syntax,
1875 so if you want to specify multiple ignore files, you can do so by
1895 so if you want to specify multiple ignore files, you can do so by
1876 setting something like ``ignore.other = ~/.hgignore2``. For details
1896 setting something like ``ignore.other = ~/.hgignore2``. For details
1877 of the ignore file format, see the ``hgignore(5)`` man page.
1897 of the ignore file format, see the ``hgignore(5)`` man page.
1878
1898
1879 ``interactive``
1899 ``interactive``
1880 Allow to prompt the user. (default: True)
1900 Allow to prompt the user. (default: True)
1881
1901
1882 ``interface``
1902 ``interface``
1883 Select the default interface for interactive features (default: text).
1903 Select the default interface for interactive features (default: text).
1884 Possible values are 'text' and 'curses'.
1904 Possible values are 'text' and 'curses'.
1885
1905
1886 ``interface.chunkselector``
1906 ``interface.chunkselector``
1887 Select the interface for change recording (e.g. :hg:`commit -i`).
1907 Select the interface for change recording (e.g. :hg:`commit -i`).
1888 Possible values are 'text' and 'curses'.
1908 Possible values are 'text' and 'curses'.
1889 This config overrides the interface specified by ui.interface.
1909 This config overrides the interface specified by ui.interface.
1890
1910
1891 ``logtemplate``
1911 ``logtemplate``
1892 Template string for commands that print changesets.
1912 Template string for commands that print changesets.
1893
1913
1894 ``merge``
1914 ``merge``
1895 The conflict resolution program to use during a manual merge.
1915 The conflict resolution program to use during a manual merge.
1896 For more information on merge tools see :hg:`help merge-tools`.
1916 For more information on merge tools see :hg:`help merge-tools`.
1897 For configuring merge tools see the ``[merge-tools]`` section.
1917 For configuring merge tools see the ``[merge-tools]`` section.
1898
1918
1899 ``mergemarkers``
1919 ``mergemarkers``
1900 Sets the merge conflict marker label styling. The ``detailed``
1920 Sets the merge conflict marker label styling. The ``detailed``
1901 style uses the ``mergemarkertemplate`` setting to style the labels.
1921 style uses the ``mergemarkertemplate`` setting to style the labels.
1902 The ``basic`` style just uses 'local' and 'other' as the marker label.
1922 The ``basic`` style just uses 'local' and 'other' as the marker label.
1903 One of ``basic`` or ``detailed``.
1923 One of ``basic`` or ``detailed``.
1904 (default: ``basic``)
1924 (default: ``basic``)
1905
1925
1906 ``mergemarkertemplate``
1926 ``mergemarkertemplate``
1907 The template used to print the commit description next to each conflict
1927 The template used to print the commit description next to each conflict
1908 marker during merge conflicts. See :hg:`help templates` for the template
1928 marker during merge conflicts. See :hg:`help templates` for the template
1909 format.
1929 format.
1910
1930
1911 Defaults to showing the hash, tags, branches, bookmarks, author, and
1931 Defaults to showing the hash, tags, branches, bookmarks, author, and
1912 the first line of the commit description.
1932 the first line of the commit description.
1913
1933
1914 If you use non-ASCII characters in names for tags, branches, bookmarks,
1934 If you use non-ASCII characters in names for tags, branches, bookmarks,
1915 authors, and/or commit descriptions, you must pay attention to encodings of
1935 authors, and/or commit descriptions, you must pay attention to encodings of
1916 managed files. At template expansion, non-ASCII characters use the encoding
1936 managed files. At template expansion, non-ASCII characters use the encoding
1917 specified by the ``--encoding`` global option, ``HGENCODING`` or other
1937 specified by the ``--encoding`` global option, ``HGENCODING`` or other
1918 environment variables that govern your locale. If the encoding of the merge
1938 environment variables that govern your locale. If the encoding of the merge
1919 markers is different from the encoding of the merged files,
1939 markers is different from the encoding of the merged files,
1920 serious problems may occur.
1940 serious problems may occur.
1921
1941
1922 ``origbackuppath``
1942 ``origbackuppath``
1923 The path to a directory used to store generated .orig files. If the path is
1943 The path to a directory used to store generated .orig files. If the path is
1924 not a directory, one will be created.
1944 not a directory, one will be created.
1925
1945
1926 ``patch``
1946 ``patch``
1927 An optional external tool that ``hg import`` and some extensions
1947 An optional external tool that ``hg import`` and some extensions
1928 will use for applying patches. By default Mercurial uses an
1948 will use for applying patches. By default Mercurial uses an
1929 internal patch utility. The external tool must work as the common
1949 internal patch utility. The external tool must work as the common
1930 Unix ``patch`` program. In particular, it must accept a ``-p``
1950 Unix ``patch`` program. In particular, it must accept a ``-p``
1931 argument to strip patch headers, a ``-d`` argument to specify the
1951 argument to strip patch headers, a ``-d`` argument to specify the
1932 current directory, a file name to patch, and a patch file to take
1952 current directory, a file name to patch, and a patch file to take
1933 from stdin.
1953 from stdin.
1934
1954
1935 It is possible to specify a patch tool together with extra
1955 It is possible to specify a patch tool together with extra
1936 arguments. For example, setting this option to ``patch --merge``
1956 arguments. For example, setting this option to ``patch --merge``
1937 will use the ``patch`` program with its 2-way merge option.
1957 will use the ``patch`` program with its 2-way merge option.
1938
1958
1939 ``portablefilenames``
1959 ``portablefilenames``
1940 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1960 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1941 (default: ``warn``)
1961 (default: ``warn``)
1942
1962
1943 ``warn``
1963 ``warn``
1944 Print a warning message on POSIX platforms, if a file with a non-portable
1964 Print a warning message on POSIX platforms, if a file with a non-portable
1945 filename is added (e.g. a file with a name that can't be created on
1965 filename is added (e.g. a file with a name that can't be created on
1946 Windows because it contains reserved parts like ``AUX``, reserved
1966 Windows because it contains reserved parts like ``AUX``, reserved
1947 characters like ``:``, or would cause a case collision with an existing
1967 characters like ``:``, or would cause a case collision with an existing
1948 file).
1968 file).
1949
1969
1950 ``ignore``
1970 ``ignore``
1951 Don't print a warning.
1971 Don't print a warning.
1952
1972
1953 ``abort``
1973 ``abort``
1954 The command is aborted.
1974 The command is aborted.
1955
1975
1956 ``true``
1976 ``true``
1957 Alias for ``warn``.
1977 Alias for ``warn``.
1958
1978
1959 ``false``
1979 ``false``
1960 Alias for ``ignore``.
1980 Alias for ``ignore``.
1961
1981
1962 .. container:: windows
1982 .. container:: windows
1963
1983
1964 On Windows, this configuration option is ignored and the command aborted.
1984 On Windows, this configuration option is ignored and the command aborted.
1965
1985
1966 ``quiet``
1986 ``quiet``
1967 Reduce the amount of output printed.
1987 Reduce the amount of output printed.
1968 (default: False)
1988 (default: False)
1969
1989
1970 ``remotecmd``
1990 ``remotecmd``
1971 Remote command to use for clone/push/pull operations.
1991 Remote command to use for clone/push/pull operations.
1972 (default: ``hg``)
1992 (default: ``hg``)
1973
1993
1974 ``report_untrusted``
1994 ``report_untrusted``
1975 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1995 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1976 trusted user or group.
1996 trusted user or group.
1977 (default: True)
1997 (default: True)
1978
1998
1979 ``slash``
1999 ``slash``
1980 Display paths using a slash (``/``) as the path separator. This
2000 Display paths using a slash (``/``) as the path separator. This
1981 only makes a difference on systems where the default path
2001 only makes a difference on systems where the default path
1982 separator is not the slash character (e.g. Windows uses the
2002 separator is not the slash character (e.g. Windows uses the
1983 backslash character (``\``)).
2003 backslash character (``\``)).
1984 (default: False)
2004 (default: False)
1985
2005
1986 ``statuscopies``
2006 ``statuscopies``
1987 Display copies in the status command.
2007 Display copies in the status command.
1988
2008
1989 ``ssh``
2009 ``ssh``
1990 Command to use for SSH connections. (default: ``ssh``)
2010 Command to use for SSH connections. (default: ``ssh``)
1991
2011
1992 ``strict``
2012 ``strict``
1993 Require exact command names, instead of allowing unambiguous
2013 Require exact command names, instead of allowing unambiguous
1994 abbreviations. (default: False)
2014 abbreviations. (default: False)
1995
2015
1996 ``style``
2016 ``style``
1997 Name of style to use for command output.
2017 Name of style to use for command output.
1998
2018
1999 ``supportcontact``
2019 ``supportcontact``
2000 A URL where users should report a Mercurial traceback. Use this if you are a
2020 A URL where users should report a Mercurial traceback. Use this if you are a
2001 large organisation with its own Mercurial deployment process and crash
2021 large organisation with its own Mercurial deployment process and crash
2002 reports should be addressed to your internal support.
2022 reports should be addressed to your internal support.
2003
2023
2004 ``textwidth``
2024 ``textwidth``
2005 Maximum width of help text. A longer line generated by ``hg help`` or
2025 Maximum width of help text. A longer line generated by ``hg help`` or
2006 ``hg subcommand --help`` will be broken after white space to get this
2026 ``hg subcommand --help`` will be broken after white space to get this
2007 width or the terminal width, whichever comes first.
2027 width or the terminal width, whichever comes first.
2008 A non-positive value will disable this and the terminal width will be
2028 A non-positive value will disable this and the terminal width will be
2009 used. (default: 78)
2029 used. (default: 78)
2010
2030
2011 ``timeout``
2031 ``timeout``
2012 The timeout used when a lock is held (in seconds), a negative value
2032 The timeout used when a lock is held (in seconds), a negative value
2013 means no timeout. (default: 600)
2033 means no timeout. (default: 600)
2014
2034
2015 ``traceback``
2035 ``traceback``
2016 Mercurial always prints a traceback when an unknown exception
2036 Mercurial always prints a traceback when an unknown exception
2017 occurs. Setting this to True will make Mercurial print a traceback
2037 occurs. Setting this to True will make Mercurial print a traceback
2018 on all exceptions, even those recognized by Mercurial (such as
2038 on all exceptions, even those recognized by Mercurial (such as
2019 IOError or MemoryError). (default: False)
2039 IOError or MemoryError). (default: False)
2020
2040
2021 ``username``
2041 ``username``
2022 The committer of a changeset created when running "commit".
2042 The committer of a changeset created when running "commit".
2023 Typically a person's name and email address, e.g. ``Fred Widget
2043 Typically a person's name and email address, e.g. ``Fred Widget
2024 <fred@example.com>``. Environment variables in the
2044 <fred@example.com>``. Environment variables in the
2025 username are expanded.
2045 username are expanded.
2026
2046
2027 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2047 (default: ``$EMAIL`` or ``username@hostname``. If the username in
2028 hgrc is empty, e.g. if the system admin set ``username =`` in the
2048 hgrc is empty, e.g. if the system admin set ``username =`` in the
2029 system hgrc, it has to be specified manually or in a different
2049 system hgrc, it has to be specified manually or in a different
2030 hgrc file)
2050 hgrc file)
2031
2051
2032 ``verbose``
2052 ``verbose``
2033 Increase the amount of output printed. (default: False)
2053 Increase the amount of output printed. (default: False)
2034
2054
2035
2055
2036 ``web``
2056 ``web``
2037 -------
2057 -------
2038
2058
2039 Web interface configuration. The settings in this section apply to
2059 Web interface configuration. The settings in this section apply to
2040 both the builtin webserver (started by :hg:`serve`) and the script you
2060 both the builtin webserver (started by :hg:`serve`) and the script you
2041 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2061 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
2042 and WSGI).
2062 and WSGI).
2043
2063
2044 The Mercurial webserver does no authentication (it does not prompt for
2064 The Mercurial webserver does no authentication (it does not prompt for
2045 usernames and passwords to validate *who* users are), but it does do
2065 usernames and passwords to validate *who* users are), but it does do
2046 authorization (it grants or denies access for *authenticated users*
2066 authorization (it grants or denies access for *authenticated users*
2047 based on settings in this section). You must either configure your
2067 based on settings in this section). You must either configure your
2048 webserver to do authentication for you, or disable the authorization
2068 webserver to do authentication for you, or disable the authorization
2049 checks.
2069 checks.
2050
2070
2051 For a quick setup in a trusted environment, e.g., a private LAN, where
2071 For a quick setup in a trusted environment, e.g., a private LAN, where
2052 you want it to accept pushes from anybody, you can use the following
2072 you want it to accept pushes from anybody, you can use the following
2053 command line::
2073 command line::
2054
2074
2055 $ hg --config web.allow_push=* --config web.push_ssl=False serve
2075 $ hg --config web.allow_push=* --config web.push_ssl=False serve
2056
2076
2057 Note that this will allow anybody to push anything to the server and
2077 Note that this will allow anybody to push anything to the server and
2058 that this should not be used for public servers.
2078 that this should not be used for public servers.
2059
2079
2060 The full set of options is:
2080 The full set of options is:
2061
2081
2062 ``accesslog``
2082 ``accesslog``
2063 Where to output the access log. (default: stdout)
2083 Where to output the access log. (default: stdout)
2064
2084
2065 ``address``
2085 ``address``
2066 Interface address to bind to. (default: all)
2086 Interface address to bind to. (default: all)
2067
2087
2068 ``allow_archive``
2088 ``allow_archive``
2069 List of archive format (bz2, gz, zip) allowed for downloading.
2089 List of archive format (bz2, gz, zip) allowed for downloading.
2070 (default: empty)
2090 (default: empty)
2071
2091
2072 ``allowbz2``
2092 ``allowbz2``
2073 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2093 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
2074 revisions.
2094 revisions.
2075 (default: False)
2095 (default: False)
2076
2096
2077 ``allowgz``
2097 ``allowgz``
2078 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2098 (DEPRECATED) Whether to allow .tar.gz downloading of repository
2079 revisions.
2099 revisions.
2080 (default: False)
2100 (default: False)
2081
2101
2082 ``allowpull``
2102 ``allowpull``
2083 Whether to allow pulling from the repository. (default: True)
2103 Whether to allow pulling from the repository. (default: True)
2084
2104
2085 ``allow_push``
2105 ``allow_push``
2086 Whether to allow pushing to the repository. If empty or not set,
2106 Whether to allow pushing to the repository. If empty or not set,
2087 pushing is not allowed. If the special value ``*``, any remote
2107 pushing is not allowed. If the special value ``*``, any remote
2088 user can push, including unauthenticated users. Otherwise, the
2108 user can push, including unauthenticated users. Otherwise, the
2089 remote user must have been authenticated, and the authenticated
2109 remote user must have been authenticated, and the authenticated
2090 user name must be present in this list. The contents of the
2110 user name must be present in this list. The contents of the
2091 allow_push list are examined after the deny_push list.
2111 allow_push list are examined after the deny_push list.
2092
2112
2093 ``allow_read``
2113 ``allow_read``
2094 If the user has not already been denied repository access due to
2114 If the user has not already been denied repository access due to
2095 the contents of deny_read, this list determines whether to grant
2115 the contents of deny_read, this list determines whether to grant
2096 repository access to the user. If this list is not empty, and the
2116 repository access to the user. If this list is not empty, and the
2097 user is unauthenticated or not present in the list, then access is
2117 user is unauthenticated or not present in the list, then access is
2098 denied for the user. If the list is empty or not set, then access
2118 denied for the user. If the list is empty or not set, then access
2099 is permitted to all users by default. Setting allow_read to the
2119 is permitted to all users by default. Setting allow_read to the
2100 special value ``*`` is equivalent to it not being set (i.e. access
2120 special value ``*`` is equivalent to it not being set (i.e. access
2101 is permitted to all users). The contents of the allow_read list are
2121 is permitted to all users). The contents of the allow_read list are
2102 examined after the deny_read list.
2122 examined after the deny_read list.
2103
2123
2104 ``allowzip``
2124 ``allowzip``
2105 (DEPRECATED) Whether to allow .zip downloading of repository
2125 (DEPRECATED) Whether to allow .zip downloading of repository
2106 revisions. This feature creates temporary files.
2126 revisions. This feature creates temporary files.
2107 (default: False)
2127 (default: False)
2108
2128
2109 ``archivesubrepos``
2129 ``archivesubrepos``
2110 Whether to recurse into subrepositories when archiving.
2130 Whether to recurse into subrepositories when archiving.
2111 (default: False)
2131 (default: False)
2112
2132
2113 ``baseurl``
2133 ``baseurl``
2114 Base URL to use when publishing URLs in other locations, so
2134 Base URL to use when publishing URLs in other locations, so
2115 third-party tools like email notification hooks can construct
2135 third-party tools like email notification hooks can construct
2116 URLs. Example: ``http://hgserver/repos/``.
2136 URLs. Example: ``http://hgserver/repos/``.
2117
2137
2118 ``cacerts``
2138 ``cacerts``
2119 Path to file containing a list of PEM encoded certificate
2139 Path to file containing a list of PEM encoded certificate
2120 authority certificates. Environment variables and ``~user``
2140 authority certificates. Environment variables and ``~user``
2121 constructs are expanded in the filename. If specified on the
2141 constructs are expanded in the filename. If specified on the
2122 client, then it will verify the identity of remote HTTPS servers
2142 client, then it will verify the identity of remote HTTPS servers
2123 with these certificates.
2143 with these certificates.
2124
2144
2125 To disable SSL verification temporarily, specify ``--insecure`` from
2145 To disable SSL verification temporarily, specify ``--insecure`` from
2126 command line.
2146 command line.
2127
2147
2128 You can use OpenSSL's CA certificate file if your platform has
2148 You can use OpenSSL's CA certificate file if your platform has
2129 one. On most Linux systems this will be
2149 one. On most Linux systems this will be
2130 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2150 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
2131 generate this file manually. The form must be as follows::
2151 generate this file manually. The form must be as follows::
2132
2152
2133 -----BEGIN CERTIFICATE-----
2153 -----BEGIN CERTIFICATE-----
2134 ... (certificate in base64 PEM encoding) ...
2154 ... (certificate in base64 PEM encoding) ...
2135 -----END CERTIFICATE-----
2155 -----END CERTIFICATE-----
2136 -----BEGIN CERTIFICATE-----
2156 -----BEGIN CERTIFICATE-----
2137 ... (certificate in base64 PEM encoding) ...
2157 ... (certificate in base64 PEM encoding) ...
2138 -----END CERTIFICATE-----
2158 -----END CERTIFICATE-----
2139
2159
2140 ``cache``
2160 ``cache``
2141 Whether to support caching in hgweb. (default: True)
2161 Whether to support caching in hgweb. (default: True)
2142
2162
2143 ``certificate``
2163 ``certificate``
2144 Certificate to use when running :hg:`serve`.
2164 Certificate to use when running :hg:`serve`.
2145
2165
2146 ``collapse``
2166 ``collapse``
2147 With ``descend`` enabled, repositories in subdirectories are shown at
2167 With ``descend`` enabled, repositories in subdirectories are shown at
2148 a single level alongside repositories in the current path. With
2168 a single level alongside repositories in the current path. With
2149 ``collapse`` also enabled, repositories residing at a deeper level than
2169 ``collapse`` also enabled, repositories residing at a deeper level than
2150 the current path are grouped behind navigable directory entries that
2170 the current path are grouped behind navigable directory entries that
2151 lead to the locations of these repositories. In effect, this setting
2171 lead to the locations of these repositories. In effect, this setting
2152 collapses each collection of repositories found within a subdirectory
2172 collapses each collection of repositories found within a subdirectory
2153 into a single entry for that subdirectory. (default: False)
2173 into a single entry for that subdirectory. (default: False)
2154
2174
2155 ``comparisoncontext``
2175 ``comparisoncontext``
2156 Number of lines of context to show in side-by-side file comparison. If
2176 Number of lines of context to show in side-by-side file comparison. If
2157 negative or the value ``full``, whole files are shown. (default: 5)
2177 negative or the value ``full``, whole files are shown. (default: 5)
2158
2178
2159 This setting can be overridden by a ``context`` request parameter to the
2179 This setting can be overridden by a ``context`` request parameter to the
2160 ``comparison`` command, taking the same values.
2180 ``comparison`` command, taking the same values.
2161
2181
2162 ``contact``
2182 ``contact``
2163 Name or email address of the person in charge of the repository.
2183 Name or email address of the person in charge of the repository.
2164 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2184 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
2165
2185
2166 ``csp``
2186 ``csp``
2167 Send a ``Content-Security-Policy`` HTTP header with this value.
2187 Send a ``Content-Security-Policy`` HTTP header with this value.
2168
2188
2169 The value may contain a special string ``%nonce%``, which will be replaced
2189 The value may contain a special string ``%nonce%``, which will be replaced
2170 by a randomly-generated one-time use value. If the value contains
2190 by a randomly-generated one-time use value. If the value contains
2171 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2191 ``%nonce%``, ``web.cache`` will be disabled, as caching undermines the
2172 one-time property of the nonce. This nonce will also be inserted into
2192 one-time property of the nonce. This nonce will also be inserted into
2173 ``<script>`` elements containing inline JavaScript.
2193 ``<script>`` elements containing inline JavaScript.
2174
2194
2175 Note: lots of HTML content sent by the server is derived from repository
2195 Note: lots of HTML content sent by the server is derived from repository
2176 data. Please consider the potential for malicious repository data to
2196 data. Please consider the potential for malicious repository data to
2177 "inject" itself into generated HTML content as part of your security
2197 "inject" itself into generated HTML content as part of your security
2178 threat model.
2198 threat model.
2179
2199
2180 ``deny_push``
2200 ``deny_push``
2181 Whether to deny pushing to the repository. If empty or not set,
2201 Whether to deny pushing to the repository. If empty or not set,
2182 push is not denied. If the special value ``*``, all remote users are
2202 push is not denied. If the special value ``*``, all remote users are
2183 denied push. Otherwise, unauthenticated users are all denied, and
2203 denied push. Otherwise, unauthenticated users are all denied, and
2184 any authenticated user name present in this list is also denied. The
2204 any authenticated user name present in this list is also denied. The
2185 contents of the deny_push list are examined before the allow_push list.
2205 contents of the deny_push list are examined before the allow_push list.
2186
2206
2187 ``deny_read``
2207 ``deny_read``
2188 Whether to deny reading/viewing of the repository. If this list is
2208 Whether to deny reading/viewing of the repository. If this list is
2189 not empty, unauthenticated users are all denied, and any
2209 not empty, unauthenticated users are all denied, and any
2190 authenticated user name present in this list is also denied access to
2210 authenticated user name present in this list is also denied access to
2191 the repository. If set to the special value ``*``, all remote users
2211 the repository. If set to the special value ``*``, all remote users
2192 are denied access (rarely needed ;). If deny_read is empty or not set,
2212 are denied access (rarely needed ;). If deny_read is empty or not set,
2193 the determination of repository access depends on the presence and
2213 the determination of repository access depends on the presence and
2194 content of the allow_read list (see description). If both
2214 content of the allow_read list (see description). If both
2195 deny_read and allow_read are empty or not set, then access is
2215 deny_read and allow_read are empty or not set, then access is
2196 permitted to all users by default. If the repository is being
2216 permitted to all users by default. If the repository is being
2197 served via hgwebdir, denied users will not be able to see it in
2217 served via hgwebdir, denied users will not be able to see it in
2198 the list of repositories. The contents of the deny_read list have
2218 the list of repositories. The contents of the deny_read list have
2199 priority over (are examined before) the contents of the allow_read
2219 priority over (are examined before) the contents of the allow_read
2200 list.
2220 list.
2201
2221
2202 ``descend``
2222 ``descend``
2203 hgwebdir indexes will not descend into subdirectories. Only repositories
2223 hgwebdir indexes will not descend into subdirectories. Only repositories
2204 directly in the current path will be shown (other repositories are still
2224 directly in the current path will be shown (other repositories are still
2205 available from the index corresponding to their containing path).
2225 available from the index corresponding to their containing path).
2206
2226
2207 ``description``
2227 ``description``
2208 Textual description of the repository's purpose or contents.
2228 Textual description of the repository's purpose or contents.
2209 (default: "unknown")
2229 (default: "unknown")
2210
2230
2211 ``encoding``
2231 ``encoding``
2212 Character encoding name. (default: the current locale charset)
2232 Character encoding name. (default: the current locale charset)
2213 Example: "UTF-8".
2233 Example: "UTF-8".
2214
2234
2215 ``errorlog``
2235 ``errorlog``
2216 Where to output the error log. (default: stderr)
2236 Where to output the error log. (default: stderr)
2217
2237
2218 ``guessmime``
2238 ``guessmime``
2219 Control MIME types for raw download of file content.
2239 Control MIME types for raw download of file content.
2220 Set to True to let hgweb guess the content type from the file
2240 Set to True to let hgweb guess the content type from the file
2221 extension. This will serve HTML files as ``text/html`` and might
2241 extension. This will serve HTML files as ``text/html`` and might
2222 allow cross-site scripting attacks when serving untrusted
2242 allow cross-site scripting attacks when serving untrusted
2223 repositories. (default: False)
2243 repositories. (default: False)
2224
2244
2225 ``hidden``
2245 ``hidden``
2226 Whether to hide the repository in the hgwebdir index.
2246 Whether to hide the repository in the hgwebdir index.
2227 (default: False)
2247 (default: False)
2228
2248
2229 ``ipv6``
2249 ``ipv6``
2230 Whether to use IPv6. (default: False)
2250 Whether to use IPv6. (default: False)
2231
2251
2232 ``labels``
2252 ``labels``
2233 List of string *labels* associated with the repository.
2253 List of string *labels* associated with the repository.
2234
2254
2235 Labels are exposed as a template keyword and can be used to customize
2255 Labels are exposed as a template keyword and can be used to customize
2236 output. e.g. the ``index`` template can group or filter repositories
2256 output. e.g. the ``index`` template can group or filter repositories
2237 by labels and the ``summary`` template can display additional content
2257 by labels and the ``summary`` template can display additional content
2238 if a specific label is present.
2258 if a specific label is present.
2239
2259
2240 ``logoimg``
2260 ``logoimg``
2241 File name of the logo image that some templates display on each page.
2261 File name of the logo image that some templates display on each page.
2242 The file name is relative to ``staticurl``. That is, the full path to
2262 The file name is relative to ``staticurl``. That is, the full path to
2243 the logo image is "staticurl/logoimg".
2263 the logo image is "staticurl/logoimg".
2244 If unset, ``hglogo.png`` will be used.
2264 If unset, ``hglogo.png`` will be used.
2245
2265
2246 ``logourl``
2266 ``logourl``
2247 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2267 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
2248 will be used.
2268 will be used.
2249
2269
2250 ``maxchanges``
2270 ``maxchanges``
2251 Maximum number of changes to list on the changelog. (default: 10)
2271 Maximum number of changes to list on the changelog. (default: 10)
2252
2272
2253 ``maxfiles``
2273 ``maxfiles``
2254 Maximum number of files to list per changeset. (default: 10)
2274 Maximum number of files to list per changeset. (default: 10)
2255
2275
2256 ``maxshortchanges``
2276 ``maxshortchanges``
2257 Maximum number of changes to list on the shortlog, graph or filelog
2277 Maximum number of changes to list on the shortlog, graph or filelog
2258 pages. (default: 60)
2278 pages. (default: 60)
2259
2279
2260 ``name``
2280 ``name``
2261 Repository name to use in the web interface.
2281 Repository name to use in the web interface.
2262 (default: current working directory)
2282 (default: current working directory)
2263
2283
2264 ``port``
2284 ``port``
2265 Port to listen on. (default: 8000)
2285 Port to listen on. (default: 8000)
2266
2286
2267 ``prefix``
2287 ``prefix``
2268 Prefix path to serve from. (default: '' (server root))
2288 Prefix path to serve from. (default: '' (server root))
2269
2289
2270 ``push_ssl``
2290 ``push_ssl``
2271 Whether to require that inbound pushes be transported over SSL to
2291 Whether to require that inbound pushes be transported over SSL to
2272 prevent password sniffing. (default: True)
2292 prevent password sniffing. (default: True)
2273
2293
2274 ``refreshinterval``
2294 ``refreshinterval``
2275 How frequently directory listings re-scan the filesystem for new
2295 How frequently directory listings re-scan the filesystem for new
2276 repositories, in seconds. This is relevant when wildcards are used
2296 repositories, in seconds. This is relevant when wildcards are used
2277 to define paths. Depending on how much filesystem traversal is
2297 to define paths. Depending on how much filesystem traversal is
2278 required, refreshing may negatively impact performance.
2298 required, refreshing may negatively impact performance.
2279
2299
2280 Values less than or equal to 0 always refresh.
2300 Values less than or equal to 0 always refresh.
2281 (default: 20)
2301 (default: 20)
2282
2302
2283 ``staticurl``
2303 ``staticurl``
2284 Base URL to use for static files. If unset, static files (e.g. the
2304 Base URL to use for static files. If unset, static files (e.g. the
2285 hgicon.png favicon) will be served by the CGI script itself. Use
2305 hgicon.png favicon) will be served by the CGI script itself. Use
2286 this setting to serve them directly with the HTTP server.
2306 this setting to serve them directly with the HTTP server.
2287 Example: ``http://hgserver/static/``.
2307 Example: ``http://hgserver/static/``.
2288
2308
2289 ``stripes``
2309 ``stripes``
2290 How many lines a "zebra stripe" should span in multi-line output.
2310 How many lines a "zebra stripe" should span in multi-line output.
2291 Set to 0 to disable. (default: 1)
2311 Set to 0 to disable. (default: 1)
2292
2312
2293 ``style``
2313 ``style``
2294 Which template map style to use. The available options are the names of
2314 Which template map style to use. The available options are the names of
2295 subdirectories in the HTML templates path. (default: ``paper``)
2315 subdirectories in the HTML templates path. (default: ``paper``)
2296 Example: ``monoblue``.
2316 Example: ``monoblue``.
2297
2317
2298 ``templates``
2318 ``templates``
2299 Where to find the HTML templates. The default path to the HTML templates
2319 Where to find the HTML templates. The default path to the HTML templates
2300 can be obtained from ``hg debuginstall``.
2320 can be obtained from ``hg debuginstall``.
2301
2321
2302 ``websub``
2322 ``websub``
2303 ----------
2323 ----------
2304
2324
2305 Web substitution filter definition. You can use this section to
2325 Web substitution filter definition. You can use this section to
2306 define a set of regular expression substitution patterns which
2326 define a set of regular expression substitution patterns which
2307 let you automatically modify the hgweb server output.
2327 let you automatically modify the hgweb server output.
2308
2328
2309 The default hgweb templates only apply these substitution patterns
2329 The default hgweb templates only apply these substitution patterns
2310 on the revision description fields. You can apply them anywhere
2330 on the revision description fields. You can apply them anywhere
2311 you want when you create your own templates by adding calls to the
2331 you want when you create your own templates by adding calls to the
2312 "websub" filter (usually after calling the "escape" filter).
2332 "websub" filter (usually after calling the "escape" filter).
2313
2333
2314 This can be used, for example, to convert issue references to links
2334 This can be used, for example, to convert issue references to links
2315 to your issue tracker, or to convert "markdown-like" syntax into
2335 to your issue tracker, or to convert "markdown-like" syntax into
2316 HTML (see the examples below).
2336 HTML (see the examples below).
2317
2337
2318 Each entry in this section names a substitution filter.
2338 Each entry in this section names a substitution filter.
2319 The value of each entry defines the substitution expression itself.
2339 The value of each entry defines the substitution expression itself.
2320 The websub expressions follow the old interhg extension syntax,
2340 The websub expressions follow the old interhg extension syntax,
2321 which in turn imitates the Unix sed replacement syntax::
2341 which in turn imitates the Unix sed replacement syntax::
2322
2342
2323 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2343 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
2324
2344
2325 You can use any separator other than "/". The final "i" is optional
2345 You can use any separator other than "/". The final "i" is optional
2326 and indicates that the search must be case insensitive.
2346 and indicates that the search must be case insensitive.
2327
2347
2328 Examples::
2348 Examples::
2329
2349
2330 [websub]
2350 [websub]
2331 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2351 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
2332 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2352 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
2333 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2353 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
2334
2354
2335 ``worker``
2355 ``worker``
2336 ----------
2356 ----------
2337
2357
2338 Parallel master/worker configuration. We currently perform working
2358 Parallel master/worker configuration. We currently perform working
2339 directory updates in parallel on Unix-like systems, which greatly
2359 directory updates in parallel on Unix-like systems, which greatly
2340 helps performance.
2360 helps performance.
2341
2361
2342 ``numcpus``
2362 ``numcpus``
2343 Number of CPUs to use for parallel operations. A zero or
2363 Number of CPUs to use for parallel operations. A zero or
2344 negative value is treated as ``use the default``.
2364 negative value is treated as ``use the default``.
2345 (default: 4 or the number of CPUs on the system, whichever is larger)
2365 (default: 4 or the number of CPUs on the system, whichever is larger)
2346
2366
2347 ``backgroundclose``
2367 ``backgroundclose``
2348 Whether to enable closing file handles on background threads during certain
2368 Whether to enable closing file handles on background threads during certain
2349 operations. Some platforms aren't very efficient at closing file
2369 operations. Some platforms aren't very efficient at closing file
2350 handles that have been written or appended to. By performing file closing
2370 handles that have been written or appended to. By performing file closing
2351 on background threads, file write rate can increase substantially.
2371 on background threads, file write rate can increase substantially.
2352 (default: true on Windows, false elsewhere)
2372 (default: true on Windows, false elsewhere)
2353
2373
2354 ``backgroundcloseminfilecount``
2374 ``backgroundcloseminfilecount``
2355 Minimum number of files required to trigger background file closing.
2375 Minimum number of files required to trigger background file closing.
2356 Operations not writing this many files won't start background close
2376 Operations not writing this many files won't start background close
2357 threads.
2377 threads.
2358 (default: 2048)
2378 (default: 2048)
2359
2379
2360 ``backgroundclosemaxqueue``
2380 ``backgroundclosemaxqueue``
2361 The maximum number of opened file handles waiting to be closed in the
2381 The maximum number of opened file handles waiting to be closed in the
2362 background. This option only has an effect if ``backgroundclose`` is
2382 background. This option only has an effect if ``backgroundclose`` is
2363 enabled.
2383 enabled.
2364 (default: 384)
2384 (default: 384)
2365
2385
2366 ``backgroundclosethreadcount``
2386 ``backgroundclosethreadcount``
2367 Number of threads to process background file closes. Only relevant if
2387 Number of threads to process background file closes. Only relevant if
2368 ``backgroundclose`` is enabled.
2388 ``backgroundclose`` is enabled.
2369 (default: 4)
2389 (default: 4)
@@ -1,486 +1,516 b''
1 # url.py - HTTP handling for mercurial
1 # url.py - HTTP handling for mercurial
2 #
2 #
3 # Copyright 2005, 2006, 2007, 2008 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005, 2006, 2007, 2008 Matt Mackall <mpm@selenic.com>
4 # Copyright 2006, 2007 Alexis S. L. Carvalho <alexis@cecm.usp.br>
4 # Copyright 2006, 2007 Alexis S. L. Carvalho <alexis@cecm.usp.br>
5 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
5 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
6 #
6 #
7 # This software may be used and distributed according to the terms of the
7 # This software may be used and distributed according to the terms of the
8 # GNU General Public License version 2 or any later version.
8 # GNU General Public License version 2 or any later version.
9
9
10 from __future__ import absolute_import
10 from __future__ import absolute_import
11
11
12 import base64
12 import base64
13 import os
13 import os
14 import socket
14 import socket
15
15
16 from .i18n import _
16 from .i18n import _
17 from . import (
17 from . import (
18 encoding,
18 encoding,
19 error,
19 error,
20 httpconnection as httpconnectionmod,
20 httpconnection as httpconnectionmod,
21 keepalive,
21 keepalive,
22 sslutil,
22 sslutil,
23 util,
23 util,
24 )
24 )
25
25
26 httplib = util.httplib
26 httplib = util.httplib
27 stringio = util.stringio
27 stringio = util.stringio
28 urlerr = util.urlerr
28 urlerr = util.urlerr
29 urlreq = util.urlreq
29 urlreq = util.urlreq
30
30
31 class passwordmgr(object):
31 class passwordmgr(object):
32 def __init__(self, ui, passwddb):
32 def __init__(self, ui, passwddb):
33 self.ui = ui
33 self.ui = ui
34 self.passwddb = passwddb
34 self.passwddb = passwddb
35
35
36 def add_password(self, realm, uri, user, passwd):
36 def add_password(self, realm, uri, user, passwd):
37 return self.passwddb.add_password(realm, uri, user, passwd)
37 return self.passwddb.add_password(realm, uri, user, passwd)
38
38
39 def find_user_password(self, realm, authuri):
39 def find_user_password(self, realm, authuri):
40 authinfo = self.passwddb.find_user_password(realm, authuri)
40 authinfo = self.passwddb.find_user_password(realm, authuri)
41 user, passwd = authinfo
41 user, passwd = authinfo
42 if user and passwd:
42 if user and passwd:
43 self._writedebug(user, passwd)
43 self._writedebug(user, passwd)
44 return (user, passwd)
44 return (user, passwd)
45
45
46 if not user or not passwd:
46 if not user or not passwd:
47 res = httpconnectionmod.readauthforuri(self.ui, authuri, user)
47 res = httpconnectionmod.readauthforuri(self.ui, authuri, user)
48 if res:
48 if res:
49 group, auth = res
49 group, auth = res
50 user, passwd = auth.get('username'), auth.get('password')
50 user, passwd = auth.get('username'), auth.get('password')
51 self.ui.debug("using auth.%s.* for authentication\n" % group)
51 self.ui.debug("using auth.%s.* for authentication\n" % group)
52 if not user or not passwd:
52 if not user or not passwd:
53 u = util.url(authuri)
53 u = util.url(authuri)
54 u.query = None
54 u.query = None
55 if not self.ui.interactive():
55 if not self.ui.interactive():
56 raise error.Abort(_('http authorization required for %s') %
56 raise error.Abort(_('http authorization required for %s') %
57 util.hidepassword(str(u)))
57 util.hidepassword(str(u)))
58
58
59 self.ui.write(_("http authorization required for %s\n") %
59 self.ui.write(_("http authorization required for %s\n") %
60 util.hidepassword(str(u)))
60 util.hidepassword(str(u)))
61 self.ui.write(_("realm: %s\n") % realm)
61 self.ui.write(_("realm: %s\n") % realm)
62 if user:
62 if user:
63 self.ui.write(_("user: %s\n") % user)
63 self.ui.write(_("user: %s\n") % user)
64 else:
64 else:
65 user = self.ui.prompt(_("user:"), default=None)
65 user = self.ui.prompt(_("user:"), default=None)
66
66
67 if not passwd:
67 if not passwd:
68 passwd = self.ui.getpass()
68 passwd = self.ui.getpass()
69
69
70 self.passwddb.add_password(realm, authuri, user, passwd)
70 self.passwddb.add_password(realm, authuri, user, passwd)
71 self._writedebug(user, passwd)
71 self._writedebug(user, passwd)
72 return (user, passwd)
72 return (user, passwd)
73
73
74 def _writedebug(self, user, passwd):
74 def _writedebug(self, user, passwd):
75 msg = _('http auth: user %s, password %s\n')
75 msg = _('http auth: user %s, password %s\n')
76 self.ui.debug(msg % (user, passwd and '*' * len(passwd) or 'not set'))
76 self.ui.debug(msg % (user, passwd and '*' * len(passwd) or 'not set'))
77
77
78 def find_stored_password(self, authuri):
78 def find_stored_password(self, authuri):
79 return self.passwddb.find_user_password(None, authuri)
79 return self.passwddb.find_user_password(None, authuri)
80
80
81 class proxyhandler(urlreq.proxyhandler):
81 class proxyhandler(urlreq.proxyhandler):
82 def __init__(self, ui):
82 def __init__(self, ui):
83 proxyurl = (ui.config("http_proxy", "host") or
83 proxyurl = (ui.config("http_proxy", "host") or
84 encoding.environ.get('http_proxy'))
84 encoding.environ.get('http_proxy'))
85 # XXX proxyauthinfo = None
85 # XXX proxyauthinfo = None
86
86
87 if proxyurl:
87 if proxyurl:
88 # proxy can be proper url or host[:port]
88 # proxy can be proper url or host[:port]
89 if not (proxyurl.startswith('http:') or
89 if not (proxyurl.startswith('http:') or
90 proxyurl.startswith('https:')):
90 proxyurl.startswith('https:')):
91 proxyurl = 'http://' + proxyurl + '/'
91 proxyurl = 'http://' + proxyurl + '/'
92 proxy = util.url(proxyurl)
92 proxy = util.url(proxyurl)
93 if not proxy.user:
93 if not proxy.user:
94 proxy.user = ui.config("http_proxy", "user")
94 proxy.user = ui.config("http_proxy", "user")
95 proxy.passwd = ui.config("http_proxy", "passwd")
95 proxy.passwd = ui.config("http_proxy", "passwd")
96
96
97 # see if we should use a proxy for this url
97 # see if we should use a proxy for this url
98 no_list = ["localhost", "127.0.0.1"]
98 no_list = ["localhost", "127.0.0.1"]
99 no_list.extend([p.lower() for
99 no_list.extend([p.lower() for
100 p in ui.configlist("http_proxy", "no")])
100 p in ui.configlist("http_proxy", "no")])
101 no_list.extend([p.strip().lower() for
101 no_list.extend([p.strip().lower() for
102 p in encoding.environ.get("no_proxy", '').split(',')
102 p in encoding.environ.get("no_proxy", '').split(',')
103 if p.strip()])
103 if p.strip()])
104 # "http_proxy.always" config is for running tests on localhost
104 # "http_proxy.always" config is for running tests on localhost
105 if ui.configbool("http_proxy", "always"):
105 if ui.configbool("http_proxy", "always"):
106 self.no_list = []
106 self.no_list = []
107 else:
107 else:
108 self.no_list = no_list
108 self.no_list = no_list
109
109
110 proxyurl = str(proxy)
110 proxyurl = str(proxy)
111 proxies = {'http': proxyurl, 'https': proxyurl}
111 proxies = {'http': proxyurl, 'https': proxyurl}
112 ui.debug('proxying through http://%s:%s\n' %
112 ui.debug('proxying through http://%s:%s\n' %
113 (proxy.host, proxy.port))
113 (proxy.host, proxy.port))
114 else:
114 else:
115 proxies = {}
115 proxies = {}
116
116
117 urlreq.proxyhandler.__init__(self, proxies)
117 urlreq.proxyhandler.__init__(self, proxies)
118 self.ui = ui
118 self.ui = ui
119
119
120 def proxy_open(self, req, proxy, type_):
120 def proxy_open(self, req, proxy, type_):
121 host = req.get_host().split(':')[0]
121 host = req.get_host().split(':')[0]
122 for e in self.no_list:
122 for e in self.no_list:
123 if host == e:
123 if host == e:
124 return None
124 return None
125 if e.startswith('*.') and host.endswith(e[2:]):
125 if e.startswith('*.') and host.endswith(e[2:]):
126 return None
126 return None
127 if e.startswith('.') and host.endswith(e[1:]):
127 if e.startswith('.') and host.endswith(e[1:]):
128 return None
128 return None
129
129
130 return urlreq.proxyhandler.proxy_open(self, req, proxy, type_)
130 return urlreq.proxyhandler.proxy_open(self, req, proxy, type_)
131
131
132 def _gen_sendfile(orgsend):
132 def _gen_sendfile(orgsend):
133 def _sendfile(self, data):
133 def _sendfile(self, data):
134 # send a file
134 # send a file
135 if isinstance(data, httpconnectionmod.httpsendfile):
135 if isinstance(data, httpconnectionmod.httpsendfile):
136 # if auth required, some data sent twice, so rewind here
136 # if auth required, some data sent twice, so rewind here
137 data.seek(0)
137 data.seek(0)
138 for chunk in util.filechunkiter(data):
138 for chunk in util.filechunkiter(data):
139 orgsend(self, chunk)
139 orgsend(self, chunk)
140 else:
140 else:
141 orgsend(self, data)
141 orgsend(self, data)
142 return _sendfile
142 return _sendfile
143
143
144 has_https = util.safehasattr(urlreq, 'httpshandler')
144 has_https = util.safehasattr(urlreq, 'httpshandler')
145
145
146 class httpconnection(keepalive.HTTPConnection):
146 class httpconnection(keepalive.HTTPConnection):
147 # must be able to send big bundle as stream.
147 # must be able to send big bundle as stream.
148 send = _gen_sendfile(keepalive.HTTPConnection.send)
148 send = _gen_sendfile(keepalive.HTTPConnection.send)
149
149
150 def getresponse(self):
150 def getresponse(self):
151 proxyres = getattr(self, 'proxyres', None)
151 proxyres = getattr(self, 'proxyres', None)
152 if proxyres:
152 if proxyres:
153 if proxyres.will_close:
153 if proxyres.will_close:
154 self.close()
154 self.close()
155 self.proxyres = None
155 self.proxyres = None
156 return proxyres
156 return proxyres
157 return keepalive.HTTPConnection.getresponse(self)
157 return keepalive.HTTPConnection.getresponse(self)
158
158
159 # general transaction handler to support different ways to handle
159 # general transaction handler to support different ways to handle
160 # HTTPS proxying before and after Python 2.6.3.
160 # HTTPS proxying before and after Python 2.6.3.
161 def _generic_start_transaction(handler, h, req):
161 def _generic_start_transaction(handler, h, req):
162 tunnel_host = getattr(req, '_tunnel_host', None)
162 tunnel_host = getattr(req, '_tunnel_host', None)
163 if tunnel_host:
163 if tunnel_host:
164 if tunnel_host[:7] not in ['http://', 'https:/']:
164 if tunnel_host[:7] not in ['http://', 'https:/']:
165 tunnel_host = 'https://' + tunnel_host
165 tunnel_host = 'https://' + tunnel_host
166 new_tunnel = True
166 new_tunnel = True
167 else:
167 else:
168 tunnel_host = req.get_selector()
168 tunnel_host = req.get_selector()
169 new_tunnel = False
169 new_tunnel = False
170
170
171 if new_tunnel or tunnel_host == req.get_full_url(): # has proxy
171 if new_tunnel or tunnel_host == req.get_full_url(): # has proxy
172 u = util.url(tunnel_host)
172 u = util.url(tunnel_host)
173 if new_tunnel or u.scheme == 'https': # only use CONNECT for HTTPS
173 if new_tunnel or u.scheme == 'https': # only use CONNECT for HTTPS
174 h.realhostport = ':'.join([u.host, (u.port or '443')])
174 h.realhostport = ':'.join([u.host, (u.port or '443')])
175 h.headers = req.headers.copy()
175 h.headers = req.headers.copy()
176 h.headers.update(handler.parent.addheaders)
176 h.headers.update(handler.parent.addheaders)
177 return
177 return
178
178
179 h.realhostport = None
179 h.realhostport = None
180 h.headers = None
180 h.headers = None
181
181
182 def _generic_proxytunnel(self):
182 def _generic_proxytunnel(self):
183 proxyheaders = dict(
183 proxyheaders = dict(
184 [(x, self.headers[x]) for x in self.headers
184 [(x, self.headers[x]) for x in self.headers
185 if x.lower().startswith('proxy-')])
185 if x.lower().startswith('proxy-')])
186 self.send('CONNECT %s HTTP/1.0\r\n' % self.realhostport)
186 self.send('CONNECT %s HTTP/1.0\r\n' % self.realhostport)
187 for header in proxyheaders.iteritems():
187 for header in proxyheaders.iteritems():
188 self.send('%s: %s\r\n' % header)
188 self.send('%s: %s\r\n' % header)
189 self.send('\r\n')
189 self.send('\r\n')
190
190
191 # majority of the following code is duplicated from
191 # majority of the following code is duplicated from
192 # httplib.HTTPConnection as there are no adequate places to
192 # httplib.HTTPConnection as there are no adequate places to
193 # override functions to provide the needed functionality
193 # override functions to provide the needed functionality
194 res = self.response_class(self.sock,
194 res = self.response_class(self.sock,
195 strict=self.strict,
195 strict=self.strict,
196 method=self._method)
196 method=self._method)
197
197
198 while True:
198 while True:
199 version, status, reason = res._read_status()
199 version, status, reason = res._read_status()
200 if status != httplib.CONTINUE:
200 if status != httplib.CONTINUE:
201 break
201 break
202 # skip lines that are all whitespace
202 # skip lines that are all whitespace
203 list(iter(lambda: res.fp.readline().strip(), ''))
203 list(iter(lambda: res.fp.readline().strip(), ''))
204 res.status = status
204 res.status = status
205 res.reason = reason.strip()
205 res.reason = reason.strip()
206
206
207 if res.status == 200:
207 if res.status == 200:
208 # skip lines until we find a blank line
208 # skip lines until we find a blank line
209 list(iter(res.fp.readline, '\r\n'))
209 list(iter(res.fp.readline, '\r\n'))
210 return True
210 return True
211
211
212 if version == 'HTTP/1.0':
212 if version == 'HTTP/1.0':
213 res.version = 10
213 res.version = 10
214 elif version.startswith('HTTP/1.'):
214 elif version.startswith('HTTP/1.'):
215 res.version = 11
215 res.version = 11
216 elif version == 'HTTP/0.9':
216 elif version == 'HTTP/0.9':
217 res.version = 9
217 res.version = 9
218 else:
218 else:
219 raise httplib.UnknownProtocol(version)
219 raise httplib.UnknownProtocol(version)
220
220
221 if res.version == 9:
221 if res.version == 9:
222 res.length = None
222 res.length = None
223 res.chunked = 0
223 res.chunked = 0
224 res.will_close = 1
224 res.will_close = 1
225 res.msg = httplib.HTTPMessage(stringio())
225 res.msg = httplib.HTTPMessage(stringio())
226 return False
226 return False
227
227
228 res.msg = httplib.HTTPMessage(res.fp)
228 res.msg = httplib.HTTPMessage(res.fp)
229 res.msg.fp = None
229 res.msg.fp = None
230
230
231 # are we using the chunked-style of transfer encoding?
231 # are we using the chunked-style of transfer encoding?
232 trenc = res.msg.getheader('transfer-encoding')
232 trenc = res.msg.getheader('transfer-encoding')
233 if trenc and trenc.lower() == "chunked":
233 if trenc and trenc.lower() == "chunked":
234 res.chunked = 1
234 res.chunked = 1
235 res.chunk_left = None
235 res.chunk_left = None
236 else:
236 else:
237 res.chunked = 0
237 res.chunked = 0
238
238
239 # will the connection close at the end of the response?
239 # will the connection close at the end of the response?
240 res.will_close = res._check_close()
240 res.will_close = res._check_close()
241
241
242 # do we have a Content-Length?
242 # do we have a Content-Length?
243 # NOTE: RFC 2616, section 4.4, #3 says we ignore this if
243 # NOTE: RFC 2616, section 4.4, #3 says we ignore this if
244 # transfer-encoding is "chunked"
244 # transfer-encoding is "chunked"
245 length = res.msg.getheader('content-length')
245 length = res.msg.getheader('content-length')
246 if length and not res.chunked:
246 if length and not res.chunked:
247 try:
247 try:
248 res.length = int(length)
248 res.length = int(length)
249 except ValueError:
249 except ValueError:
250 res.length = None
250 res.length = None
251 else:
251 else:
252 if res.length < 0: # ignore nonsensical negative lengths
252 if res.length < 0: # ignore nonsensical negative lengths
253 res.length = None
253 res.length = None
254 else:
254 else:
255 res.length = None
255 res.length = None
256
256
257 # does the body have a fixed length? (of zero)
257 # does the body have a fixed length? (of zero)
258 if (status == httplib.NO_CONTENT or status == httplib.NOT_MODIFIED or
258 if (status == httplib.NO_CONTENT or status == httplib.NOT_MODIFIED or
259 100 <= status < 200 or # 1xx codes
259 100 <= status < 200 or # 1xx codes
260 res._method == 'HEAD'):
260 res._method == 'HEAD'):
261 res.length = 0
261 res.length = 0
262
262
263 # if the connection remains open, and we aren't using chunked, and
263 # if the connection remains open, and we aren't using chunked, and
264 # a content-length was not provided, then assume that the connection
264 # a content-length was not provided, then assume that the connection
265 # WILL close.
265 # WILL close.
266 if (not res.will_close and
266 if (not res.will_close and
267 not res.chunked and
267 not res.chunked and
268 res.length is None):
268 res.length is None):
269 res.will_close = 1
269 res.will_close = 1
270
270
271 self.proxyres = res
271 self.proxyres = res
272
272
273 return False
273 return False
274
274
275 class httphandler(keepalive.HTTPHandler):
275 class httphandler(keepalive.HTTPHandler):
276 def http_open(self, req):
276 def http_open(self, req):
277 return self.do_open(httpconnection, req)
277 return self.do_open(httpconnection, req)
278
278
279 def _start_transaction(self, h, req):
279 def _start_transaction(self, h, req):
280 _generic_start_transaction(self, h, req)
280 _generic_start_transaction(self, h, req)
281 return keepalive.HTTPHandler._start_transaction(self, h, req)
281 return keepalive.HTTPHandler._start_transaction(self, h, req)
282
282
283 if has_https:
283 if has_https:
284 class httpsconnection(httplib.HTTPConnection):
284 class httpsconnection(httplib.HTTPConnection):
285 response_class = keepalive.HTTPResponse
285 response_class = keepalive.HTTPResponse
286 default_port = httplib.HTTPS_PORT
286 default_port = httplib.HTTPS_PORT
287 # must be able to send big bundle as stream.
287 # must be able to send big bundle as stream.
288 send = _gen_sendfile(keepalive.safesend)
288 send = _gen_sendfile(keepalive.safesend)
289 getresponse = keepalive.wrapgetresponse(httplib.HTTPConnection)
289 getresponse = keepalive.wrapgetresponse(httplib.HTTPConnection)
290
290
291 def __init__(self, host, port=None, key_file=None, cert_file=None,
291 def __init__(self, host, port=None, key_file=None, cert_file=None,
292 *args, **kwargs):
292 *args, **kwargs):
293 httplib.HTTPConnection.__init__(self, host, port, *args, **kwargs)
293 httplib.HTTPConnection.__init__(self, host, port, *args, **kwargs)
294 self.key_file = key_file
294 self.key_file = key_file
295 self.cert_file = cert_file
295 self.cert_file = cert_file
296
296
297 def connect(self):
297 def connect(self):
298 self.sock = socket.create_connection((self.host, self.port))
298 self.sock = socket.create_connection((self.host, self.port))
299
299
300 host = self.host
300 host = self.host
301 if self.realhostport: # use CONNECT proxy
301 if self.realhostport: # use CONNECT proxy
302 _generic_proxytunnel(self)
302 _generic_proxytunnel(self)
303 host = self.realhostport.rsplit(':', 1)[0]
303 host = self.realhostport.rsplit(':', 1)[0]
304 self.sock = sslutil.wrapsocket(
304 self.sock = sslutil.wrapsocket(
305 self.sock, self.key_file, self.cert_file, ui=self.ui,
305 self.sock, self.key_file, self.cert_file, ui=self.ui,
306 serverhostname=host)
306 serverhostname=host)
307 sslutil.validatesocket(self.sock)
307 sslutil.validatesocket(self.sock)
308
308
309 class httpshandler(keepalive.KeepAliveHandler, urlreq.httpshandler):
309 class httpshandler(keepalive.KeepAliveHandler, urlreq.httpshandler):
310 def __init__(self, ui):
310 def __init__(self, ui):
311 keepalive.KeepAliveHandler.__init__(self)
311 keepalive.KeepAliveHandler.__init__(self)
312 urlreq.httpshandler.__init__(self)
312 urlreq.httpshandler.__init__(self)
313 self.ui = ui
313 self.ui = ui
314 self.pwmgr = passwordmgr(self.ui,
314 self.pwmgr = passwordmgr(self.ui,
315 self.ui.httppasswordmgrdb)
315 self.ui.httppasswordmgrdb)
316
316
317 def _start_transaction(self, h, req):
317 def _start_transaction(self, h, req):
318 _generic_start_transaction(self, h, req)
318 _generic_start_transaction(self, h, req)
319 return keepalive.KeepAliveHandler._start_transaction(self, h, req)
319 return keepalive.KeepAliveHandler._start_transaction(self, h, req)
320
320
321 def https_open(self, req):
321 def https_open(self, req):
322 # req.get_full_url() does not contain credentials and we may
322 # req.get_full_url() does not contain credentials and we may
323 # need them to match the certificates.
323 # need them to match the certificates.
324 url = req.get_full_url()
324 url = req.get_full_url()
325 user, password = self.pwmgr.find_stored_password(url)
325 user, password = self.pwmgr.find_stored_password(url)
326 res = httpconnectionmod.readauthforuri(self.ui, url, user)
326 res = httpconnectionmod.readauthforuri(self.ui, url, user)
327 if res:
327 if res:
328 group, auth = res
328 group, auth = res
329 self.auth = auth
329 self.auth = auth
330 self.ui.debug("using auth.%s.* for authentication\n" % group)
330 self.ui.debug("using auth.%s.* for authentication\n" % group)
331 else:
331 else:
332 self.auth = None
332 self.auth = None
333 return self.do_open(self._makeconnection, req)
333 return self.do_open(self._makeconnection, req)
334
334
335 def _makeconnection(self, host, port=None, *args, **kwargs):
335 def _makeconnection(self, host, port=None, *args, **kwargs):
336 keyfile = None
336 keyfile = None
337 certfile = None
337 certfile = None
338
338
339 if len(args) >= 1: # key_file
339 if len(args) >= 1: # key_file
340 keyfile = args[0]
340 keyfile = args[0]
341 if len(args) >= 2: # cert_file
341 if len(args) >= 2: # cert_file
342 certfile = args[1]
342 certfile = args[1]
343 args = args[2:]
343 args = args[2:]
344
344
345 # if the user has specified different key/cert files in
345 # if the user has specified different key/cert files in
346 # hgrc, we prefer these
346 # hgrc, we prefer these
347 if self.auth and 'key' in self.auth and 'cert' in self.auth:
347 if self.auth and 'key' in self.auth and 'cert' in self.auth:
348 keyfile = self.auth['key']
348 keyfile = self.auth['key']
349 certfile = self.auth['cert']
349 certfile = self.auth['cert']
350
350
351 conn = httpsconnection(host, port, keyfile, certfile, *args,
351 conn = httpsconnection(host, port, keyfile, certfile, *args,
352 **kwargs)
352 **kwargs)
353 conn.ui = self.ui
353 conn.ui = self.ui
354 return conn
354 return conn
355
355
356 class httpdigestauthhandler(urlreq.httpdigestauthhandler):
356 class httpdigestauthhandler(urlreq.httpdigestauthhandler):
357 def __init__(self, *args, **kwargs):
357 def __init__(self, *args, **kwargs):
358 urlreq.httpdigestauthhandler.__init__(self, *args, **kwargs)
358 urlreq.httpdigestauthhandler.__init__(self, *args, **kwargs)
359 self.retried_req = None
359 self.retried_req = None
360
360
361 def reset_retry_count(self):
361 def reset_retry_count(self):
362 # Python 2.6.5 will call this on 401 or 407 errors and thus loop
362 # Python 2.6.5 will call this on 401 or 407 errors and thus loop
363 # forever. We disable reset_retry_count completely and reset in
363 # forever. We disable reset_retry_count completely and reset in
364 # http_error_auth_reqed instead.
364 # http_error_auth_reqed instead.
365 pass
365 pass
366
366
367 def http_error_auth_reqed(self, auth_header, host, req, headers):
367 def http_error_auth_reqed(self, auth_header, host, req, headers):
368 # Reset the retry counter once for each request.
368 # Reset the retry counter once for each request.
369 if req is not self.retried_req:
369 if req is not self.retried_req:
370 self.retried_req = req
370 self.retried_req = req
371 self.retried = 0
371 self.retried = 0
372 return urlreq.httpdigestauthhandler.http_error_auth_reqed(
372 return urlreq.httpdigestauthhandler.http_error_auth_reqed(
373 self, auth_header, host, req, headers)
373 self, auth_header, host, req, headers)
374
374
375 class httpbasicauthhandler(urlreq.httpbasicauthhandler):
375 class httpbasicauthhandler(urlreq.httpbasicauthhandler):
376 def __init__(self, *args, **kwargs):
376 def __init__(self, *args, **kwargs):
377 self.auth = None
377 self.auth = None
378 urlreq.httpbasicauthhandler.__init__(self, *args, **kwargs)
378 urlreq.httpbasicauthhandler.__init__(self, *args, **kwargs)
379 self.retried_req = None
379 self.retried_req = None
380
380
381 def http_request(self, request):
381 def http_request(self, request):
382 if self.auth:
382 if self.auth:
383 request.add_unredirected_header(self.auth_header, self.auth)
383 request.add_unredirected_header(self.auth_header, self.auth)
384
384
385 return request
385 return request
386
386
387 def https_request(self, request):
387 def https_request(self, request):
388 if self.auth:
388 if self.auth:
389 request.add_unredirected_header(self.auth_header, self.auth)
389 request.add_unredirected_header(self.auth_header, self.auth)
390
390
391 return request
391 return request
392
392
393 def reset_retry_count(self):
393 def reset_retry_count(self):
394 # Python 2.6.5 will call this on 401 or 407 errors and thus loop
394 # Python 2.6.5 will call this on 401 or 407 errors and thus loop
395 # forever. We disable reset_retry_count completely and reset in
395 # forever. We disable reset_retry_count completely and reset in
396 # http_error_auth_reqed instead.
396 # http_error_auth_reqed instead.
397 pass
397 pass
398
398
399 def http_error_auth_reqed(self, auth_header, host, req, headers):
399 def http_error_auth_reqed(self, auth_header, host, req, headers):
400 # Reset the retry counter once for each request.
400 # Reset the retry counter once for each request.
401 if req is not self.retried_req:
401 if req is not self.retried_req:
402 self.retried_req = req
402 self.retried_req = req
403 self.retried = 0
403 self.retried = 0
404 return urlreq.httpbasicauthhandler.http_error_auth_reqed(
404 return urlreq.httpbasicauthhandler.http_error_auth_reqed(
405 self, auth_header, host, req, headers)
405 self, auth_header, host, req, headers)
406
406
407 def retry_http_basic_auth(self, host, req, realm):
407 def retry_http_basic_auth(self, host, req, realm):
408 user, pw = self.passwd.find_user_password(realm, req.get_full_url())
408 user, pw = self.passwd.find_user_password(realm, req.get_full_url())
409 if pw is not None:
409 if pw is not None:
410 raw = "%s:%s" % (user, pw)
410 raw = "%s:%s" % (user, pw)
411 auth = 'Basic %s' % base64.b64encode(raw).strip()
411 auth = 'Basic %s' % base64.b64encode(raw).strip()
412 if req.get_header(self.auth_header, None) == auth:
412 if req.get_header(self.auth_header, None) == auth:
413 return None
413 return None
414 self.auth = auth
414 self.auth = auth
415 req.add_unredirected_header(self.auth_header, auth)
415 req.add_unredirected_header(self.auth_header, auth)
416 return self.parent.open(req)
416 return self.parent.open(req)
417 else:
417 else:
418 return None
418 return None
419
419
420 class cookiehandler(urlreq.basehandler):
421 def __init__(self, ui):
422 self.cookiejar = None
423
424 cookiefile = ui.config('auth', 'cookiefile')
425 if not cookiefile:
426 return
427
428 cookiefile = util.expandpath(cookiefile)
429 try:
430 cookiejar = util.cookielib.MozillaCookieJar(cookiefile)
431 cookiejar.load()
432 self.cookiejar = cookiejar
433 except util.cookielib.LoadError as e:
434 ui.warn(_('(error loading cookie file %s: %s; continuing without '
435 'cookies)\n') % (cookiefile, str(e)))
436
437 def http_request(self, request):
438 if self.cookiejar:
439 self.cookiejar.add_cookie_header(request)
440
441 return request
442
443 def https_request(self, request):
444 if self.cookiejar:
445 self.cookiejar.add_cookie_header(request)
446
447 return request
448
420 handlerfuncs = []
449 handlerfuncs = []
421
450
422 def opener(ui, authinfo=None):
451 def opener(ui, authinfo=None):
423 '''
452 '''
424 construct an opener suitable for urllib2
453 construct an opener suitable for urllib2
425 authinfo will be added to the password manager
454 authinfo will be added to the password manager
426 '''
455 '''
427 # experimental config: ui.usehttp2
456 # experimental config: ui.usehttp2
428 if ui.configbool('ui', 'usehttp2', False):
457 if ui.configbool('ui', 'usehttp2', False):
429 handlers = [
458 handlers = [
430 httpconnectionmod.http2handler(
459 httpconnectionmod.http2handler(
431 ui,
460 ui,
432 passwordmgr(ui, ui.httppasswordmgrdb))
461 passwordmgr(ui, ui.httppasswordmgrdb))
433 ]
462 ]
434 else:
463 else:
435 handlers = [httphandler()]
464 handlers = [httphandler()]
436 if has_https:
465 if has_https:
437 handlers.append(httpshandler(ui))
466 handlers.append(httpshandler(ui))
438
467
439 handlers.append(proxyhandler(ui))
468 handlers.append(proxyhandler(ui))
440
469
441 passmgr = passwordmgr(ui, ui.httppasswordmgrdb)
470 passmgr = passwordmgr(ui, ui.httppasswordmgrdb)
442 if authinfo is not None:
471 if authinfo is not None:
443 realm, uris, user, passwd = authinfo
472 realm, uris, user, passwd = authinfo
444 saveduser, savedpass = passmgr.find_stored_password(uris[0])
473 saveduser, savedpass = passmgr.find_stored_password(uris[0])
445 if user != saveduser or passwd:
474 if user != saveduser or passwd:
446 passmgr.add_password(realm, uris, user, passwd)
475 passmgr.add_password(realm, uris, user, passwd)
447 ui.debug('http auth: user %s, password %s\n' %
476 ui.debug('http auth: user %s, password %s\n' %
448 (user, passwd and '*' * len(passwd) or 'not set'))
477 (user, passwd and '*' * len(passwd) or 'not set'))
449
478
450 handlers.extend((httpbasicauthhandler(passmgr),
479 handlers.extend((httpbasicauthhandler(passmgr),
451 httpdigestauthhandler(passmgr)))
480 httpdigestauthhandler(passmgr)))
452 handlers.extend([h(ui, passmgr) for h in handlerfuncs])
481 handlers.extend([h(ui, passmgr) for h in handlerfuncs])
482 handlers.append(cookiehandler(ui))
453 opener = urlreq.buildopener(*handlers)
483 opener = urlreq.buildopener(*handlers)
454
484
455 # The user agent should should *NOT* be used by servers for e.g.
485 # The user agent should should *NOT* be used by servers for e.g.
456 # protocol detection or feature negotiation: there are other
486 # protocol detection or feature negotiation: there are other
457 # facilities for that.
487 # facilities for that.
458 #
488 #
459 # "mercurial/proto-1.0" was the original user agent string and
489 # "mercurial/proto-1.0" was the original user agent string and
460 # exists for backwards compatibility reasons.
490 # exists for backwards compatibility reasons.
461 #
491 #
462 # The "(Mercurial %s)" string contains the distribution
492 # The "(Mercurial %s)" string contains the distribution
463 # name and version. Other client implementations should choose their
493 # name and version. Other client implementations should choose their
464 # own distribution name. Since servers should not be using the user
494 # own distribution name. Since servers should not be using the user
465 # agent string for anything, clients should be able to define whatever
495 # agent string for anything, clients should be able to define whatever
466 # user agent they deem appropriate.
496 # user agent they deem appropriate.
467 agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version()
497 agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version()
468 opener.addheaders = [('User-agent', agent)]
498 opener.addheaders = [('User-agent', agent)]
469
499
470 # This header should only be needed by wire protocol requests. But it has
500 # This header should only be needed by wire protocol requests. But it has
471 # been sent on all requests since forever. We keep sending it for backwards
501 # been sent on all requests since forever. We keep sending it for backwards
472 # compatibility reasons. Modern versions of the wire protocol use
502 # compatibility reasons. Modern versions of the wire protocol use
473 # X-HgProto-<N> for advertising client support.
503 # X-HgProto-<N> for advertising client support.
474 opener.addheaders.append(('Accept', 'application/mercurial-0.1'))
504 opener.addheaders.append(('Accept', 'application/mercurial-0.1'))
475 return opener
505 return opener
476
506
477 def open(ui, url_, data=None):
507 def open(ui, url_, data=None):
478 u = util.url(url_)
508 u = util.url(url_)
479 if u.scheme:
509 if u.scheme:
480 u.scheme = u.scheme.lower()
510 u.scheme = u.scheme.lower()
481 url_, authinfo = u.authinfo()
511 url_, authinfo = u.authinfo()
482 else:
512 else:
483 path = util.normpath(os.path.abspath(url_))
513 path = util.normpath(os.path.abspath(url_))
484 url_ = 'file://' + urlreq.pathname2url(path)
514 url_ = 'file://' + urlreq.pathname2url(path)
485 authinfo = None
515 authinfo = None
486 return opener(ui, authinfo).open(url_, data)
516 return opener(ui, authinfo).open(url_, data)
@@ -1,335 +1,396 b''
1 #require serve
1 #require killdaemons serve
2
2
3 $ hg init test
3 $ hg init test
4 $ cd test
4 $ cd test
5 $ echo foo>foo
5 $ echo foo>foo
6 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
6 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
7 $ echo foo>foo.d/foo
7 $ echo foo>foo.d/foo
8 $ echo bar>foo.d/bAr.hg.d/BaR
8 $ echo bar>foo.d/bAr.hg.d/BaR
9 $ echo bar>foo.d/baR.d.hg/bAR
9 $ echo bar>foo.d/baR.d.hg/bAR
10 $ hg commit -A -m 1
10 $ hg commit -A -m 1
11 adding foo
11 adding foo
12 adding foo.d/bAr.hg.d/BaR
12 adding foo.d/bAr.hg.d/BaR
13 adding foo.d/baR.d.hg/bAR
13 adding foo.d/baR.d.hg/bAR
14 adding foo.d/foo
14 adding foo.d/foo
15 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
15 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid -E ../error.log
16 $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
16 $ hg serve --config server.uncompressed=False -p $HGPORT1 -d --pid-file=../hg2.pid
17
17
18 Test server address cannot be reused
18 Test server address cannot be reused
19
19
20 #if windows
20 #if windows
21 $ hg serve -p $HGPORT1 2>&1
21 $ hg serve -p $HGPORT1 2>&1
22 abort: cannot start server at 'localhost:$HGPORT1': * (glob)
22 abort: cannot start server at 'localhost:$HGPORT1': * (glob)
23 [255]
23 [255]
24 #else
24 #else
25 $ hg serve -p $HGPORT1 2>&1
25 $ hg serve -p $HGPORT1 2>&1
26 abort: cannot start server at 'localhost:$HGPORT1': Address already in use
26 abort: cannot start server at 'localhost:$HGPORT1': Address already in use
27 [255]
27 [255]
28 #endif
28 #endif
29 $ cd ..
29 $ cd ..
30 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
30 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
31
31
32 clone via stream
32 clone via stream
33
33
34 $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1
34 $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1
35 streaming all changes
35 streaming all changes
36 6 files to transfer, 606 bytes of data
36 6 files to transfer, 606 bytes of data
37 transferred * bytes in * seconds (*/sec) (glob)
37 transferred * bytes in * seconds (*/sec) (glob)
38 searching for changes
38 searching for changes
39 no changes found
39 no changes found
40 updating to branch default
40 updating to branch default
41 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
41 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 $ hg verify -R copy
42 $ hg verify -R copy
43 checking changesets
43 checking changesets
44 checking manifests
44 checking manifests
45 crosschecking files in changesets and manifests
45 crosschecking files in changesets and manifests
46 checking files
46 checking files
47 4 files, 1 changesets, 4 total revisions
47 4 files, 1 changesets, 4 total revisions
48
48
49 try to clone via stream, should use pull instead
49 try to clone via stream, should use pull instead
50
50
51 $ hg clone --uncompressed http://localhost:$HGPORT1/ copy2
51 $ hg clone --uncompressed http://localhost:$HGPORT1/ copy2
52 requesting all changes
52 requesting all changes
53 adding changesets
53 adding changesets
54 adding manifests
54 adding manifests
55 adding file changes
55 adding file changes
56 added 1 changesets with 4 changes to 4 files
56 added 1 changesets with 4 changes to 4 files
57 updating to branch default
57 updating to branch default
58 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
59
59
60 clone via pull
60 clone via pull
61
61
62 $ hg clone http://localhost:$HGPORT1/ copy-pull
62 $ hg clone http://localhost:$HGPORT1/ copy-pull
63 requesting all changes
63 requesting all changes
64 adding changesets
64 adding changesets
65 adding manifests
65 adding manifests
66 adding file changes
66 adding file changes
67 added 1 changesets with 4 changes to 4 files
67 added 1 changesets with 4 changes to 4 files
68 updating to branch default
68 updating to branch default
69 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 $ hg verify -R copy-pull
70 $ hg verify -R copy-pull
71 checking changesets
71 checking changesets
72 checking manifests
72 checking manifests
73 crosschecking files in changesets and manifests
73 crosschecking files in changesets and manifests
74 checking files
74 checking files
75 4 files, 1 changesets, 4 total revisions
75 4 files, 1 changesets, 4 total revisions
76 $ cd test
76 $ cd test
77 $ echo bar > bar
77 $ echo bar > bar
78 $ hg commit -A -d '1 0' -m 2
78 $ hg commit -A -d '1 0' -m 2
79 adding bar
79 adding bar
80 $ cd ..
80 $ cd ..
81
81
82 clone over http with --update
82 clone over http with --update
83
83
84 $ hg clone http://localhost:$HGPORT1/ updated --update 0
84 $ hg clone http://localhost:$HGPORT1/ updated --update 0
85 requesting all changes
85 requesting all changes
86 adding changesets
86 adding changesets
87 adding manifests
87 adding manifests
88 adding file changes
88 adding file changes
89 added 2 changesets with 5 changes to 5 files
89 added 2 changesets with 5 changes to 5 files
90 updating to branch default
90 updating to branch default
91 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 $ hg log -r . -R updated
92 $ hg log -r . -R updated
93 changeset: 0:8b6053c928fe
93 changeset: 0:8b6053c928fe
94 user: test
94 user: test
95 date: Thu Jan 01 00:00:00 1970 +0000
95 date: Thu Jan 01 00:00:00 1970 +0000
96 summary: 1
96 summary: 1
97
97
98 $ rm -rf updated
98 $ rm -rf updated
99
99
100 incoming via HTTP
100 incoming via HTTP
101
101
102 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
102 $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
103 adding changesets
103 adding changesets
104 adding manifests
104 adding manifests
105 adding file changes
105 adding file changes
106 added 1 changesets with 4 changes to 4 files
106 added 1 changesets with 4 changes to 4 files
107 updating to branch default
107 updating to branch default
108 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 $ cd partial
109 $ cd partial
110 $ touch LOCAL
110 $ touch LOCAL
111 $ hg ci -qAm LOCAL
111 $ hg ci -qAm LOCAL
112 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
112 $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
113 comparing with http://localhost:$HGPORT1/
113 comparing with http://localhost:$HGPORT1/
114 searching for changes
114 searching for changes
115 2
115 2
116 $ cd ..
116 $ cd ..
117
117
118 pull
118 pull
119
119
120 $ cd copy-pull
120 $ cd copy-pull
121 $ cat >> .hg/hgrc <<EOF
121 $ cat >> .hg/hgrc <<EOF
122 > [hooks]
122 > [hooks]
123 > changegroup = sh -c "printenv.py changegroup"
123 > changegroup = sh -c "printenv.py changegroup"
124 > EOF
124 > EOF
125 $ hg pull
125 $ hg pull
126 pulling from http://localhost:$HGPORT1/
126 pulling from http://localhost:$HGPORT1/
127 searching for changes
127 searching for changes
128 adding changesets
128 adding changesets
129 adding manifests
129 adding manifests
130 adding file changes
130 adding file changes
131 added 1 changesets with 1 changes to 1 files
131 added 1 changesets with 1 changes to 1 files
132 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/
132 changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/
133 (run 'hg update' to get a working copy)
133 (run 'hg update' to get a working copy)
134 $ cd ..
134 $ cd ..
135
135
136 clone from invalid URL
136 clone from invalid URL
137
137
138 $ hg clone http://localhost:$HGPORT/bad
138 $ hg clone http://localhost:$HGPORT/bad
139 abort: HTTP Error 404: Not Found
139 abort: HTTP Error 404: Not Found
140 [255]
140 [255]
141
141
142 test http authentication
142 test http authentication
143 + use the same server to test server side streaming preference
143 + use the same server to test server side streaming preference
144
144
145 $ cd test
145 $ cd test
146 $ cat << EOT > userpass.py
146 $ cat << EOT > userpass.py
147 > import base64
147 > import base64
148 > from mercurial.hgweb import common
148 > from mercurial.hgweb import common
149 > def perform_authentication(hgweb, req, op):
149 > def perform_authentication(hgweb, req, op):
150 > auth = req.env.get('HTTP_AUTHORIZATION')
150 > auth = req.env.get('HTTP_AUTHORIZATION')
151 > if not auth:
151 > if not auth:
152 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
152 > raise common.ErrorResponse(common.HTTP_UNAUTHORIZED, 'who',
153 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
153 > [('WWW-Authenticate', 'Basic Realm="mercurial"')])
154 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
154 > if base64.b64decode(auth.split()[1]).split(':', 1) != ['user', 'pass']:
155 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
155 > raise common.ErrorResponse(common.HTTP_FORBIDDEN, 'no')
156 > def extsetup():
156 > def extsetup():
157 > common.permhooks.insert(0, perform_authentication)
157 > common.permhooks.insert(0, perform_authentication)
158 > EOT
158 > EOT
159 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
159 $ hg serve --config extensions.x=userpass.py -p $HGPORT2 -d --pid-file=pid \
160 > --config server.preferuncompressed=True \
160 > --config server.preferuncompressed=True \
161 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
161 > --config web.push_ssl=False --config web.allow_push=* -A ../access.log
162 $ cat pid >> $DAEMON_PIDS
162 $ cat pid >> $DAEMON_PIDS
163
163
164 $ cat << EOF > get_pass.py
164 $ cat << EOF > get_pass.py
165 > import getpass
165 > import getpass
166 > def newgetpass(arg):
166 > def newgetpass(arg):
167 > return "pass"
167 > return "pass"
168 > getpass.getpass = newgetpass
168 > getpass.getpass = newgetpass
169 > EOF
169 > EOF
170
170
171 $ hg id http://localhost:$HGPORT2/
171 $ hg id http://localhost:$HGPORT2/
172 abort: http authorization required for http://localhost:$HGPORT2/
172 abort: http authorization required for http://localhost:$HGPORT2/
173 [255]
173 [255]
174 $ hg id http://localhost:$HGPORT2/
174 $ hg id http://localhost:$HGPORT2/
175 abort: http authorization required for http://localhost:$HGPORT2/
175 abort: http authorization required for http://localhost:$HGPORT2/
176 [255]
176 [255]
177 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
177 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
178 http authorization required for http://localhost:$HGPORT2/
178 http authorization required for http://localhost:$HGPORT2/
179 realm: mercurial
179 realm: mercurial
180 user: user
180 user: user
181 password: 5fed3813f7f5
181 password: 5fed3813f7f5
182 $ hg id http://user:pass@localhost:$HGPORT2/
182 $ hg id http://user:pass@localhost:$HGPORT2/
183 5fed3813f7f5
183 5fed3813f7f5
184 $ echo '[auth]' >> .hg/hgrc
184 $ echo '[auth]' >> .hg/hgrc
185 $ echo 'l.schemes=http' >> .hg/hgrc
185 $ echo 'l.schemes=http' >> .hg/hgrc
186 $ echo 'l.prefix=lo' >> .hg/hgrc
186 $ echo 'l.prefix=lo' >> .hg/hgrc
187 $ echo 'l.username=user' >> .hg/hgrc
187 $ echo 'l.username=user' >> .hg/hgrc
188 $ echo 'l.password=pass' >> .hg/hgrc
188 $ echo 'l.password=pass' >> .hg/hgrc
189 $ hg id http://localhost:$HGPORT2/
189 $ hg id http://localhost:$HGPORT2/
190 5fed3813f7f5
190 5fed3813f7f5
191 $ hg id http://localhost:$HGPORT2/
191 $ hg id http://localhost:$HGPORT2/
192 5fed3813f7f5
192 5fed3813f7f5
193 $ hg id http://user@localhost:$HGPORT2/
193 $ hg id http://user@localhost:$HGPORT2/
194 5fed3813f7f5
194 5fed3813f7f5
195 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
195 $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
196 streaming all changes
196 streaming all changes
197 7 files to transfer, 916 bytes of data
197 7 files to transfer, 916 bytes of data
198 transferred * bytes in * seconds (*/sec) (glob)
198 transferred * bytes in * seconds (*/sec) (glob)
199 searching for changes
199 searching for changes
200 no changes found
200 no changes found
201 updating to branch default
201 updating to branch default
202 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
203 --pull should override server's preferuncompressed
203 --pull should override server's preferuncompressed
204 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
204 $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1
205 requesting all changes
205 requesting all changes
206 adding changesets
206 adding changesets
207 adding manifests
207 adding manifests
208 adding file changes
208 adding file changes
209 added 2 changesets with 5 changes to 5 files
209 added 2 changesets with 5 changes to 5 files
210 updating to branch default
210 updating to branch default
211 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
211 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
212
212
213 $ hg id http://user2@localhost:$HGPORT2/
213 $ hg id http://user2@localhost:$HGPORT2/
214 abort: http authorization required for http://localhost:$HGPORT2/
214 abort: http authorization required for http://localhost:$HGPORT2/
215 [255]
215 [255]
216 $ hg id http://user:pass2@localhost:$HGPORT2/
216 $ hg id http://user:pass2@localhost:$HGPORT2/
217 abort: HTTP Error 403: no
217 abort: HTTP Error 403: no
218 [255]
218 [255]
219
219
220 $ hg -R dest tag -r tip top
220 $ hg -R dest tag -r tip top
221 $ hg -R dest push http://user:pass@localhost:$HGPORT2/
221 $ hg -R dest push http://user:pass@localhost:$HGPORT2/
222 pushing to http://user:***@localhost:$HGPORT2/
222 pushing to http://user:***@localhost:$HGPORT2/
223 searching for changes
223 searching for changes
224 remote: adding changesets
224 remote: adding changesets
225 remote: adding manifests
225 remote: adding manifests
226 remote: adding file changes
226 remote: adding file changes
227 remote: added 1 changesets with 1 changes to 1 files
227 remote: added 1 changesets with 1 changes to 1 files
228 $ hg rollback -q
228 $ hg rollback -q
229
229
230 $ sed 's/.*] "/"/' < ../access.log
230 $ sed 's/.*] "/"/' < ../access.log
231 "GET /?cmd=capabilities HTTP/1.1" 200 -
231 "GET /?cmd=capabilities HTTP/1.1" 200 -
232 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
232 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
233 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
233 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
234 "GET /?cmd=capabilities HTTP/1.1" 200 -
234 "GET /?cmd=capabilities HTTP/1.1" 200 -
235 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
235 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
236 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
236 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
237 "GET /?cmd=capabilities HTTP/1.1" 200 -
237 "GET /?cmd=capabilities HTTP/1.1" 200 -
238 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
238 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
239 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
239 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
240 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
240 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
241 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
241 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
242 "GET /?cmd=capabilities HTTP/1.1" 200 -
242 "GET /?cmd=capabilities HTTP/1.1" 200 -
243 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
243 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
244 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
244 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
245 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
245 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
246 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
246 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
247 "GET /?cmd=capabilities HTTP/1.1" 200 -
247 "GET /?cmd=capabilities HTTP/1.1" 200 -
248 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
248 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
249 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
249 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
250 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
250 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
251 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
251 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
252 "GET /?cmd=capabilities HTTP/1.1" 200 -
252 "GET /?cmd=capabilities HTTP/1.1" 200 -
253 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
253 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
254 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
254 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
255 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
255 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
256 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
256 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
257 "GET /?cmd=capabilities HTTP/1.1" 200 -
257 "GET /?cmd=capabilities HTTP/1.1" 200 -
258 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
258 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
259 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
259 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
260 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
260 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
261 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
261 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
262 "GET /?cmd=capabilities HTTP/1.1" 200 -
262 "GET /?cmd=capabilities HTTP/1.1" 200 -
263 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
263 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
264 "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
264 "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
265 "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
265 "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
266 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
266 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
267 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
267 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
268 "GET /?cmd=capabilities HTTP/1.1" 200 -
268 "GET /?cmd=capabilities HTTP/1.1" 200 -
269 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
269 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
270 "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
270 "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
271 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
271 "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=phases%2Cbookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
272 "GET /?cmd=capabilities HTTP/1.1" 200 -
272 "GET /?cmd=capabilities HTTP/1.1" 200 -
273 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
273 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
274 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
274 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
275 "GET /?cmd=capabilities HTTP/1.1" 200 -
275 "GET /?cmd=capabilities HTTP/1.1" 200 -
276 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
276 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
277 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
277 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
278 "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
278 "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
279 "GET /?cmd=capabilities HTTP/1.1" 200 -
279 "GET /?cmd=capabilities HTTP/1.1" 200 -
280 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
280 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
281 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
281 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
282 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
282 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
283 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
283 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
284 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
284 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
285 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
285 "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
286 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
286 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
287 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob)
287 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=666f726365* (glob)
288 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
288 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
289
289
290 $ cd ..
290 $ cd ..
291
291
292 clone of serve with repo in root and unserved subrepo (issue2970)
292 clone of serve with repo in root and unserved subrepo (issue2970)
293
293
294 $ hg --cwd test init sub
294 $ hg --cwd test init sub
295 $ echo empty > test/sub/empty
295 $ echo empty > test/sub/empty
296 $ hg --cwd test/sub add empty
296 $ hg --cwd test/sub add empty
297 $ hg --cwd test/sub commit -qm 'add empty'
297 $ hg --cwd test/sub commit -qm 'add empty'
298 $ hg --cwd test/sub tag -r 0 something
298 $ hg --cwd test/sub tag -r 0 something
299 $ echo sub = sub > test/.hgsub
299 $ echo sub = sub > test/.hgsub
300 $ hg --cwd test add .hgsub
300 $ hg --cwd test add .hgsub
301 $ hg --cwd test commit -qm 'add subrepo'
301 $ hg --cwd test commit -qm 'add subrepo'
302 $ hg clone http://localhost:$HGPORT noslash-clone
302 $ hg clone http://localhost:$HGPORT noslash-clone
303 requesting all changes
303 requesting all changes
304 adding changesets
304 adding changesets
305 adding manifests
305 adding manifests
306 adding file changes
306 adding file changes
307 added 3 changesets with 7 changes to 7 files
307 added 3 changesets with 7 changes to 7 files
308 updating to branch default
308 updating to branch default
309 abort: HTTP Error 404: Not Found
309 abort: HTTP Error 404: Not Found
310 [255]
310 [255]
311 $ hg clone http://localhost:$HGPORT/ slash-clone
311 $ hg clone http://localhost:$HGPORT/ slash-clone
312 requesting all changes
312 requesting all changes
313 adding changesets
313 adding changesets
314 adding manifests
314 adding manifests
315 adding file changes
315 adding file changes
316 added 3 changesets with 7 changes to 7 files
316 added 3 changesets with 7 changes to 7 files
317 updating to branch default
317 updating to branch default
318 abort: HTTP Error 404: Not Found
318 abort: HTTP Error 404: Not Found
319 [255]
319 [255]
320
320
321 check error log
321 check error log
322
322
323 $ cat error.log
323 $ cat error.log
324
324
325 check abort error reporting while pulling/cloning
325 check abort error reporting while pulling/cloning
326
326
327 $ $RUNTESTDIR/killdaemons.py
327 $ $RUNTESTDIR/killdaemons.py
328 $ hg -R test serve -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
328 $ hg -R test serve -p $HGPORT -d --pid-file=hg3.pid -E error.log --config extensions.crash=${TESTDIR}/crashgetbundler.py
329 $ cat hg3.pid >> $DAEMON_PIDS
329 $ cat hg3.pid >> $DAEMON_PIDS
330 $ hg clone http://localhost:$HGPORT/ abort-clone
330 $ hg clone http://localhost:$HGPORT/ abort-clone
331 requesting all changes
331 requesting all changes
332 remote: abort: this is an exercise
332 remote: abort: this is an exercise
333 abort: pull failed on remote
333 abort: pull failed on remote
334 [255]
334 [255]
335 $ cat error.log
335 $ cat error.log
336
337 corrupt cookies file should yield a warning
338
339 $ cat > $TESTTMP/cookies.txt << EOF
340 > bad format
341 > EOF
342
343 $ hg --config auth.cookiefile=$TESTTMP/cookies.txt id http://localhost:$HGPORT/
344 (error loading cookie file $TESTTMP/cookies.txt: '$TESTTMP/cookies.txt' does not look like a Netscape format cookies file; continuing without cookies)
345 56f9bc90cce6
346
347 $ killdaemons.py
348
349 Create dummy authentication handler that looks for cookies. It doesn't do anything
350 useful. It just raises an HTTP 500 with details about the Cookie request header.
351 We raise HTTP 500 because its message is printed in the abort message.
352
353 $ cat > cookieauth.py << EOF
354 > from mercurial import util
355 > from mercurial.hgweb import common
356 > def perform_authentication(hgweb, req, op):
357 > cookie = req.env.get('HTTP_COOKIE')
358 > if not cookie:
359 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'no-cookie')
360 > raise common.ErrorResponse(common.HTTP_SERVER_ERROR, 'Cookie: %s' % cookie)
361 > def extsetup():
362 > common.permhooks.insert(0, perform_authentication)
363 > EOF
364
365 $ hg serve --config extensions.cookieauth=cookieauth.py -R test -p $HGPORT -d --pid-file=pid
366 $ cat pid > $DAEMON_PIDS
367
368 Request without cookie sent should fail due to lack of cookie
369
370 $ hg id http://localhost:$HGPORT
371 abort: HTTP Error 500: no-cookie
372 [255]
373
374 Populate a cookies file
375
376 $ cat > cookies.txt << EOF
377 > # HTTP Cookie File
378 > # Expiration is 2030-01-01 at midnight
379 > .example.com TRUE / FALSE 1893456000 hgkey examplevalue
380 > EOF
381
382 Should not send a cookie for another domain
383
384 $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
385 abort: HTTP Error 500: no-cookie
386 [255]
387
388 Add a cookie entry for our test server and verify it is sent
389
390 $ cat >> cookies.txt << EOF
391 > localhost.local FALSE / FALSE 1893456000 hgkey localhostvalue
392 > EOF
393
394 $ hg --config auth.cookiefile=cookies.txt id http://localhost:$HGPORT/
395 abort: HTTP Error 500: Cookie: hgkey=localhostvalue
396 [255]
General Comments 0
You need to be logged in to leave comments. Login now