Mercurial reads configuration data from several files, if they exist. The names of these files depend on the system on which Mercurial is installed. *.rc files from a single directory are read in alphabetical order, later ones overriding earlier ones. Where multiple paths are given below, settings from later paths override earlier ones.
Per\-installation configuration files, searched for in the directory where Mercurial is installed. <install\-root> is the parent directory of the hg executable (or symlink) being run. For example, if installed in /shared/tools/bin/hg, Mercurial will look in /shared/tools/etc/mercurial/hgrc. Options in these files apply to all Mercurial commands executed by any user in any directory.
Per\-system configuration files, for the system on which Mercurial is running. Options in these files apply to all Mercurial commands executed by any user in any directory. Options in these files override per\-installation options.
Per\-installation/system configuration files, for the system on which Mercurial is running. Options in these files apply to all Mercurial commands executed by any user in any directory. Registry keys contain PATH\-like strings, every part of which must reference a Mercurial.ini file or be a directory where *.rc files will be read.
Per\-user configuration file(s), for the user running Mercurial. On Windows 9x, %HOME% is replaced by %APPDATA%. Options in these files apply to all Mercurial commands executed by this user in any directory. Options in thes files override per\-installation and per\-system options.
Per\-repository configuration options that only apply in a particular repository. This file is not version\-controlled, and will not get transferred during a "clone" operation. Options in this file override options in all other configuration files. On Unix, most of this file will be ignored if it doesn\'t belong to a trusted user or to a trusted group. See the documentation for the trusted section below for more details.
This section describes the different sections that may appear in a Mercurial "hgrc" file, the purpose of each section, its possible keys, and their possible values.
Filters for transforming files on checkout/checkin. This would typically be used for newline processing or other localization/canonicalization of files.
Optional. Method to use to send email messages. If value is "smtp" (default), use SMTP (see section "[smtp]" for configuration). Otherwise, use as name of program to run that acts like sendmail (takes "\-f" option for sender, list of recipients on command line, message on stdin). Normally, setting this to "sendmail" or "/usr/sbin/sendmail" is enough to use sendmail to send messages.
Enable or disable the "store" repository format which improves compatibility with systems that fold case or otherwise mangle filenames. Enabled by default. Disabling this option will allow you to store longer filenames in some situations at the expense of compatibility.
This section specifies merge tools to associate with particular file patterns. Tools matched here will take precedence over the default merge tool. Patterns are globs by default, rooted at the repository root.
Commands or Python functions that get automatically executed by various actions such as starting or finishing a commit. Multiple hooks can be run for the same action by appending a suffix to the action. Overriding a site\-wide hook can be done by changing its value or setting it to an empty string.
Run after a changegroup has been added via push, pull or unbundle. ID of the first new changeset is in $HG_NODE. URL from which changes came is in $HG_URL.
Run after a changeset has been created in the local repository. ID of the newly created changeset is in $HG_NODE. Parent changeset IDs are in $HG_PARENT1 and $HG_PARENT2.
Run after a changeset has been pulled, pushed, or unbundled into the local repository. The ID of the newly arrived changeset is in $HG_NODE. URL that was source of changes came is in $HG_URL.
Run after sending changes from local repository to another. ID of first changeset sent is in $HG_NODE. Source of operation is in $HG_SOURCE; see "preoutgoing" hook for description.
Run after successful invocations of the associated command. The contents of the command line are passed as $HG_ARGS and the result code in $HG_RESULT. Hook failure is ignored.
Run before executing the associated command. The contents of the command line are passed as $HG_ARGS. If the hook returns failure, the command doesn\'t execute and Mercurial returns the failure code.
Run before a changegroup is added via push, pull or unbundle. Exit status 0 allows the changegroup to proceed. Non\-zero status will cause the push, pull or unbundle to fail. URL from which changes will come is in $HG_URL.
Run before starting a local commit. Exit status 0 allows the commit to proceed. Non\-zero status will cause the commit to fail. Parent changeset IDs are in $HG_PARENT1 and $HG_PARENT2.
Run before collecting changes to send from the local repository to another. Non\-zero status will cause failure. This lets you prevent pull over http or ssh. Also prevents against local pull, push (outbound) or bundle commands, but not effective, since you can just copy files instead then. Source of operation is in $HG_SOURCE. If "serve", operation is happening on behalf of remote ssh or http repository. If "push", "pull" or "bundle", operation is happening on behalf of repository on same system.
Run before creating a tag. Exit status 0 allows the tag to be created. Non\-zero status will cause the tag to fail. ID of changeset to tag is in $HG_NODE. Name of tag is in $HG_TAG. Tag is local if $HG_LOCAL=1, in repo if $HG_LOCAL=0.
Run after a changegroup has been added via push, pull or unbundle, but before the transaction has been committed. Changegroup is visible to hook program. This lets you validate incoming changes before accepting them. Passed the ID of the first new changeset in $HG_NODE. Exit status 0 allows the transaction to commit. Non\-zero status will cause the transaction to be rolled back and the push, pull or unbundle will fail. URL that was source of changes is in $HG_URL.
Run after a changeset has been created but the transaction not yet committed. Changeset is visible to hook program. This lets you validate commit message and changes. Exit status 0 allows the commit to proceed. Non\-zero status will cause the transaction to be rolled back. ID of changeset is in $HG_NODE. Parent changeset IDs are in $HG_PARENT1 and $HG_PARENT2.
Run before updating the working directory. Exit status 0 allows the update to proceed. Non\-zero status will prevent the update. Changeset ID of first new parent is in $HG_PARENT1. If merge, ID of second new parent is in $HG_PARENT2.
Run after updating the working directory. Changeset ID of first new parent is in $HG_PARENT1. If merge, ID of second new parent is in $HG_PARENT2. If update succeeded, $HG_ERROR=0. If update failed (e.g. because conflicts not resolved), $HG_ERROR=1.
Assigns symbolic names to repositories. The left side is the symbolic name, and the right gives the directory or URL that is the location of the repository. Default paths can be declared by setting the following entries.
Whether to allow clients to clone a repo using the uncompressed streaming protocol. This transfers about 40% more data than a regular clone, but uses less memory and CPU on both server and client. Over a LAN (100Mbps or better) or a very fast WAN, an uncompressed streaming clone is a lot faster (~10x) than a regular clone. Over most WAN connections (anything slower than about 6Mbps), uncompressed streaming is slower, because of the extra data transfer overhead. Default is False.
For security reasons, Mercurial will not use the settings in the .hg/hgrc file from a repository if it doesn\'t belong to a trusted user or to a trusted group. The main exception is the web interface, which automatically uses some safe settings, since it\'s common to serve repositories from different users.
Whether to include the .hg_archival.txt file containing metadata (hashes for the repository base and for tip) in archives created by the hg archive command or downloaded via hgweb. Default is true.
A file to read per\-user ignore patterns from. This file should be in the same format as a repository\-wide .hgignore file. This option supports hook syntax, so if you want to specify multiple ignore files, you can do so by setting something like "ignore.other = ~/.hgignore2". For details of the ignore file format, see the
Whether to allow pushing to the repository. If empty or not set, push is not allowed. If the special value "*", any remote user can push, including unauthenticated users. Otherwise, the remote user must have been authenticated, and the authenticated user name must be present in this list (separated by whitespace or ","). The contents of the allow_push list are examined after the deny_push list.
Base URL to use when publishing URLs in other locations, so third\-party tools like email notification hooks can construct URLs. Example: "http://hgserver/repos/"
Whether to deny pushing to the repository. If empty or not set, push is not denied. If the special value "*", all remote users are denied push. Otherwise, unauthenticated users are all denied, and any authenticated user name present in this list (separated by whitespace or ",") is also denied. The contents of the deny_push list are examined before the allow_push list.
Base URL to use for static files. If unset, static files (e.g. the hgicon.png favicon) will be served by the CGI script itself. Use this setting to serve them directly with the HTTP server. Example: "http://hgserver/static/"
This manual page is copyright 2005 Bryan O\'Sullivan. Mercurial is copyright 2005\-2007 Matt Mackall. Free use of this software is granted under the terms of the GNU General Public License (GPL).