##// END OF EJS Templates
Document empty environment variables not being passed to hooks under Windows.
Patrick Mezard -
r4641:54b73513 default
parent child Browse files
Show More
@@ -1,534 +1,539 b''
1 1 HGRC(5)
2 2 =======
3 3 Bryan O'Sullivan <bos@serpentine.com>
4 4
5 5 NAME
6 6 ----
7 7 hgrc - configuration files for Mercurial
8 8
9 9 SYNOPSIS
10 10 --------
11 11
12 12 The Mercurial system uses a set of configuration files to control
13 13 aspects of its behaviour.
14 14
15 15 FILES
16 16 -----
17 17
18 18 Mercurial reads configuration data from several files, if they exist.
19 19 The names of these files depend on the system on which Mercurial is
20 20 installed.
21 21
22 22 (Unix) <install-root>/etc/mercurial/hgrc.d/*.rc::
23 23 (Unix) <install-root>/etc/mercurial/hgrc::
24 24 Per-installation configuration files, searched for in the
25 25 directory where Mercurial is installed. For example, if installed
26 26 in /shared/tools, Mercurial will look in
27 27 /shared/tools/etc/mercurial/hgrc. Options in these files apply to
28 28 all Mercurial commands executed by any user in any directory.
29 29
30 30 (Unix) /etc/mercurial/hgrc.d/*.rc::
31 31 (Unix) /etc/mercurial/hgrc::
32 32 (Windows) C:\Mercurial\Mercurial.ini::
33 33 Per-system configuration files, for the system on which Mercurial
34 34 is running. Options in these files apply to all Mercurial
35 35 commands executed by any user in any directory. Options in these
36 36 files override per-installation options.
37 37
38 38 (Unix) $HOME/.hgrc::
39 39 (Windows) C:\Documents and Settings\USERNAME\Mercurial.ini::
40 40 (Windows) $HOME\Mercurial.ini::
41 41 Per-user configuration file, for the user running Mercurial.
42 42 Options in this file apply to all Mercurial commands executed by
43 43 any user in any directory. Options in this file override
44 44 per-installation and per-system options.
45 45 On Windows system, one of these is chosen exclusively according
46 46 to definition of HOME environment variable.
47 47
48 48 (Unix, Windows) <repo>/.hg/hgrc::
49 49 Per-repository configuration options that only apply in a
50 50 particular repository. This file is not version-controlled, and
51 51 will not get transferred during a "clone" operation. Options in
52 52 this file override options in all other configuration files.
53 53 On Unix, most of this file will be ignored if it doesn't belong
54 54 to a trusted user or to a trusted group. See the documentation
55 55 for the trusted section below for more details.
56 56
57 57 SYNTAX
58 58 ------
59 59
60 60 A configuration file consists of sections, led by a "[section]" header
61 61 and followed by "name: value" entries; "name=value" is also accepted.
62 62
63 63 [spam]
64 64 eggs=ham
65 65 green=
66 66 eggs
67 67
68 68 Each line contains one entry. If the lines that follow are indented,
69 69 they are treated as continuations of that entry.
70 70
71 71 Leading whitespace is removed from values. Empty lines are skipped.
72 72
73 73 The optional values can contain format strings which refer to other
74 74 values in the same section, or values in a special DEFAULT section.
75 75
76 76 Lines beginning with "#" or ";" are ignored and may be used to provide
77 77 comments.
78 78
79 79 SECTIONS
80 80 --------
81 81
82 82 This section describes the different sections that may appear in a
83 83 Mercurial "hgrc" file, the purpose of each section, its possible
84 84 keys, and their possible values.
85 85
86 86 decode/encode::
87 87 Filters for transforming files on checkout/checkin. This would
88 88 typically be used for newline processing or other
89 89 localization/canonicalization of files.
90 90
91 91 Filters consist of a filter pattern followed by a filter command.
92 92 Filter patterns are globs by default, rooted at the repository
93 93 root. For example, to match any file ending in ".txt" in the root
94 94 directory only, use the pattern "*.txt". To match any file ending
95 95 in ".c" anywhere in the repository, use the pattern "**.c".
96 96
97 97 The filter command can start with a specifier, either "pipe:" or
98 98 "tempfile:". If no specifier is given, "pipe:" is used by default.
99 99
100 100 A "pipe:" command must accept data on stdin and return the
101 101 transformed data on stdout.
102 102
103 103 Pipe example:
104 104
105 105 [encode]
106 106 # uncompress gzip files on checkin to improve delta compression
107 107 # note: not necessarily a good idea, just an example
108 108 *.gz = pipe: gunzip
109 109
110 110 [decode]
111 111 # recompress gzip files when writing them to the working dir (we
112 112 # can safely omit "pipe:", because it's the default)
113 113 *.gz = gzip
114 114
115 115 A "tempfile:" command is a template. The string INFILE is replaced
116 116 with the name of a temporary file that contains the data to be
117 117 filtered by the command. The string OUTFILE is replaced with the
118 118 name of an empty temporary file, where the filtered data must be
119 119 written by the command.
120 120
121 121 NOTE: the tempfile mechanism is recommended for Windows systems,
122 122 where the standard shell I/O redirection operators often have
123 123 strange effects. In particular, if you are doing line ending
124 124 conversion on Windows using the popular dos2unix and unix2dos
125 125 programs, you *must* use the tempfile mechanism, as using pipes will
126 126 corrupt the contents of your files.
127 127
128 128 Tempfile example:
129 129
130 130 [encode]
131 131 # convert files to unix line ending conventions on checkin
132 132 **.txt = tempfile: dos2unix -n INFILE OUTFILE
133 133
134 134 [decode]
135 135 # convert files to windows line ending conventions when writing
136 136 # them to the working dir
137 137 **.txt = tempfile: unix2dos -n INFILE OUTFILE
138 138
139 139 defaults::
140 140 Use the [defaults] section to define command defaults, i.e. the
141 141 default options/arguments to pass to the specified commands.
142 142
143 143 The following example makes 'hg log' run in verbose mode, and
144 144 'hg status' show only the modified files, by default.
145 145
146 146 [defaults]
147 147 log = -v
148 148 status = -m
149 149
150 150 The actual commands, instead of their aliases, must be used when
151 151 defining command defaults. The command defaults will also be
152 152 applied to the aliases of the commands defined.
153 153
154 154 diff::
155 155 Settings used when displaying diffs. They are all boolean and
156 156 defaults to False.
157 157 git;;
158 158 Use git extended diff format.
159 159 nodates;;
160 160 Don't include dates in diff headers.
161 161 showfunc;;
162 162 Show which function each change is in.
163 163 ignorews;;
164 164 Ignore white space when comparing lines.
165 165 ignorewsamount;;
166 166 Ignore changes in the amount of white space.
167 167 ignoreblanklines;;
168 168 Ignore changes whose lines are all blank.
169 169
170 170 email::
171 171 Settings for extensions that send email messages.
172 172 from;;
173 173 Optional. Email address to use in "From" header and SMTP envelope
174 174 of outgoing messages.
175 175 to;;
176 176 Optional. Comma-separated list of recipients' email addresses.
177 177 cc;;
178 178 Optional. Comma-separated list of carbon copy recipients'
179 179 email addresses.
180 180 bcc;;
181 181 Optional. Comma-separated list of blind carbon copy
182 182 recipients' email addresses. Cannot be set interactively.
183 183 method;;
184 184 Optional. Method to use to send email messages. If value is
185 185 "smtp" (default), use SMTP (see section "[smtp]" for
186 186 configuration). Otherwise, use as name of program to run that
187 187 acts like sendmail (takes "-f" option for sender, list of
188 188 recipients on command line, message on stdin). Normally, setting
189 189 this to "sendmail" or "/usr/sbin/sendmail" is enough to use
190 190 sendmail to send messages.
191 191
192 192 Email example:
193 193
194 194 [email]
195 195 from = Joseph User <joe.user@example.com>
196 196 method = /usr/sbin/sendmail
197 197
198 198 extensions::
199 199 Mercurial has an extension mechanism for adding new features. To
200 200 enable an extension, create an entry for it in this section.
201 201
202 202 If you know that the extension is already in Python's search path,
203 203 you can give the name of the module, followed by "=", with nothing
204 204 after the "=".
205 205
206 206 Otherwise, give a name that you choose, followed by "=", followed by
207 207 the path to the ".py" file (including the file name extension) that
208 208 defines the extension.
209 209
210 210 Example for ~/.hgrc:
211 211
212 212 [extensions]
213 213 # (the mq extension will get loaded from mercurial's path)
214 214 hgext.mq =
215 215 # (this extension will get loaded from the file specified)
216 216 myfeature = ~/.hgext/myfeature.py
217 217
218 218 hooks::
219 219 Commands or Python functions that get automatically executed by
220 220 various actions such as starting or finishing a commit. Multiple
221 221 hooks can be run for the same action by appending a suffix to the
222 222 action. Overriding a site-wide hook can be done by changing its
223 223 value or setting it to an empty string.
224 224
225 225 Example .hg/hgrc:
226 226
227 227 [hooks]
228 228 # do not use the site-wide hook
229 229 incoming =
230 230 incoming.email = /my/email/hook
231 231 incoming.autobuild = /my/build/hook
232 232
233 233 Most hooks are run with environment variables set that give added
234 234 useful information. For each hook below, the environment variables
235 235 it is passed are listed with names of the form "$HG_foo".
236 236
237 237 changegroup;;
238 238 Run after a changegroup has been added via push, pull or
239 239 unbundle. ID of the first new changeset is in $HG_NODE. URL from
240 240 which changes came is in $HG_URL.
241 241 commit;;
242 242 Run after a changeset has been created in the local repository.
243 243 ID of the newly created changeset is in $HG_NODE. Parent
244 244 changeset IDs are in $HG_PARENT1 and $HG_PARENT2.
245 245 incoming;;
246 246 Run after a changeset has been pulled, pushed, or unbundled into
247 247 the local repository. The ID of the newly arrived changeset is in
248 248 $HG_NODE. URL that was source of changes came is in $HG_URL.
249 249 outgoing;;
250 250 Run after sending changes from local repository to another. ID of
251 251 first changeset sent is in $HG_NODE. Source of operation is in
252 252 $HG_SOURCE; see "preoutgoing" hook for description.
253 253 prechangegroup;;
254 254 Run before a changegroup is added via push, pull or unbundle.
255 255 Exit status 0 allows the changegroup to proceed. Non-zero status
256 256 will cause the push, pull or unbundle to fail. URL from which
257 257 changes will come is in $HG_URL.
258 258 precommit;;
259 259 Run before starting a local commit. Exit status 0 allows the
260 260 commit to proceed. Non-zero status will cause the commit to fail.
261 261 Parent changeset IDs are in $HG_PARENT1 and $HG_PARENT2.
262 262 preoutgoing;;
263 263 Run before computing changes to send from the local repository to
264 264 another. Non-zero status will cause failure. This lets you
265 265 prevent pull over http or ssh. Also prevents against local pull,
266 266 push (outbound) or bundle commands, but not effective, since you
267 267 can just copy files instead then. Source of operation is in
268 268 $HG_SOURCE. If "serve", operation is happening on behalf of
269 269 remote ssh or http repository. If "push", "pull" or "bundle",
270 270 operation is happening on behalf of repository on same system.
271 271 pretag;;
272 272 Run before creating a tag. Exit status 0 allows the tag to be
273 273 created. Non-zero status will cause the tag to fail. ID of
274 274 changeset to tag is in $HG_NODE. Name of tag is in $HG_TAG. Tag
275 275 is local if $HG_LOCAL=1, in repo if $HG_LOCAL=0.
276 276 pretxnchangegroup;;
277 277 Run after a changegroup has been added via push, pull or unbundle,
278 278 but before the transaction has been committed. Changegroup is
279 279 visible to hook program. This lets you validate incoming changes
280 280 before accepting them. Passed the ID of the first new changeset
281 281 in $HG_NODE. Exit status 0 allows the transaction to commit.
282 282 Non-zero status will cause the transaction to be rolled back and
283 283 the push, pull or unbundle will fail. URL that was source of
284 284 changes is in $HG_URL.
285 285 pretxncommit;;
286 286 Run after a changeset has been created but the transaction not yet
287 287 committed. Changeset is visible to hook program. This lets you
288 288 validate commit message and changes. Exit status 0 allows the
289 289 commit to proceed. Non-zero status will cause the transaction to
290 290 be rolled back. ID of changeset is in $HG_NODE. Parent changeset
291 291 IDs are in $HG_PARENT1 and $HG_PARENT2.
292 292 preupdate;;
293 293 Run before updating the working directory. Exit status 0 allows
294 294 the update to proceed. Non-zero status will prevent the update.
295 295 Changeset ID of first new parent is in $HG_PARENT1. If merge, ID
296 296 of second new parent is in $HG_PARENT2.
297 297 tag;;
298 298 Run after a tag is created. ID of tagged changeset is in
299 299 $HG_NODE. Name of tag is in $HG_TAG. Tag is local if
300 300 $HG_LOCAL=1, in repo if $HG_LOCAL=0.
301 301 update;;
302 302 Run after updating the working directory. Changeset ID of first
303 303 new parent is in $HG_PARENT1. If merge, ID of second new parent
304 304 is in $HG_PARENT2. If update succeeded, $HG_ERROR=0. If update
305 305 failed (e.g. because conflicts not resolved), $HG_ERROR=1.
306 306
307 307 Note: In earlier releases, the names of hook environment variables
308 308 did not have a "HG_" prefix. The old unprefixed names are no longer
309 309 provided in the environment.
310 310
311 Note2: Environment variables with empty values may not be passed to
312 hooks on platforms like Windows. For instance, $HG_PARENT2 will
313 not be available under Windows for non-merge changesets while being
314 set to an empty value under Unix-like systems.
315
311 316 The syntax for Python hooks is as follows:
312 317
313 318 hookname = python:modulename.submodule.callable
314 319
315 320 Python hooks are run within the Mercurial process. Each hook is
316 321 called with at least three keyword arguments: a ui object (keyword
317 322 "ui"), a repository object (keyword "repo"), and a "hooktype"
318 323 keyword that tells what kind of hook is used. Arguments listed as
319 324 environment variables above are passed as keyword arguments, with no
320 325 "HG_" prefix, and names in lower case.
321 326
322 327 If a Python hook returns a "true" value or raises an exception, this
323 328 is treated as failure of the hook.
324 329
325 330 http_proxy::
326 331 Used to access web-based Mercurial repositories through a HTTP
327 332 proxy.
328 333 host;;
329 334 Host name and (optional) port of the proxy server, for example
330 335 "myproxy:8000".
331 336 no;;
332 337 Optional. Comma-separated list of host names that should bypass
333 338 the proxy.
334 339 passwd;;
335 340 Optional. Password to authenticate with at the proxy server.
336 341 user;;
337 342 Optional. User name to authenticate with at the proxy server.
338 343
339 344 smtp::
340 345 Configuration for extensions that need to send email messages.
341 346 host;;
342 347 Host name of mail server, e.g. "mail.example.com".
343 348 port;;
344 349 Optional. Port to connect to on mail server. Default: 25.
345 350 tls;;
346 351 Optional. Whether to connect to mail server using TLS. True or
347 352 False. Default: False.
348 353 username;;
349 354 Optional. User name to authenticate to SMTP server with.
350 355 If username is specified, password must also be specified.
351 356 Default: none.
352 357 password;;
353 358 Optional. Password to authenticate to SMTP server with.
354 359 If username is specified, password must also be specified.
355 360 Default: none.
356 361 local_hostname;;
357 362 Optional. It's the hostname that the sender can use to identify itself
358 363 to the MTA.
359 364
360 365 paths::
361 366 Assigns symbolic names to repositories. The left side is the
362 367 symbolic name, and the right gives the directory or URL that is the
363 368 location of the repository. Default paths can be declared by
364 369 setting the following entries.
365 370 default;;
366 371 Directory or URL to use when pulling if no source is specified.
367 372 Default is set to repository from which the current repository
368 373 was cloned.
369 374 default-push;;
370 375 Optional. Directory or URL to use when pushing if no destination
371 376 is specified.
372 377
373 378 server::
374 379 Controls generic server settings.
375 380 uncompressed;;
376 381 Whether to allow clients to clone a repo using the uncompressed
377 382 streaming protocol. This transfers about 40% more data than a
378 383 regular clone, but uses less memory and CPU on both server and
379 384 client. Over a LAN (100Mbps or better) or a very fast WAN, an
380 385 uncompressed streaming clone is a lot faster (~10x) than a regular
381 386 clone. Over most WAN connections (anything slower than about
382 387 6Mbps), uncompressed streaming is slower, because of the extra
383 388 data transfer overhead. Default is False.
384 389
385 390 trusted::
386 391 For security reasons, Mercurial will not use the settings in
387 392 the .hg/hgrc file from a repository if it doesn't belong to a
388 393 trusted user or to a trusted group. The main exception is the
389 394 web interface, which automatically uses some safe settings, since
390 395 it's common to serve repositories from different users.
391 396
392 397 This section specifies what users and groups are trusted. The
393 398 current user is always trusted. To trust everybody, list a user
394 399 or a group with name "*".
395 400
396 401 users;;
397 402 Comma-separated list of trusted users.
398 403 groups;;
399 404 Comma-separated list of trusted groups.
400 405
401 406 ui::
402 407 User interface controls.
403 408 debug;;
404 409 Print debugging information. True or False. Default is False.
405 410 editor;;
406 411 The editor to use during a commit. Default is $EDITOR or "vi".
407 412 fallbackencoding;;
408 413 Encoding to try if it's not possible to decode the changelog using
409 414 UTF-8. Default is ISO-8859-1.
410 415 ignore;;
411 416 A file to read per-user ignore patterns from. This file should be in
412 417 the same format as a repository-wide .hgignore file. This option
413 418 supports hook syntax, so if you want to specify multiple ignore
414 419 files, you can do so by setting something like
415 420 "ignore.other = ~/.hgignore2". For details of the ignore file
416 421 format, see the hgignore(5) man page.
417 422 interactive;;
418 423 Allow to prompt the user. True or False. Default is True.
419 424 logtemplate;;
420 425 Template string for commands that print changesets.
421 426 style;;
422 427 Name of style to use for command output.
423 428 merge;;
424 429 The conflict resolution program to use during a manual merge.
425 430 Default is "hgmerge".
426 431 quiet;;
427 432 Reduce the amount of output printed. True or False. Default is False.
428 433 remotecmd;;
429 434 remote command to use for clone/push/pull operations. Default is 'hg'.
430 435 ssh;;
431 436 command to use for SSH connections. Default is 'ssh'.
432 437 strict;;
433 438 Require exact command names, instead of allowing unambiguous
434 439 abbreviations. True or False. Default is False.
435 440 timeout;;
436 441 The timeout used when a lock is held (in seconds), a negative value
437 442 means no timeout. Default is 600.
438 443 username;;
439 444 The committer of a changeset created when running "commit".
440 445 Typically a person's name and email address, e.g. "Fred Widget
441 446 <fred@example.com>". Default is $EMAIL or username@hostname.
442 447 If the username in hgrc is empty, it has to be specified manually or
443 448 in a different hgrc file (e.g. $HOME/.hgrc, if the admin set "username ="
444 449 in the system hgrc).
445 450 verbose;;
446 451 Increase the amount of output printed. True or False. Default is False.
447 452
448 453
449 454 web::
450 455 Web interface configuration.
451 456 accesslog;;
452 457 Where to output the access log. Default is stdout.
453 458 address;;
454 459 Interface address to bind to. Default is all.
455 460 allow_archive;;
456 461 List of archive format (bz2, gz, zip) allowed for downloading.
457 462 Default is empty.
458 463 allowbz2;;
459 464 (DEPRECATED) Whether to allow .tar.bz2 downloading of repo revisions.
460 465 Default is false.
461 466 allowgz;;
462 467 (DEPRECATED) Whether to allow .tar.gz downloading of repo revisions.
463 468 Default is false.
464 469 allowpull;;
465 470 Whether to allow pulling from the repository. Default is true.
466 471 allow_push;;
467 472 Whether to allow pushing to the repository. If empty or not set,
468 473 push is not allowed. If the special value "*", any remote user
469 474 can push, including unauthenticated users. Otherwise, the remote
470 475 user must have been authenticated, and the authenticated user name
471 476 must be present in this list (separated by whitespace or ",").
472 477 The contents of the allow_push list are examined after the
473 478 deny_push list.
474 479 allowzip;;
475 480 (DEPRECATED) Whether to allow .zip downloading of repo revisions.
476 481 Default is false. This feature creates temporary files.
477 482 baseurl;;
478 483 Base URL to use when publishing URLs in other locations, so
479 484 third-party tools like email notification hooks can construct URLs.
480 485 Example: "http://hgserver/repos/"
481 486 contact;;
482 487 Name or email address of the person in charge of the repository.
483 488 Default is "unknown".
484 489 deny_push;;
485 490 Whether to deny pushing to the repository. If empty or not set,
486 491 push is not denied. If the special value "*", all remote users
487 492 are denied push. Otherwise, unauthenticated users are all denied,
488 493 and any authenticated user name present in this list (separated by
489 494 whitespace or ",") is also denied. The contents of the deny_push
490 495 list are examined before the allow_push list.
491 496 description;;
492 497 Textual description of the repository's purpose or contents.
493 498 Default is "unknown".
494 499 errorlog;;
495 500 Where to output the error log. Default is stderr.
496 501 ipv6;;
497 502 Whether to use IPv6. Default is false.
498 503 name;;
499 504 Repository name to use in the web interface. Default is current
500 505 working directory.
501 506 maxchanges;;
502 507 Maximum number of changes to list on the changelog. Default is 10.
503 508 maxfiles;;
504 509 Maximum number of files to list per changeset. Default is 10.
505 510 port;;
506 511 Port to listen on. Default is 8000.
507 512 push_ssl;;
508 513 Whether to require that inbound pushes be transported over SSL to
509 514 prevent password sniffing. Default is true.
510 515 stripes;;
511 516 How many lines a "zebra stripe" should span in multiline output.
512 517 Default is 1; set to 0 to disable.
513 518 style;;
514 519 Which template map style to use.
515 520 templates;;
516 521 Where to find the HTML templates. Default is install path.
517 522
518 523
519 524 AUTHOR
520 525 ------
521 526 Bryan O'Sullivan <bos@serpentine.com>.
522 527
523 528 Mercurial was written by Matt Mackall <mpm@selenic.com>.
524 529
525 530 SEE ALSO
526 531 --------
527 532 hg(1), hgignore(5)
528 533
529 534 COPYING
530 535 -------
531 536 This manual page is copyright 2005 Bryan O'Sullivan.
532 537 Mercurial is copyright 2005, 2006 Matt Mackall.
533 538 Free use of this software is granted under the terms of the GNU General
534 539 Public License (GPL).
General Comments 0
You need to be logged in to leave comments. Login now