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