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