Show More
@@ -1,1099 +1,1099 | |||||
1 | ====== |
|
1 | ====== | |
2 | hgrc |
|
2 | hgrc | |
3 | ====== |
|
3 | ====== | |
4 |
|
4 | |||
5 | --------------------------------- |
|
5 | --------------------------------- | |
6 | configuration files for Mercurial |
|
6 | configuration files for Mercurial | |
7 | --------------------------------- |
|
7 | --------------------------------- | |
8 |
|
8 | |||
9 | :Author: Bryan O'Sullivan <bos@serpentine.com> |
|
9 | :Author: Bryan O'Sullivan <bos@serpentine.com> | |
10 | :Organization: Mercurial |
|
10 | :Organization: Mercurial | |
11 | :Manual section: 5 |
|
11 | :Manual section: 5 | |
12 | :Manual group: Mercurial Manual |
|
12 | :Manual group: Mercurial Manual | |
13 |
|
13 | |||
14 | .. contents:: |
|
14 | .. contents:: | |
15 | :backlinks: top |
|
15 | :backlinks: top | |
16 | :class: htmlonly |
|
16 | :class: htmlonly | |
17 |
|
17 | |||
18 |
|
18 | |||
19 | Synopsis |
|
19 | Synopsis | |
20 | -------- |
|
20 | -------- | |
21 |
|
21 | |||
22 | The Mercurial system uses a set of configuration files to control |
|
22 | The Mercurial system uses a set of configuration files to control | |
23 | aspects of its behavior. |
|
23 | aspects of its behavior. | |
24 |
|
24 | |||
25 | Files |
|
25 | Files | |
26 | ----- |
|
26 | ----- | |
27 |
|
27 | |||
28 | Mercurial reads configuration data from several files, if they exist. |
|
28 | Mercurial reads configuration data from several files, if they exist. | |
29 | The names of these files depend on the system on which Mercurial is |
|
29 | The names of these files depend on the system on which Mercurial is | |
30 | installed. ``*.rc`` files from a single directory are read in |
|
30 | installed. ``*.rc`` files from a single directory are read in | |
31 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
31 | alphabetical order, later ones overriding earlier ones. Where multiple | |
32 | paths are given below, settings from earlier paths override later |
|
32 | paths are given below, settings from earlier paths override later | |
33 | ones. |
|
33 | ones. | |
34 |
|
34 | |||
35 | | (Unix, Windows) ``<repo>/.hg/hgrc`` |
|
35 | | (Unix, Windows) ``<repo>/.hg/hgrc`` | |
36 |
|
36 | |||
37 | Per-repository configuration options that only apply in a |
|
37 | Per-repository configuration options that only apply in a | |
38 | particular repository. This file is not version-controlled, and |
|
38 | particular repository. This file is not version-controlled, and | |
39 | will not get transferred during a "clone" operation. Options in |
|
39 | will not get transferred during a "clone" operation. Options in | |
40 | this file override options in all other configuration files. On |
|
40 | this file override options in all other configuration files. On | |
41 | Unix, most of this file will be ignored if it doesn't belong to a |
|
41 | Unix, most of this file will be ignored if it doesn't belong to a | |
42 | trusted user or to a trusted group. See the documentation for the |
|
42 | trusted user or to a trusted group. See the documentation for the | |
43 | trusted_ section below for more details. |
|
43 | trusted_ section below for more details. | |
44 |
|
44 | |||
45 | | (Unix) ``$HOME/.hgrc`` |
|
45 | | (Unix) ``$HOME/.hgrc`` | |
46 | | (Windows) ``%USERPROFILE%\.hgrc`` |
|
46 | | (Windows) ``%USERPROFILE%\.hgrc`` | |
47 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` |
|
47 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` | |
48 | | (Windows) ``%HOME%\.hgrc`` |
|
48 | | (Windows) ``%HOME%\.hgrc`` | |
49 | | (Windows) ``%HOME%\Mercurial.ini`` |
|
49 | | (Windows) ``%HOME%\Mercurial.ini`` | |
50 |
|
50 | |||
51 | Per-user configuration file(s), for the user running Mercurial. On |
|
51 | Per-user configuration file(s), for the user running Mercurial. On | |
52 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these |
|
52 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these | |
53 | files apply to all Mercurial commands executed by this user in any |
|
53 | files apply to all Mercurial commands executed by this user in any | |
54 | directory. Options in these files override per-system and per-installation |
|
54 | directory. Options in these files override per-system and per-installation | |
55 | options. |
|
55 | options. | |
56 |
|
56 | |||
57 | | (Unix) ``/etc/mercurial/hgrc`` |
|
57 | | (Unix) ``/etc/mercurial/hgrc`` | |
58 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` |
|
58 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` | |
59 |
|
59 | |||
60 | Per-system configuration files, for the system on which Mercurial |
|
60 | Per-system configuration files, for the system on which Mercurial | |
61 | is running. Options in these files apply to all Mercurial commands |
|
61 | is running. Options in these files apply to all Mercurial commands | |
62 | executed by any user in any directory. Options in these files |
|
62 | executed by any user in any directory. Options in these files | |
63 | override per-installation options. |
|
63 | override per-installation options. | |
64 |
|
64 | |||
65 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` |
|
65 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` | |
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` |
|
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` | |
67 |
|
67 | |||
68 | Per-installation configuration files, searched for in the |
|
68 | Per-installation configuration files, searched for in the | |
69 | directory where Mercurial is installed. ``<install-root>`` is the |
|
69 | directory where Mercurial is installed. ``<install-root>`` is the | |
70 | parent directory of the **hg** executable (or symlink) being run. For |
|
70 | parent directory of the **hg** executable (or symlink) being run. For | |
71 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look |
|
71 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look | |
72 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply |
|
72 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply | |
73 | to all Mercurial commands executed by any user in any directory. |
|
73 | to all Mercurial commands executed by any user in any directory. | |
74 |
|
74 | |||
75 | | (Windows) ``<install-dir>\Mercurial.ini`` |
|
75 | | (Windows) ``<install-dir>\Mercurial.ini`` | |
76 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` |
|
76 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` | |
77 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` |
|
77 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` | |
78 |
|
78 | |||
79 | Per-installation/system configuration files, for the system on |
|
79 | Per-installation/system configuration files, for the system on | |
80 | which Mercurial is running. Options in these files apply to all |
|
80 | which Mercurial is running. Options in these files apply to all | |
81 | Mercurial commands executed by any user in any directory. Registry |
|
81 | Mercurial commands executed by any user in any directory. Registry | |
82 | keys contain PATH-like strings, every part of which must reference |
|
82 | keys contain PATH-like strings, every part of which must reference | |
83 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
83 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
84 | be read. Mercurial checks each of these locations in the specified |
|
84 | be read. Mercurial checks each of these locations in the specified | |
85 | order until one or more configuration files are detected. If the |
|
85 | order until one or more configuration files are detected. If the | |
86 | pywin32 extensions are not installed, Mercurial will only look for |
|
86 | pywin32 extensions are not installed, Mercurial will only look for | |
87 | site-wide configuration in ``C:\Mercurial\Mercurial.ini``. |
|
87 | site-wide configuration in ``C:\Mercurial\Mercurial.ini``. | |
88 |
|
88 | |||
89 | Syntax |
|
89 | Syntax | |
90 | ------ |
|
90 | ------ | |
91 |
|
91 | |||
92 | A configuration file consists of sections, led by a ``[section]`` header |
|
92 | A configuration file consists of sections, led by a ``[section]`` header | |
93 | and followed by ``name = value`` entries (sometimes called |
|
93 | and followed by ``name = value`` entries (sometimes called | |
94 | ``configuration keys``):: |
|
94 | ``configuration keys``):: | |
95 |
|
95 | |||
96 | [spam] |
|
96 | [spam] | |
97 | eggs=ham |
|
97 | eggs=ham | |
98 | green= |
|
98 | green= | |
99 | eggs |
|
99 | eggs | |
100 |
|
100 | |||
101 | Each line contains one entry. If the lines that follow are indented, |
|
101 | Each line contains one entry. If the lines that follow are indented, | |
102 | they are treated as continuations of that entry. Leading whitespace is |
|
102 | they are treated as continuations of that entry. Leading whitespace is | |
103 | removed from values. Empty lines are skipped. Lines beginning with |
|
103 | removed from values. Empty lines are skipped. Lines beginning with | |
104 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
104 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
105 |
|
105 | |||
106 | Configuration keys can be set multiple times, in which case mercurial |
|
106 | Configuration keys can be set multiple times, in which case mercurial | |
107 | will use the value that was configured last. As an example:: |
|
107 | will use the value that was configured last. As an example:: | |
108 |
|
108 | |||
109 | [spam] |
|
109 | [spam] | |
110 | eggs=large |
|
110 | eggs=large | |
111 | ham=serrano |
|
111 | ham=serrano | |
112 | eggs=small |
|
112 | eggs=small | |
113 |
|
113 | |||
114 | This would set the configuration key named ``eggs`` to ``small``. |
|
114 | This would set the configuration key named ``eggs`` to ``small``. | |
115 |
|
115 | |||
116 | It is also possible to define a section multiple times. A section can |
|
116 | It is also possible to define a section multiple times. A section can | |
117 | be redefined on the same and/or on different hgrc files. For example:: |
|
117 | be redefined on the same and/or on different hgrc files. For example:: | |
118 |
|
118 | |||
119 | [foo] |
|
119 | [foo] | |
120 | eggs=large |
|
120 | eggs=large | |
121 | ham=serrano |
|
121 | ham=serrano | |
122 | eggs=small |
|
122 | eggs=small | |
123 |
|
123 | |||
124 | [bar] |
|
124 | [bar] | |
125 | eggs=ham |
|
125 | eggs=ham | |
126 | green= |
|
126 | green= | |
127 | eggs |
|
127 | eggs | |
128 |
|
128 | |||
129 | [foo] |
|
129 | [foo] | |
130 | ham=prosciutto |
|
130 | ham=prosciutto | |
131 | eggs=medium |
|
131 | eggs=medium | |
132 | bread=toasted |
|
132 | bread=toasted | |
133 |
|
133 | |||
134 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys |
|
134 | This would set the ``eggs``, ``ham``, and ``bread`` configuration keys | |
135 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, |
|
135 | of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``, | |
136 | respectively. As you can see there only thing that matters is the last |
|
136 | respectively. As you can see there only thing that matters is the last | |
137 | value that was set for each of the configuration keys. |
|
137 | value that was set for each of the configuration keys. | |
138 |
|
138 | |||
139 | If a configuration key is set multiple times in different |
|
139 | If a configuration key is set multiple times in different | |
140 | configuration files the final value will depend on the order in which |
|
140 | configuration files the final value will depend on the order in which | |
141 | the different configuration files are read, with settings from earlier |
|
141 | the different configuration files are read, with settings from earlier | |
142 | paths overriding later ones as described on the ``Files`` section |
|
142 | paths overriding later ones as described on the ``Files`` section | |
143 | above. |
|
143 | above. | |
144 |
|
144 | |||
145 | A line of the form ``%include file`` will include ``file`` into the |
|
145 | A line of the form ``%include file`` will include ``file`` into the | |
146 | current configuration file. The inclusion is recursive, which means |
|
146 | current configuration file. The inclusion is recursive, which means | |
147 | that included files can include other files. Filenames are relative to |
|
147 | that included files can include other files. Filenames are relative to | |
148 | the configuration file in which the ``%include`` directive is found. |
|
148 | the configuration file in which the ``%include`` directive is found. | |
149 | Environment variables and ``~user`` constructs are expanded in |
|
149 | Environment variables and ``~user`` constructs are expanded in | |
150 | ``file``. This lets you do something like:: |
|
150 | ``file``. This lets you do something like:: | |
151 |
|
151 | |||
152 | %include ~/.hgrc.d/$HOST.rc |
|
152 | %include ~/.hgrc.d/$HOST.rc | |
153 |
|
153 | |||
154 | to include a different configuration file on each computer you use. |
|
154 | to include a different configuration file on each computer you use. | |
155 |
|
155 | |||
156 | A line with ``%unset name`` will remove ``name`` from the current |
|
156 | A line with ``%unset name`` will remove ``name`` from the current | |
157 | section, if it has been set previously. |
|
157 | section, if it has been set previously. | |
158 |
|
158 | |||
159 | The values are either free-form text strings, lists of text strings, |
|
159 | The values are either free-form text strings, lists of text strings, | |
160 | or Boolean values. Boolean values can be set to true using any of "1", |
|
160 | or Boolean values. Boolean values can be set to true using any of "1", | |
161 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" |
|
161 | "yes", "true", or "on" and to false using "0", "no", "false", or "off" | |
162 | (all case insensitive). |
|
162 | (all case insensitive). | |
163 |
|
163 | |||
164 | List values are separated by whitespace or comma, except when values are |
|
164 | List values are separated by whitespace or comma, except when values are | |
165 | placed in double quotation marks:: |
|
165 | placed in double quotation marks:: | |
166 |
|
166 | |||
167 | allow_read = "John Doe, PhD", brian, betty |
|
167 | allow_read = "John Doe, PhD", brian, betty | |
168 |
|
168 | |||
169 | Quotation marks can be escaped by prefixing them with a backslash. Only |
|
169 | Quotation marks can be escaped by prefixing them with a backslash. Only | |
170 | quotation marks at the beginning of a word is counted as a quotation |
|
170 | quotation marks at the beginning of a word is counted as a quotation | |
171 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). |
|
171 | (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``). | |
172 |
|
172 | |||
173 | Sections |
|
173 | Sections | |
174 | -------- |
|
174 | -------- | |
175 |
|
175 | |||
176 | This section describes the different sections that may appear in a |
|
176 | This section describes the different sections that may appear in a | |
177 | Mercurial "hgrc" file, the purpose of each section, its possible keys, |
|
177 | Mercurial "hgrc" file, the purpose of each section, its possible keys, | |
178 | and their possible values. |
|
178 | and their possible values. | |
179 |
|
179 | |||
180 | ``alias`` |
|
180 | ``alias`` | |
181 | """"""""" |
|
181 | """"""""" | |
182 | Defines command aliases. |
|
182 | Defines command aliases. | |
183 | Aliases allow you to define your own commands in terms of other |
|
183 | Aliases allow you to define your own commands in terms of other | |
184 | commands (or aliases), optionally including arguments. |
|
184 | commands (or aliases), optionally including arguments. | |
185 |
|
185 | |||
186 | Alias definitions consist of lines of the form:: |
|
186 | Alias definitions consist of lines of the form:: | |
187 |
|
187 | |||
188 | <alias> = <command> [<argument]... |
|
188 | <alias> = <command> [<argument]... | |
189 |
|
189 | |||
190 | For example, this definition:: |
|
190 | For example, this definition:: | |
191 |
|
191 | |||
192 | latest = log --limit 5 |
|
192 | latest = log --limit 5 | |
193 |
|
193 | |||
194 | creates a new command ``latest`` that shows only the five most recent |
|
194 | creates a new command ``latest`` that shows only the five most recent | |
195 | changesets. You can define subsequent aliases using earlier ones:: |
|
195 | changesets. You can define subsequent aliases using earlier ones:: | |
196 |
|
196 | |||
197 | stable5 = latest -b stable |
|
197 | stable5 = latest -b stable | |
198 |
|
198 | |||
199 | .. note:: It is possible to create aliases with the same names as |
|
199 | .. note:: It is possible to create aliases with the same names as | |
200 | existing commands, which will then override the original |
|
200 | existing commands, which will then override the original | |
201 | definitions. This is almost always a bad idea! |
|
201 | definitions. This is almost always a bad idea! | |
202 |
|
202 | |||
203 |
|
203 | |||
204 | ``auth`` |
|
204 | ``auth`` | |
205 | """""""" |
|
205 | """""""" | |
206 |
|
206 | |||
207 | Authentication credentials for HTTP authentication. This section |
|
207 | Authentication credentials for HTTP authentication. This section | |
208 | allows you to store usernames and passwords for use when logging |
|
208 | allows you to store usernames and passwords for use when logging | |
209 | *into* HTTP servers. See the web_ configuration section if you want to |
|
209 | *into* HTTP servers. See the web_ configuration section if you want to | |
210 | configure *who* can login to your HTTP server. |
|
210 | configure *who* can login to your HTTP server. | |
211 |
|
211 | |||
212 | Each line has the following format:: |
|
212 | Each line has the following format:: | |
213 |
|
213 | |||
214 | <name>.<argument> = <value> |
|
214 | <name>.<argument> = <value> | |
215 |
|
215 | |||
216 | where ``<name>`` is used to group arguments into authentication |
|
216 | where ``<name>`` is used to group arguments into authentication | |
217 | entries. Example:: |
|
217 | entries. Example:: | |
218 |
|
218 | |||
219 | foo.prefix = hg.intevation.org/mercurial |
|
219 | foo.prefix = hg.intevation.org/mercurial | |
220 | foo.username = foo |
|
220 | foo.username = foo | |
221 | foo.password = bar |
|
221 | foo.password = bar | |
222 | foo.schemes = http https |
|
222 | foo.schemes = http https | |
223 |
|
223 | |||
224 | bar.prefix = secure.example.org |
|
224 | bar.prefix = secure.example.org | |
225 | bar.key = path/to/file.key |
|
225 | bar.key = path/to/file.key | |
226 | bar.cert = path/to/file.cert |
|
226 | bar.cert = path/to/file.cert | |
227 | bar.schemes = https |
|
227 | bar.schemes = https | |
228 |
|
228 | |||
229 | Supported arguments: |
|
229 | Supported arguments: | |
230 |
|
230 | |||
231 | ``prefix`` |
|
231 | ``prefix`` | |
232 | Either ``*`` or a URI prefix with or without the scheme part. |
|
232 | Either ``*`` or a URI prefix with or without the scheme part. | |
233 | The authentication entry with the longest matching prefix is used |
|
233 | The authentication entry with the longest matching prefix is used | |
234 | (where ``*`` matches everything and counts as a match of length |
|
234 | (where ``*`` matches everything and counts as a match of length | |
235 | 1). If the prefix doesn't include a scheme, the match is performed |
|
235 | 1). If the prefix doesn't include a scheme, the match is performed | |
236 | against the URI with its scheme stripped as well, and the schemes |
|
236 | against the URI with its scheme stripped as well, and the schemes | |
237 | argument, q.v., is then subsequently consulted. |
|
237 | argument, q.v., is then subsequently consulted. | |
238 | ``username`` |
|
238 | ``username`` | |
239 | Optional. Username to authenticate with. If not given, and the |
|
239 | Optional. Username to authenticate with. If not given, and the | |
240 | remote site requires basic or digest authentication, the user will |
|
240 | remote site requires basic or digest authentication, the user will | |
241 | be prompted for it. Environment variables are expanded in the |
|
241 | be prompted for it. Environment variables are expanded in the | |
242 | username letting you do ``foo.username = $USER``. |
|
242 | username letting you do ``foo.username = $USER``. | |
243 | ``password`` |
|
243 | ``password`` | |
244 | Optional. Password to authenticate with. If not given, and the |
|
244 | Optional. Password to authenticate with. If not given, and the | |
245 | remote site requires basic or digest authentication, the user |
|
245 | remote site requires basic or digest authentication, the user | |
246 | will be prompted for it. |
|
246 | will be prompted for it. | |
247 | ``key`` |
|
247 | ``key`` | |
248 | Optional. PEM encoded client certificate key file. Environment |
|
248 | Optional. PEM encoded client certificate key file. Environment | |
249 | variables are expanded in the filename. |
|
249 | variables are expanded in the filename. | |
250 | ``cert`` |
|
250 | ``cert`` | |
251 | Optional. PEM encoded client certificate chain file. Environment |
|
251 | Optional. PEM encoded client certificate chain file. Environment | |
252 | variables are expanded in the filename. |
|
252 | variables are expanded in the filename. | |
253 | ``schemes`` |
|
253 | ``schemes`` | |
254 | Optional. Space separated list of URI schemes to use this |
|
254 | Optional. Space separated list of URI schemes to use this | |
255 | authentication entry with. Only used if the prefix doesn't include |
|
255 | authentication entry with. Only used if the prefix doesn't include | |
256 | a scheme. Supported schemes are http and https. They will match |
|
256 | a scheme. Supported schemes are http and https. They will match | |
257 | static-http and static-https respectively, as well. |
|
257 | static-http and static-https respectively, as well. | |
258 | Default: https. |
|
258 | Default: https. | |
259 |
|
259 | |||
260 | If no suitable authentication entry is found, the user is prompted |
|
260 | If no suitable authentication entry is found, the user is prompted | |
261 | for credentials as usual if required by the remote. |
|
261 | for credentials as usual if required by the remote. | |
262 |
|
262 | |||
263 |
|
263 | |||
264 | ``decode/encode`` |
|
264 | ``decode/encode`` | |
265 | """"""""""""""""" |
|
265 | """"""""""""""""" | |
266 | Filters for transforming files on checkout/checkin. This would |
|
266 | Filters for transforming files on checkout/checkin. This would | |
267 | typically be used for newline processing or other |
|
267 | typically be used for newline processing or other | |
268 | localization/canonicalization of files. |
|
268 | localization/canonicalization of files. | |
269 |
|
269 | |||
270 | Filters consist of a filter pattern followed by a filter command. |
|
270 | Filters consist of a filter pattern followed by a filter command. | |
271 | Filter patterns are globs by default, rooted at the repository root. |
|
271 | Filter patterns are globs by default, rooted at the repository root. | |
272 | For example, to match any file ending in ``.txt`` in the root |
|
272 | For example, to match any file ending in ``.txt`` in the root | |
273 | directory only, use the pattern ``*.txt``. To match any file ending |
|
273 | directory only, use the pattern ``*.txt``. To match any file ending | |
274 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
274 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
275 | For each file only the first matching filter applies. |
|
275 | For each file only the first matching filter applies. | |
276 |
|
276 | |||
277 | The filter command can start with a specifier, either ``pipe:`` or |
|
277 | The filter command can start with a specifier, either ``pipe:`` or | |
278 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
278 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
279 |
|
279 | |||
280 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
280 | A ``pipe:`` command must accept data on stdin and return the transformed | |
281 | data on stdout. |
|
281 | data on stdout. | |
282 |
|
282 | |||
283 | Pipe example:: |
|
283 | Pipe example:: | |
284 |
|
284 | |||
285 | [encode] |
|
285 | [encode] | |
286 | # uncompress gzip files on checkin to improve delta compression |
|
286 | # uncompress gzip files on checkin to improve delta compression | |
287 | # note: not necessarily a good idea, just an example |
|
287 | # note: not necessarily a good idea, just an example | |
288 | *.gz = pipe: gunzip |
|
288 | *.gz = pipe: gunzip | |
289 |
|
289 | |||
290 | [decode] |
|
290 | [decode] | |
291 | # recompress gzip files when writing them to the working dir (we |
|
291 | # recompress gzip files when writing them to the working dir (we | |
292 | # can safely omit "pipe:", because it's the default) |
|
292 | # can safely omit "pipe:", because it's the default) | |
293 | *.gz = gzip |
|
293 | *.gz = gzip | |
294 |
|
294 | |||
295 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
295 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
296 | with the name of a temporary file that contains the data to be |
|
296 | with the name of a temporary file that contains the data to be | |
297 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
297 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
298 | of an empty temporary file, where the filtered data must be written by |
|
298 | of an empty temporary file, where the filtered data must be written by | |
299 | the command. |
|
299 | the command. | |
300 |
|
300 | |||
301 | .. note:: The tempfile mechanism is recommended for Windows systems, |
|
301 | .. note:: The tempfile mechanism is recommended for Windows systems, | |
302 | where the standard shell I/O redirection operators often have |
|
302 | where the standard shell I/O redirection operators often have | |
303 | strange effects and may corrupt the contents of your files. |
|
303 | strange effects and may corrupt the contents of your files. | |
304 |
|
304 | |||
305 | This filter mechanism is used internally by the ``eol`` extension to |
|
305 | This filter mechanism is used internally by the ``eol`` extension to | |
306 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
306 | translate line ending characters between Windows (CRLF) and Unix (LF) | |
307 | format. We suggest you use the ``eol`` extension for convenience. |
|
307 | format. We suggest you use the ``eol`` extension for convenience. | |
308 |
|
308 | |||
309 |
|
309 | |||
310 | ``defaults`` |
|
310 | ``defaults`` | |
311 | """""""""""" |
|
311 | """""""""""" | |
312 |
|
312 | |||
313 | (defaults are deprecated. Don't use them. Use aliases instead) |
|
313 | (defaults are deprecated. Don't use them. Use aliases instead) | |
314 |
|
314 | |||
315 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
315 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
316 | default options/arguments to pass to the specified commands. |
|
316 | default options/arguments to pass to the specified commands. | |
317 |
|
317 | |||
318 | The following example makes :hg:`log` run in verbose mode, and |
|
318 | The following example makes :hg:`log` run in verbose mode, and | |
319 | :hg:`status` show only the modified files, by default:: |
|
319 | :hg:`status` show only the modified files, by default:: | |
320 |
|
320 | |||
321 | [defaults] |
|
321 | [defaults] | |
322 | log = -v |
|
322 | log = -v | |
323 | status = -m |
|
323 | status = -m | |
324 |
|
324 | |||
325 | The actual commands, instead of their aliases, must be used when |
|
325 | The actual commands, instead of their aliases, must be used when | |
326 | defining command defaults. The command defaults will also be applied |
|
326 | defining command defaults. The command defaults will also be applied | |
327 | to the aliases of the commands defined. |
|
327 | to the aliases of the commands defined. | |
328 |
|
328 | |||
329 |
|
329 | |||
330 | ``diff`` |
|
330 | ``diff`` | |
331 | """""""" |
|
331 | """""""" | |
332 |
|
332 | |||
333 | Settings used when displaying diffs. They are all Boolean and |
|
333 | Settings used when displaying diffs. They are all Boolean and | |
334 | defaults to False. |
|
334 | defaults to False. | |
335 |
|
335 | |||
336 | ``git`` |
|
336 | ``git`` | |
337 | Use git extended diff format. |
|
337 | Use git extended diff format. | |
338 | ``nodates`` |
|
338 | ``nodates`` | |
339 | Don't include dates in diff headers. |
|
339 | Don't include dates in diff headers. | |
340 | ``showfunc`` |
|
340 | ``showfunc`` | |
341 | Show which function each change is in. |
|
341 | Show which function each change is in. | |
342 | ``ignorews`` |
|
342 | ``ignorews`` | |
343 | Ignore white space when comparing lines. |
|
343 | Ignore white space when comparing lines. | |
344 | ``ignorewsamount`` |
|
344 | ``ignorewsamount`` | |
345 | Ignore changes in the amount of white space. |
|
345 | Ignore changes in the amount of white space. | |
346 | ``ignoreblanklines`` |
|
346 | ``ignoreblanklines`` | |
347 | Ignore changes whose lines are all blank. |
|
347 | Ignore changes whose lines are all blank. | |
348 |
|
348 | |||
349 | ``email`` |
|
349 | ``email`` | |
350 | """"""""" |
|
350 | """"""""" | |
351 | Settings for extensions that send email messages. |
|
351 | Settings for extensions that send email messages. | |
352 |
|
352 | |||
353 | ``from`` |
|
353 | ``from`` | |
354 | Optional. Email address to use in "From" header and SMTP envelope |
|
354 | Optional. Email address to use in "From" header and SMTP envelope | |
355 | of outgoing messages. |
|
355 | of outgoing messages. | |
356 | ``to`` |
|
356 | ``to`` | |
357 | Optional. Comma-separated list of recipients' email addresses. |
|
357 | Optional. Comma-separated list of recipients' email addresses. | |
358 | ``cc`` |
|
358 | ``cc`` | |
359 | Optional. Comma-separated list of carbon copy recipients' |
|
359 | Optional. Comma-separated list of carbon copy recipients' | |
360 | email addresses. |
|
360 | email addresses. | |
361 | ``bcc`` |
|
361 | ``bcc`` | |
362 | Optional. Comma-separated list of blind carbon copy recipients' |
|
362 | Optional. Comma-separated list of blind carbon copy recipients' | |
363 | email addresses. |
|
363 | email addresses. | |
364 | ``method`` |
|
364 | ``method`` | |
365 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
365 | Optional. Method to use to send email messages. If value is ``smtp`` | |
366 | (default), use SMTP (see the SMTP_ section for configuration). |
|
366 | (default), use SMTP (see the SMTP_ section for configuration). | |
367 | Otherwise, use as name of program to run that acts like sendmail |
|
367 | Otherwise, use as name of program to run that acts like sendmail | |
368 | (takes ``-f`` option for sender, list of recipients on command line, |
|
368 | (takes ``-f`` option for sender, list of recipients on command line, | |
369 | message on stdin). Normally, setting this to ``sendmail`` or |
|
369 | message on stdin). Normally, setting this to ``sendmail`` or | |
370 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
370 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
371 | ``charsets`` |
|
371 | ``charsets`` | |
372 | Optional. Comma-separated list of character sets considered |
|
372 | Optional. Comma-separated list of character sets considered | |
373 | convenient for recipients. Addresses, headers, and parts not |
|
373 | convenient for recipients. Addresses, headers, and parts not | |
374 | containing patches of outgoing messages will be encoded in the |
|
374 | containing patches of outgoing messages will be encoded in the | |
375 | first character set to which conversion from local encoding |
|
375 | first character set to which conversion from local encoding | |
376 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
376 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
377 | conversion fails, the text in question is sent as is. Defaults to |
|
377 | conversion fails, the text in question is sent as is. Defaults to | |
378 | empty (explicit) list. |
|
378 | empty (explicit) list. | |
379 |
|
379 | |||
380 | Order of outgoing email character sets: |
|
380 | Order of outgoing email character sets: | |
381 |
|
381 | |||
382 | 1. ``us-ascii``: always first, regardless of settings |
|
382 | 1. ``us-ascii``: always first, regardless of settings | |
383 | 2. ``email.charsets``: in order given by user |
|
383 | 2. ``email.charsets``: in order given by user | |
384 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
384 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
385 | 4. ``$HGENCODING``: if not in email.charsets |
|
385 | 4. ``$HGENCODING``: if not in email.charsets | |
386 | 5. ``utf-8``: always last, regardless of settings |
|
386 | 5. ``utf-8``: always last, regardless of settings | |
387 |
|
387 | |||
388 | Email example:: |
|
388 | Email example:: | |
389 |
|
389 | |||
390 | [email] |
|
390 | [email] | |
391 | from = Joseph User <joe.user@example.com> |
|
391 | from = Joseph User <joe.user@example.com> | |
392 | method = /usr/sbin/sendmail |
|
392 | method = /usr/sbin/sendmail | |
393 | # charsets for western Europeans |
|
393 | # charsets for western Europeans | |
394 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
394 | # us-ascii, utf-8 omitted, as they are tried first and last | |
395 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
395 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
396 |
|
396 | |||
397 |
|
397 | |||
398 | ``extensions`` |
|
398 | ``extensions`` | |
399 | """""""""""""" |
|
399 | """""""""""""" | |
400 |
|
400 | |||
401 | Mercurial has an extension mechanism for adding new features. To |
|
401 | Mercurial has an extension mechanism for adding new features. To | |
402 | enable an extension, create an entry for it in this section. |
|
402 | enable an extension, create an entry for it in this section. | |
403 |
|
403 | |||
404 | If you know that the extension is already in Python's search path, |
|
404 | If you know that the extension is already in Python's search path, | |
405 | you can give the name of the module, followed by ``=``, with nothing |
|
405 | you can give the name of the module, followed by ``=``, with nothing | |
406 | after the ``=``. |
|
406 | after the ``=``. | |
407 |
|
407 | |||
408 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
408 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
409 | the path to the ``.py`` file (including the file name extension) that |
|
409 | the path to the ``.py`` file (including the file name extension) that | |
410 | defines the extension. |
|
410 | defines the extension. | |
411 |
|
411 | |||
412 | To explicitly disable an extension that is enabled in an hgrc of |
|
412 | To explicitly disable an extension that is enabled in an hgrc of | |
413 | broader scope, prepend its path with ``!``, as in |
|
413 | broader scope, prepend its path with ``!``, as in | |
414 | ``hgext.foo = !/ext/path`` or ``hgext.foo = !`` when path is not |
|
414 | ``hgext.foo = !/ext/path`` or ``hgext.foo = !`` when path is not | |
415 | supplied. |
|
415 | supplied. | |
416 |
|
416 | |||
417 | Example for ``~/.hgrc``:: |
|
417 | Example for ``~/.hgrc``:: | |
418 |
|
418 | |||
419 | [extensions] |
|
419 | [extensions] | |
420 | # (the mq extension will get loaded from Mercurial's path) |
|
420 | # (the mq extension will get loaded from Mercurial's path) | |
421 | hgext.mq = |
|
421 | hgext.mq = | |
422 | # (this extension will get loaded from the file specified) |
|
422 | # (this extension will get loaded from the file specified) | |
423 | myfeature = ~/.hgext/myfeature.py |
|
423 | myfeature = ~/.hgext/myfeature.py | |
424 |
|
424 | |||
425 |
|
425 | |||
426 | ``format`` |
|
426 | ``format`` | |
427 | """""""""" |
|
427 | """""""""" | |
428 |
|
428 | |||
429 | ``usestore`` |
|
429 | ``usestore`` | |
430 | Enable or disable the "store" repository format which improves |
|
430 | Enable or disable the "store" repository format which improves | |
431 | compatibility with systems that fold case or otherwise mangle |
|
431 | compatibility with systems that fold case or otherwise mangle | |
432 | filenames. Enabled by default. Disabling this option will allow |
|
432 | filenames. Enabled by default. Disabling this option will allow | |
433 | you to store longer filenames in some situations at the expense of |
|
433 | you to store longer filenames in some situations at the expense of | |
434 | compatibility and ensures that the on-disk format of newly created |
|
434 | compatibility and ensures that the on-disk format of newly created | |
435 | repositories will be compatible with Mercurial before version 0.9.4. |
|
435 | repositories will be compatible with Mercurial before version 0.9.4. | |
436 |
|
436 | |||
437 | ``usefncache`` |
|
437 | ``usefncache`` | |
438 | Enable or disable the "fncache" repository format which enhances |
|
438 | Enable or disable the "fncache" repository format which enhances | |
439 | the "store" repository format (which has to be enabled to use |
|
439 | the "store" repository format (which has to be enabled to use | |
440 | fncache) to allow longer filenames and avoids using Windows |
|
440 | fncache) to allow longer filenames and avoids using Windows | |
441 | reserved names, e.g. "nul". Enabled by default. Disabling this |
|
441 | reserved names, e.g. "nul". Enabled by default. Disabling this | |
442 | option ensures that the on-disk format of newly created |
|
442 | option ensures that the on-disk format of newly created | |
443 | repositories will be compatible with Mercurial before version 1.1. |
|
443 | repositories will be compatible with Mercurial before version 1.1. | |
444 |
|
444 | |||
445 | ``dotencode`` |
|
445 | ``dotencode`` | |
446 | Enable or disable the "dotencode" repository format which enhances |
|
446 | Enable or disable the "dotencode" repository format which enhances | |
447 | the "fncache" repository format (which has to be enabled to use |
|
447 | the "fncache" repository format (which has to be enabled to use | |
448 | dotencode) to avoid issues with filenames starting with ._ on |
|
448 | dotencode) to avoid issues with filenames starting with ._ on | |
449 | Mac OS X and spaces on Windows. Enabled by default. Disabling this |
|
449 | Mac OS X and spaces on Windows. Enabled by default. Disabling this | |
450 | option ensures that the on-disk format of newly created |
|
450 | option ensures that the on-disk format of newly created | |
451 | repositories will be compatible with Mercurial before version 1.7. |
|
451 | repositories will be compatible with Mercurial before version 1.7. | |
452 |
|
452 | |||
453 | ``merge-patterns`` |
|
453 | ``merge-patterns`` | |
454 | """""""""""""""""" |
|
454 | """""""""""""""""" | |
455 |
|
455 | |||
456 | This section specifies merge tools to associate with particular file |
|
456 | This section specifies merge tools to associate with particular file | |
457 | patterns. Tools matched here will take precedence over the default |
|
457 | patterns. Tools matched here will take precedence over the default | |
458 | merge tool. Patterns are globs by default, rooted at the repository |
|
458 | merge tool. Patterns are globs by default, rooted at the repository | |
459 | root. |
|
459 | root. | |
460 |
|
460 | |||
461 | Example:: |
|
461 | Example:: | |
462 |
|
462 | |||
463 | [merge-patterns] |
|
463 | [merge-patterns] | |
464 | **.c = kdiff3 |
|
464 | **.c = kdiff3 | |
465 | **.jpg = myimgmerge |
|
465 | **.jpg = myimgmerge | |
466 |
|
466 | |||
467 | ``merge-tools`` |
|
467 | ``merge-tools`` | |
468 | """"""""""""""" |
|
468 | """"""""""""""" | |
469 |
|
469 | |||
470 | This section configures external merge tools to use for file-level |
|
470 | This section configures external merge tools to use for file-level | |
471 | merges. |
|
471 | merges. | |
472 |
|
472 | |||
473 | Example ``~/.hgrc``:: |
|
473 | Example ``~/.hgrc``:: | |
474 |
|
474 | |||
475 | [merge-tools] |
|
475 | [merge-tools] | |
476 | # Override stock tool location |
|
476 | # Override stock tool location | |
477 | kdiff3.executable = ~/bin/kdiff3 |
|
477 | kdiff3.executable = ~/bin/kdiff3 | |
478 | # Specify command line |
|
478 | # Specify command line | |
479 | kdiff3.args = $base $local $other -o $output |
|
479 | kdiff3.args = $base $local $other -o $output | |
480 | # Give higher priority |
|
480 | # Give higher priority | |
481 | kdiff3.priority = 1 |
|
481 | kdiff3.priority = 1 | |
482 |
|
482 | |||
483 | # Define new tool |
|
483 | # Define new tool | |
484 | myHtmlTool.args = -m $local $other $base $output |
|
484 | myHtmlTool.args = -m $local $other $base $output | |
485 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
485 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
486 | myHtmlTool.priority = 1 |
|
486 | myHtmlTool.priority = 1 | |
487 |
|
487 | |||
488 | Supported arguments: |
|
488 | Supported arguments: | |
489 |
|
489 | |||
490 | ``priority`` |
|
490 | ``priority`` | |
491 | The priority in which to evaluate this tool. |
|
491 | The priority in which to evaluate this tool. | |
492 | Default: 0. |
|
492 | Default: 0. | |
493 | ``executable`` |
|
493 | ``executable`` | |
494 | Either just the name of the executable or its pathname. On Windows, |
|
494 | Either just the name of the executable or its pathname. On Windows, | |
495 | the path can use environment variables with ${ProgramFiles} syntax. |
|
495 | the path can use environment variables with ${ProgramFiles} syntax. | |
496 | Default: the tool name. |
|
496 | Default: the tool name. | |
497 | ``args`` |
|
497 | ``args`` | |
498 | The arguments to pass to the tool executable. You can refer to the |
|
498 | The arguments to pass to the tool executable. You can refer to the | |
499 | files being merged as well as the output file through these |
|
499 | files being merged as well as the output file through these | |
500 | variables: ``$base``, ``$local``, ``$other``, ``$output``. |
|
500 | variables: ``$base``, ``$local``, ``$other``, ``$output``. | |
501 | Default: ``$local $base $other`` |
|
501 | Default: ``$local $base $other`` | |
502 | ``premerge`` |
|
502 | ``premerge`` | |
503 | Attempt to run internal non-interactive 3-way merge tool before |
|
503 | Attempt to run internal non-interactive 3-way merge tool before | |
504 | launching external tool. Options are ``true``, ``false``, or ``keep`` |
|
504 | launching external tool. Options are ``true``, ``false``, or ``keep`` | |
505 | to leave markers in the file if the premerge fails. |
|
505 | to leave markers in the file if the premerge fails. | |
506 | Default: True |
|
506 | Default: True | |
507 | ``binary`` |
|
507 | ``binary`` | |
508 | This tool can merge binary files. Defaults to False, unless tool |
|
508 | This tool can merge binary files. Defaults to False, unless tool | |
509 | was selected by file pattern match. |
|
509 | was selected by file pattern match. | |
510 | ``symlink`` |
|
510 | ``symlink`` | |
511 | This tool can merge symlinks. Defaults to False, even if tool was |
|
511 | This tool can merge symlinks. Defaults to False, even if tool was | |
512 | selected by file pattern match. |
|
512 | selected by file pattern match. | |
513 | ``check`` |
|
513 | ``check`` | |
514 | A list of merge success-checking options: |
|
514 | A list of merge success-checking options: | |
515 |
|
515 | |||
516 | ``changed`` |
|
516 | ``changed`` | |
517 | Ask whether merge was successful when the merged file shows no changes. |
|
517 | Ask whether merge was successful when the merged file shows no changes. | |
518 | ``conflicts`` |
|
518 | ``conflicts`` | |
519 | Check whether there are conflicts even though the tool reported success. |
|
519 | Check whether there are conflicts even though the tool reported success. | |
520 | ``prompt`` |
|
520 | ``prompt`` | |
521 | Always prompt for merge success, regardless of success reported by tool. |
|
521 | Always prompt for merge success, regardless of success reported by tool. | |
522 |
|
522 | |||
523 | ``checkchanged`` |
|
523 | ``checkchanged`` | |
524 | True is equivalent to ``check = changed``. |
|
524 | True is equivalent to ``check = changed``. | |
525 | Default: False |
|
525 | Default: False | |
526 | ``checkconflicts`` |
|
526 | ``checkconflicts`` | |
527 | True is equivalent to ``check = conflicts``. |
|
527 | True is equivalent to ``check = conflicts``. | |
528 | Default: False |
|
528 | Default: False | |
529 | ``fixeol`` |
|
529 | ``fixeol`` | |
530 | Attempt to fix up EOL changes caused by the merge tool. |
|
530 | Attempt to fix up EOL changes caused by the merge tool. | |
531 | Default: False |
|
531 | Default: False | |
532 | ``gui`` |
|
532 | ``gui`` | |
533 | This tool requires a graphical interface to run. Default: False |
|
533 | This tool requires a graphical interface to run. Default: False | |
534 | ``regkey`` |
|
534 | ``regkey`` | |
535 | Windows registry key which describes install location of this |
|
535 | Windows registry key which describes install location of this | |
536 | tool. Mercurial will search for this key first under |
|
536 | tool. Mercurial will search for this key first under | |
537 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
537 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
538 | Default: None |
|
538 | Default: None | |
539 | ``regname`` |
|
539 | ``regname`` | |
540 | Name of value to read from specified registry key. Defaults to the |
|
540 | Name of value to read from specified registry key. Defaults to the | |
541 | unnamed (default) value. |
|
541 | unnamed (default) value. | |
542 | ``regappend`` |
|
542 | ``regappend`` | |
543 | String to append to the value read from the registry, typically |
|
543 | String to append to the value read from the registry, typically | |
544 | the executable name of the tool. |
|
544 | the executable name of the tool. | |
545 | Default: None |
|
545 | Default: None | |
546 |
|
546 | |||
547 |
|
547 | |||
548 | ``hooks`` |
|
548 | ``hooks`` | |
549 | """"""""" |
|
549 | """"""""" | |
550 | Commands or Python functions that get automatically executed by |
|
550 | Commands or Python functions that get automatically executed by | |
551 | various actions such as starting or finishing a commit. Multiple |
|
551 | various actions such as starting or finishing a commit. Multiple | |
552 | hooks can be run for the same action by appending a suffix to the |
|
552 | hooks can be run for the same action by appending a suffix to the | |
553 | action. Overriding a site-wide hook can be done by changing its |
|
553 | action. Overriding a site-wide hook can be done by changing its | |
554 | value or setting it to an empty string. |
|
554 | value or setting it to an empty string. | |
555 |
|
555 | |||
556 | Example ``.hg/hgrc``:: |
|
556 | Example ``.hg/hgrc``:: | |
557 |
|
557 | |||
558 | [hooks] |
|
558 | [hooks] | |
559 | # update working directory after adding changesets |
|
559 | # update working directory after adding changesets | |
560 | changegroup.update = hg update |
|
560 | changegroup.update = hg update | |
561 | # do not use the site-wide hook |
|
561 | # do not use the site-wide hook | |
562 | incoming = |
|
562 | incoming = | |
563 | incoming.email = /my/email/hook |
|
563 | incoming.email = /my/email/hook | |
564 | incoming.autobuild = /my/build/hook |
|
564 | incoming.autobuild = /my/build/hook | |
565 |
|
565 | |||
566 | Most hooks are run with environment variables set that give useful |
|
566 | Most hooks are run with environment variables set that give useful | |
567 | additional information. For each hook below, the environment |
|
567 | additional information. For each hook below, the environment | |
568 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
568 | variables it is passed are listed with names of the form ``$HG_foo``. | |
569 |
|
569 | |||
570 | ``changegroup`` |
|
570 | ``changegroup`` | |
571 | Run after a changegroup has been added via push, pull or unbundle. |
|
571 | Run after a changegroup has been added via push, pull or unbundle. | |
572 | ID of the first new changeset is in ``$HG_NODE``. URL from which |
|
572 | ID of the first new changeset is in ``$HG_NODE``. URL from which | |
573 | changes came is in ``$HG_URL``. |
|
573 | changes came is in ``$HG_URL``. | |
574 | ``commit`` |
|
574 | ``commit`` | |
575 | Run after a changeset has been created in the local repository. ID |
|
575 | Run after a changeset has been created in the local repository. ID | |
576 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
576 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
577 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
577 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
578 | ``incoming`` |
|
578 | ``incoming`` | |
579 | Run after a changeset has been pulled, pushed, or unbundled into |
|
579 | Run after a changeset has been pulled, pushed, or unbundled into | |
580 | the local repository. The ID of the newly arrived changeset is in |
|
580 | the local repository. The ID of the newly arrived changeset is in | |
581 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
581 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. | |
582 | ``outgoing`` |
|
582 | ``outgoing`` | |
583 | Run after sending changes from local repository to another. ID of |
|
583 | Run after sending changes from local repository to another. ID of | |
584 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
584 | first changeset sent is in ``$HG_NODE``. Source of operation is in | |
585 | ``$HG_SOURCE``; see "preoutgoing" hook for description. |
|
585 | ``$HG_SOURCE``; see "preoutgoing" hook for description. | |
586 | ``post-<command>`` |
|
586 | ``post-<command>`` | |
587 | Run after successful invocations of the associated command. The |
|
587 | Run after successful invocations of the associated command. The | |
588 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
588 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
589 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
589 | code in ``$HG_RESULT``. Parsed command line arguments are passed as | |
590 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
590 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of | |
591 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
591 | the python data internally passed to <command>. ``$HG_OPTS`` is a | |
592 | dictionary of options (with unspecified options set to their defaults). |
|
592 | dictionary of options (with unspecified options set to their defaults). | |
593 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
593 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. | |
594 | ``pre-<command>`` |
|
594 | ``pre-<command>`` | |
595 | Run before executing the associated command. The contents of the |
|
595 | Run before executing the associated command. The contents of the | |
596 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
596 | command line are passed as ``$HG_ARGS``. Parsed command line arguments | |
597 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
597 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string | |
598 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
598 | representations of the data internally passed to <command>. ``$HG_OPTS`` | |
599 | is a dictionary of options (with unspecified options set to their |
|
599 | is a dictionary of options (with unspecified options set to their | |
600 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
600 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns | |
601 | failure, the command doesn't execute and Mercurial returns the failure |
|
601 | failure, the command doesn't execute and Mercurial returns the failure | |
602 | code. |
|
602 | code. | |
603 | ``prechangegroup`` |
|
603 | ``prechangegroup`` | |
604 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
604 | Run before a changegroup is added via push, pull or unbundle. Exit | |
605 | status 0 allows the changegroup to proceed. Non-zero status will |
|
605 | status 0 allows the changegroup to proceed. Non-zero status will | |
606 | cause the push, pull or unbundle to fail. URL from which changes |
|
606 | cause the push, pull or unbundle to fail. URL from which changes | |
607 | will come is in ``$HG_URL``. |
|
607 | will come is in ``$HG_URL``. | |
608 | ``precommit`` |
|
608 | ``precommit`` | |
609 | Run before starting a local commit. Exit status 0 allows the |
|
609 | Run before starting a local commit. Exit status 0 allows the | |
610 | commit to proceed. Non-zero status will cause the commit to fail. |
|
610 | commit to proceed. Non-zero status will cause the commit to fail. | |
611 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
611 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
612 | ``preoutgoing`` |
|
612 | ``preoutgoing`` | |
613 | Run before collecting changes to send from the local repository to |
|
613 | Run before collecting changes to send from the local repository to | |
614 | another. Non-zero status will cause failure. This lets you prevent |
|
614 | another. Non-zero status will cause failure. This lets you prevent | |
615 | pull over HTTP or SSH. Also prevents against local pull, push |
|
615 | pull over HTTP or SSH. Also prevents against local pull, push | |
616 | (outbound) or bundle commands, but not effective, since you can |
|
616 | (outbound) or bundle commands, but not effective, since you can | |
617 | just copy files instead then. Source of operation is in |
|
617 | just copy files instead then. Source of operation is in | |
618 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
618 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote | |
619 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
619 | SSH or HTTP repository. If "push", "pull" or "bundle", operation | |
620 | is happening on behalf of repository on same system. |
|
620 | is happening on behalf of repository on same system. | |
621 | ``pretag`` |
|
621 | ``pretag`` | |
622 | Run before creating a tag. Exit status 0 allows the tag to be |
|
622 | Run before creating a tag. Exit status 0 allows the tag to be | |
623 | created. Non-zero status will cause the tag to fail. ID of |
|
623 | created. Non-zero status will cause the tag to fail. ID of | |
624 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
624 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is | |
625 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
625 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. | |
626 | ``pretxnchangegroup`` |
|
626 | ``pretxnchangegroup`` | |
627 | Run after a changegroup has been added via push, pull or unbundle, |
|
627 | Run after a changegroup has been added via push, pull or unbundle, | |
628 | but before the transaction has been committed. Changegroup is |
|
628 | but before the transaction has been committed. Changegroup is | |
629 | visible to hook program. This lets you validate incoming changes |
|
629 | visible to hook program. This lets you validate incoming changes | |
630 | before accepting them. Passed the ID of the first new changeset in |
|
630 | before accepting them. Passed the ID of the first new changeset in | |
631 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero |
|
631 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero | |
632 | status will cause the transaction to be rolled back and the push, |
|
632 | status will cause the transaction to be rolled back and the push, | |
633 | pull or unbundle will fail. URL that was source of changes is in |
|
633 | pull or unbundle will fail. URL that was source of changes is in | |
634 | ``$HG_URL``. |
|
634 | ``$HG_URL``. | |
635 | ``pretxncommit`` |
|
635 | ``pretxncommit`` | |
636 | Run after a changeset has been created but the transaction not yet |
|
636 | Run after a changeset has been created but the transaction not yet | |
637 | committed. Changeset is visible to hook program. This lets you |
|
637 | committed. Changeset is visible to hook program. This lets you | |
638 | validate commit message and changes. Exit status 0 allows the |
|
638 | validate commit message and changes. Exit status 0 allows the | |
639 | commit to proceed. Non-zero status will cause the transaction to |
|
639 | commit to proceed. Non-zero status will cause the transaction to | |
640 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
640 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset | |
641 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
641 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
642 | ``preupdate`` |
|
642 | ``preupdate`` | |
643 | Run before updating the working directory. Exit status 0 allows |
|
643 | Run before updating the working directory. Exit status 0 allows | |
644 | the update to proceed. Non-zero status will prevent the update. |
|
644 | the update to proceed. Non-zero status will prevent the update. | |
645 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
645 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID | |
646 | of second new parent is in ``$HG_PARENT2``. |
|
646 | of second new parent is in ``$HG_PARENT2``. | |
647 | ``tag`` |
|
647 | ``tag`` | |
648 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
648 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. | |
649 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
649 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in | |
650 | repository if ``$HG_LOCAL=0``. |
|
650 | repository if ``$HG_LOCAL=0``. | |
651 | ``update`` |
|
651 | ``update`` | |
652 | Run after updating the working directory. Changeset ID of first |
|
652 | Run after updating the working directory. Changeset ID of first | |
653 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
653 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is | |
654 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
654 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
655 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
655 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. | |
656 |
|
656 | |||
657 | .. note:: It is generally better to use standard hooks rather than the |
|
657 | .. note:: It is generally better to use standard hooks rather than the | |
658 | generic pre- and post- command hooks as they are guaranteed to be |
|
658 | generic pre- and post- command hooks as they are guaranteed to be | |
659 | called in the appropriate contexts for influencing transactions. |
|
659 | called in the appropriate contexts for influencing transactions. | |
660 | Also, hooks like "commit" will be called in all contexts that |
|
660 | Also, hooks like "commit" will be called in all contexts that | |
661 | generate a commit (e.g. tag) and not just the commit command. |
|
661 | generate a commit (e.g. tag) and not just the commit command. | |
662 |
|
662 | |||
663 | .. note:: Environment variables with empty values may not be passed to |
|
663 | .. note:: Environment variables with empty values may not be passed to | |
664 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
664 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
665 | will have an empty value under Unix-like platforms for non-merge |
|
665 | will have an empty value under Unix-like platforms for non-merge | |
666 | changesets, while it will not be available at all under Windows. |
|
666 | changesets, while it will not be available at all under Windows. | |
667 |
|
667 | |||
668 | The syntax for Python hooks is as follows:: |
|
668 | The syntax for Python hooks is as follows:: | |
669 |
|
669 | |||
670 | hookname = python:modulename.submodule.callable |
|
670 | hookname = python:modulename.submodule.callable | |
671 | hookname = python:/path/to/python/module.py:callable |
|
671 | hookname = python:/path/to/python/module.py:callable | |
672 |
|
672 | |||
673 | Python hooks are run within the Mercurial process. Each hook is |
|
673 | Python hooks are run within the Mercurial process. Each hook is | |
674 | called with at least three keyword arguments: a ui object (keyword |
|
674 | called with at least three keyword arguments: a ui object (keyword | |
675 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
675 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
676 | keyword that tells what kind of hook is used. Arguments listed as |
|
676 | keyword that tells what kind of hook is used. Arguments listed as | |
677 | environment variables above are passed as keyword arguments, with no |
|
677 | environment variables above are passed as keyword arguments, with no | |
678 | ``HG_`` prefix, and names in lower case. |
|
678 | ``HG_`` prefix, and names in lower case. | |
679 |
|
679 | |||
680 | If a Python hook returns a "true" value or raises an exception, this |
|
680 | If a Python hook returns a "true" value or raises an exception, this | |
681 | is treated as a failure. |
|
681 | is treated as a failure. | |
682 |
|
682 | |||
683 |
|
683 | |||
684 | ``http_proxy`` |
|
684 | ``http_proxy`` | |
685 | """""""""""""" |
|
685 | """""""""""""" | |
686 | Used to access web-based Mercurial repositories through a HTTP |
|
686 | Used to access web-based Mercurial repositories through a HTTP | |
687 | proxy. |
|
687 | proxy. | |
688 |
|
688 | |||
689 | ``host`` |
|
689 | ``host`` | |
690 | Host name and (optional) port of the proxy server, for example |
|
690 | Host name and (optional) port of the proxy server, for example | |
691 | "myproxy:8000". |
|
691 | "myproxy:8000". | |
692 | ``no`` |
|
692 | ``no`` | |
693 | Optional. Comma-separated list of host names that should bypass |
|
693 | Optional. Comma-separated list of host names that should bypass | |
694 | the proxy. |
|
694 | the proxy. | |
695 | ``passwd`` |
|
695 | ``passwd`` | |
696 | Optional. Password to authenticate with at the proxy server. |
|
696 | Optional. Password to authenticate with at the proxy server. | |
697 | ``user`` |
|
697 | ``user`` | |
698 | Optional. User name to authenticate with at the proxy server. |
|
698 | Optional. User name to authenticate with at the proxy server. | |
699 | ``always`` |
|
699 | ``always`` | |
700 | Optional. Always use the proxy, even for localhost and any entries |
|
700 | Optional. Always use the proxy, even for localhost and any entries | |
701 | in ``http_proxy.no``. True or False. Default: False. |
|
701 | in ``http_proxy.no``. True or False. Default: False. | |
702 |
|
702 | |||
703 | ``smtp`` |
|
703 | ``smtp`` | |
704 | """""""" |
|
704 | """""""" | |
705 | Configuration for extensions that need to send email messages. |
|
705 | Configuration for extensions that need to send email messages. | |
706 |
|
706 | |||
707 | ``host`` |
|
707 | ``host`` | |
708 | Host name of mail server, e.g. "mail.example.com". |
|
708 | Host name of mail server, e.g. "mail.example.com". | |
709 | ``port`` |
|
709 | ``port`` | |
710 | Optional. Port to connect to on mail server. Default: 25. |
|
710 | Optional. Port to connect to on mail server. Default: 25. | |
711 | ``tls`` |
|
711 | ``tls`` | |
712 |
Optional. |
|
712 | Optional. Method to enable TLS when connecting to mail server: starttls, | |
713 |
|
|
713 | smtps or none. Default: none. | |
714 | ``username`` |
|
714 | ``username`` | |
715 | Optional. User name for authenticating with the SMTP server. |
|
715 | Optional. User name for authenticating with the SMTP server. | |
716 | Default: none. |
|
716 | Default: none. | |
717 | ``password`` |
|
717 | ``password`` | |
718 | Optional. Password for authenticating with the SMTP server. If not |
|
718 | Optional. Password for authenticating with the SMTP server. If not | |
719 | specified, interactive sessions will prompt the user for a |
|
719 | specified, interactive sessions will prompt the user for a | |
720 | password; non-interactive sessions will fail. Default: none. |
|
720 | password; non-interactive sessions will fail. Default: none. | |
721 | ``local_hostname`` |
|
721 | ``local_hostname`` | |
722 | Optional. It's the hostname that the sender can use to identify |
|
722 | Optional. It's the hostname that the sender can use to identify | |
723 | itself to the MTA. |
|
723 | itself to the MTA. | |
724 |
|
724 | |||
725 |
|
725 | |||
726 | ``patch`` |
|
726 | ``patch`` | |
727 | """"""""" |
|
727 | """"""""" | |
728 | Settings used when applying patches, for instance through the 'import' |
|
728 | Settings used when applying patches, for instance through the 'import' | |
729 | command or with Mercurial Queues extension. |
|
729 | command or with Mercurial Queues extension. | |
730 |
|
730 | |||
731 | ``eol`` |
|
731 | ``eol`` | |
732 | When set to 'strict' patch content and patched files end of lines |
|
732 | When set to 'strict' patch content and patched files end of lines | |
733 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
733 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
734 | lines are ignored when patching and the result line endings are |
|
734 | lines are ignored when patching and the result line endings are | |
735 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
735 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
736 | ``auto``, end of lines are again ignored while patching but line |
|
736 | ``auto``, end of lines are again ignored while patching but line | |
737 | endings in patched files are normalized to their original setting |
|
737 | endings in patched files are normalized to their original setting | |
738 | on a per-file basis. If target file does not exist or has no end |
|
738 | on a per-file basis. If target file does not exist or has no end | |
739 | of line, patch line endings are preserved. |
|
739 | of line, patch line endings are preserved. | |
740 | Default: strict. |
|
740 | Default: strict. | |
741 |
|
741 | |||
742 |
|
742 | |||
743 | ``paths`` |
|
743 | ``paths`` | |
744 | """"""""" |
|
744 | """"""""" | |
745 | Assigns symbolic names to repositories. The left side is the |
|
745 | Assigns symbolic names to repositories. The left side is the | |
746 | symbolic name, and the right gives the directory or URL that is the |
|
746 | symbolic name, and the right gives the directory or URL that is the | |
747 | location of the repository. Default paths can be declared by setting |
|
747 | location of the repository. Default paths can be declared by setting | |
748 | the following entries. |
|
748 | the following entries. | |
749 |
|
749 | |||
750 | ``default`` |
|
750 | ``default`` | |
751 | Directory or URL to use when pulling if no source is specified. |
|
751 | Directory or URL to use when pulling if no source is specified. | |
752 | Default is set to repository from which the current repository was |
|
752 | Default is set to repository from which the current repository was | |
753 | cloned. |
|
753 | cloned. | |
754 | ``default-push`` |
|
754 | ``default-push`` | |
755 | Optional. Directory or URL to use when pushing if no destination |
|
755 | Optional. Directory or URL to use when pushing if no destination | |
756 | is specified. |
|
756 | is specified. | |
757 |
|
757 | |||
758 |
|
758 | |||
759 | ``profiling`` |
|
759 | ``profiling`` | |
760 | """"""""""""" |
|
760 | """"""""""""" | |
761 | Specifies profiling format and file output. In this section |
|
761 | Specifies profiling format and file output. In this section | |
762 | description, 'profiling data' stands for the raw data collected |
|
762 | description, 'profiling data' stands for the raw data collected | |
763 | during profiling, while 'profiling report' stands for a statistical |
|
763 | during profiling, while 'profiling report' stands for a statistical | |
764 | text report generated from the profiling data. The profiling is done |
|
764 | text report generated from the profiling data. The profiling is done | |
765 | using lsprof. |
|
765 | using lsprof. | |
766 |
|
766 | |||
767 | ``format`` |
|
767 | ``format`` | |
768 | Profiling format. |
|
768 | Profiling format. | |
769 | Default: text. |
|
769 | Default: text. | |
770 |
|
770 | |||
771 | ``text`` |
|
771 | ``text`` | |
772 | Generate a profiling report. When saving to a file, it should be |
|
772 | Generate a profiling report. When saving to a file, it should be | |
773 | noted that only the report is saved, and the profiling data is |
|
773 | noted that only the report is saved, and the profiling data is | |
774 | not kept. |
|
774 | not kept. | |
775 | ``kcachegrind`` |
|
775 | ``kcachegrind`` | |
776 | Format profiling data for kcachegrind use: when saving to a |
|
776 | Format profiling data for kcachegrind use: when saving to a | |
777 | file, the generated file can directly be loaded into |
|
777 | file, the generated file can directly be loaded into | |
778 | kcachegrind. |
|
778 | kcachegrind. | |
779 | ``output`` |
|
779 | ``output`` | |
780 | File path where profiling data or report should be saved. If the |
|
780 | File path where profiling data or report should be saved. If the | |
781 | file exists, it is replaced. Default: None, data is printed on |
|
781 | file exists, it is replaced. Default: None, data is printed on | |
782 | stderr |
|
782 | stderr | |
783 |
|
783 | |||
784 | ``server`` |
|
784 | ``server`` | |
785 | """""""""" |
|
785 | """""""""" | |
786 | Controls generic server settings. |
|
786 | Controls generic server settings. | |
787 |
|
787 | |||
788 | ``uncompressed`` |
|
788 | ``uncompressed`` | |
789 | Whether to allow clients to clone a repository using the |
|
789 | Whether to allow clients to clone a repository using the | |
790 | uncompressed streaming protocol. This transfers about 40% more |
|
790 | uncompressed streaming protocol. This transfers about 40% more | |
791 | data than a regular clone, but uses less memory and CPU on both |
|
791 | data than a regular clone, but uses less memory and CPU on both | |
792 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
792 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
793 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
793 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
794 | regular clone. Over most WAN connections (anything slower than |
|
794 | regular clone. Over most WAN connections (anything slower than | |
795 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
795 | about 6 Mbps), uncompressed streaming is slower, because of the | |
796 | extra data transfer overhead. This mode will also temporarily hold |
|
796 | extra data transfer overhead. This mode will also temporarily hold | |
797 | the write lock while determining what data to transfer. |
|
797 | the write lock while determining what data to transfer. | |
798 | Default is True. |
|
798 | Default is True. | |
799 |
|
799 | |||
800 | ``validate`` |
|
800 | ``validate`` | |
801 | Whether to validate the completeness of pushed changesets by |
|
801 | Whether to validate the completeness of pushed changesets by | |
802 | checking that all new file revisions specified in manifests are |
|
802 | checking that all new file revisions specified in manifests are | |
803 | present. Default is False. |
|
803 | present. Default is False. | |
804 |
|
804 | |||
805 | ``subpaths`` |
|
805 | ``subpaths`` | |
806 | """""""""""" |
|
806 | """""""""""" | |
807 | Defines subrepositories source locations rewriting rules of the form:: |
|
807 | Defines subrepositories source locations rewriting rules of the form:: | |
808 |
|
808 | |||
809 | <pattern> = <replacement> |
|
809 | <pattern> = <replacement> | |
810 |
|
810 | |||
811 | Where ``pattern`` is a regular expression matching the source and |
|
811 | Where ``pattern`` is a regular expression matching the source and | |
812 | ``replacement`` is the replacement string used to rewrite it. Groups |
|
812 | ``replacement`` is the replacement string used to rewrite it. Groups | |
813 | can be matched in ``pattern`` and referenced in ``replacements``. For |
|
813 | can be matched in ``pattern`` and referenced in ``replacements``. For | |
814 | instance:: |
|
814 | instance:: | |
815 |
|
815 | |||
816 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
816 | http://server/(.*)-hg/ = http://hg.server/\1/ | |
817 |
|
817 | |||
818 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
818 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. | |
819 |
|
819 | |||
820 | All patterns are applied in definition order. |
|
820 | All patterns are applied in definition order. | |
821 |
|
821 | |||
822 | ``trusted`` |
|
822 | ``trusted`` | |
823 | """"""""""" |
|
823 | """"""""""" | |
824 |
|
824 | |||
825 | Mercurial will not use the settings in the |
|
825 | Mercurial will not use the settings in the | |
826 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
826 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
827 | user or to a trusted group, as various hgrc features allow arbitrary |
|
827 | user or to a trusted group, as various hgrc features allow arbitrary | |
828 | commands to be run. This issue is often encountered when configuring |
|
828 | commands to be run. This issue is often encountered when configuring | |
829 | hooks or extensions for shared repositories or servers. However, |
|
829 | hooks or extensions for shared repositories or servers. However, | |
830 | the web interface will use some safe settings from the ``[web]`` |
|
830 | the web interface will use some safe settings from the ``[web]`` | |
831 | section. |
|
831 | section. | |
832 |
|
832 | |||
833 | This section specifies what users and groups are trusted. The |
|
833 | This section specifies what users and groups are trusted. The | |
834 | current user is always trusted. To trust everybody, list a user or a |
|
834 | current user is always trusted. To trust everybody, list a user or a | |
835 | group with name ``*``. These settings must be placed in an |
|
835 | group with name ``*``. These settings must be placed in an | |
836 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
836 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the | |
837 | user or service running Mercurial. |
|
837 | user or service running Mercurial. | |
838 |
|
838 | |||
839 | ``users`` |
|
839 | ``users`` | |
840 | Comma-separated list of trusted users. |
|
840 | Comma-separated list of trusted users. | |
841 | ``groups`` |
|
841 | ``groups`` | |
842 | Comma-separated list of trusted groups. |
|
842 | Comma-separated list of trusted groups. | |
843 |
|
843 | |||
844 |
|
844 | |||
845 | ``ui`` |
|
845 | ``ui`` | |
846 | """""" |
|
846 | """""" | |
847 |
|
847 | |||
848 | User interface controls. |
|
848 | User interface controls. | |
849 |
|
849 | |||
850 | ``archivemeta`` |
|
850 | ``archivemeta`` | |
851 | Whether to include the .hg_archival.txt file containing meta data |
|
851 | Whether to include the .hg_archival.txt file containing meta data | |
852 | (hashes for the repository base and for tip) in archives created |
|
852 | (hashes for the repository base and for tip) in archives created | |
853 | by the :hg:`archive` command or downloaded via hgweb. |
|
853 | by the :hg:`archive` command or downloaded via hgweb. | |
854 | Default is True. |
|
854 | Default is True. | |
855 | ``askusername`` |
|
855 | ``askusername`` | |
856 | Whether to prompt for a username when committing. If True, and |
|
856 | Whether to prompt for a username when committing. If True, and | |
857 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
857 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
858 | be prompted to enter a username. If no username is entered, the |
|
858 | be prompted to enter a username. If no username is entered, the | |
859 | default ``USER@HOST`` is used instead. |
|
859 | default ``USER@HOST`` is used instead. | |
860 | Default is False. |
|
860 | Default is False. | |
861 | ``debug`` |
|
861 | ``debug`` | |
862 | Print debugging information. True or False. Default is False. |
|
862 | Print debugging information. True or False. Default is False. | |
863 | ``editor`` |
|
863 | ``editor`` | |
864 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. |
|
864 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. | |
865 | ``fallbackencoding`` |
|
865 | ``fallbackencoding`` | |
866 | Encoding to try if it's not possible to decode the changelog using |
|
866 | Encoding to try if it's not possible to decode the changelog using | |
867 | UTF-8. Default is ISO-8859-1. |
|
867 | UTF-8. Default is ISO-8859-1. | |
868 | ``ignore`` |
|
868 | ``ignore`` | |
869 | A file to read per-user ignore patterns from. This file should be |
|
869 | A file to read per-user ignore patterns from. This file should be | |
870 | in the same format as a repository-wide .hgignore file. This |
|
870 | in the same format as a repository-wide .hgignore file. This | |
871 | option supports hook syntax, so if you want to specify multiple |
|
871 | option supports hook syntax, so if you want to specify multiple | |
872 | ignore files, you can do so by setting something like |
|
872 | ignore files, you can do so by setting something like | |
873 | ``ignore.other = ~/.hgignore2``. For details of the ignore file |
|
873 | ``ignore.other = ~/.hgignore2``. For details of the ignore file | |
874 | format, see the |hgignore(5)|_ man page. |
|
874 | format, see the |hgignore(5)|_ man page. | |
875 | ``interactive`` |
|
875 | ``interactive`` | |
876 | Allow to prompt the user. True or False. Default is True. |
|
876 | Allow to prompt the user. True or False. Default is True. | |
877 | ``logtemplate`` |
|
877 | ``logtemplate`` | |
878 | Template string for commands that print changesets. |
|
878 | Template string for commands that print changesets. | |
879 | ``merge`` |
|
879 | ``merge`` | |
880 | The conflict resolution program to use during a manual merge. |
|
880 | The conflict resolution program to use during a manual merge. | |
881 | For more information on merge tools see :hg:`help merge-tools`. |
|
881 | For more information on merge tools see :hg:`help merge-tools`. | |
882 | For configuring merge tools see the merge-tools_ section. |
|
882 | For configuring merge tools see the merge-tools_ section. | |
883 | ``patch`` |
|
883 | ``patch`` | |
884 | command to use to apply patches. Look for ``gpatch`` or ``patch`` in |
|
884 | command to use to apply patches. Look for ``gpatch`` or ``patch`` in | |
885 | PATH if unset. |
|
885 | PATH if unset. | |
886 | ``quiet`` |
|
886 | ``quiet`` | |
887 | Reduce the amount of output printed. True or False. Default is False. |
|
887 | Reduce the amount of output printed. True or False. Default is False. | |
888 | ``remotecmd`` |
|
888 | ``remotecmd`` | |
889 | remote command to use for clone/push/pull operations. Default is ``hg``. |
|
889 | remote command to use for clone/push/pull operations. Default is ``hg``. | |
890 | ``report_untrusted`` |
|
890 | ``report_untrusted`` | |
891 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
891 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
892 | trusted user or group. True or False. Default is True. |
|
892 | trusted user or group. True or False. Default is True. | |
893 | ``slash`` |
|
893 | ``slash`` | |
894 | Display paths using a slash (``/``) as the path separator. This |
|
894 | Display paths using a slash (``/``) as the path separator. This | |
895 | only makes a difference on systems where the default path |
|
895 | only makes a difference on systems where the default path | |
896 | separator is not the slash character (e.g. Windows uses the |
|
896 | separator is not the slash character (e.g. Windows uses the | |
897 | backslash character (``\``)). |
|
897 | backslash character (``\``)). | |
898 | Default is False. |
|
898 | Default is False. | |
899 | ``ssh`` |
|
899 | ``ssh`` | |
900 | command to use for SSH connections. Default is ``ssh``. |
|
900 | command to use for SSH connections. Default is ``ssh``. | |
901 | ``strict`` |
|
901 | ``strict`` | |
902 | Require exact command names, instead of allowing unambiguous |
|
902 | Require exact command names, instead of allowing unambiguous | |
903 | abbreviations. True or False. Default is False. |
|
903 | abbreviations. True or False. Default is False. | |
904 | ``style`` |
|
904 | ``style`` | |
905 | Name of style to use for command output. |
|
905 | Name of style to use for command output. | |
906 | ``timeout`` |
|
906 | ``timeout`` | |
907 | The timeout used when a lock is held (in seconds), a negative value |
|
907 | The timeout used when a lock is held (in seconds), a negative value | |
908 | means no timeout. Default is 600. |
|
908 | means no timeout. Default is 600. | |
909 | ``traceback`` |
|
909 | ``traceback`` | |
910 | Mercurial always prints a traceback when an unknown exception |
|
910 | Mercurial always prints a traceback when an unknown exception | |
911 | occurs. Setting this to True will make Mercurial print a traceback |
|
911 | occurs. Setting this to True will make Mercurial print a traceback | |
912 | on all exceptions, even those recognized by Mercurial (such as |
|
912 | on all exceptions, even those recognized by Mercurial (such as | |
913 | IOError or MemoryError). Default is False. |
|
913 | IOError or MemoryError). Default is False. | |
914 | ``username`` |
|
914 | ``username`` | |
915 | The committer of a changeset created when running "commit". |
|
915 | The committer of a changeset created when running "commit". | |
916 | Typically a person's name and email address, e.g. ``Fred Widget |
|
916 | Typically a person's name and email address, e.g. ``Fred Widget | |
917 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If |
|
917 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If | |
918 | the username in hgrc is empty, it has to be specified manually or |
|
918 | the username in hgrc is empty, it has to be specified manually or | |
919 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set |
|
919 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set | |
920 | ``username =`` in the system hgrc). Environment variables in the |
|
920 | ``username =`` in the system hgrc). Environment variables in the | |
921 | username are expanded. |
|
921 | username are expanded. | |
922 | ``verbose`` |
|
922 | ``verbose`` | |
923 | Increase the amount of output printed. True or False. Default is False. |
|
923 | Increase the amount of output printed. True or False. Default is False. | |
924 |
|
924 | |||
925 |
|
925 | |||
926 | ``web`` |
|
926 | ``web`` | |
927 | """"""" |
|
927 | """"""" | |
928 |
|
928 | |||
929 | Web interface configuration. The settings in this section apply to |
|
929 | Web interface configuration. The settings in this section apply to | |
930 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
930 | both the builtin webserver (started by :hg:`serve`) and the script you | |
931 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
931 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI | |
932 | and WSGI). |
|
932 | and WSGI). | |
933 |
|
933 | |||
934 | The Mercurial webserver does no authentication (it does not prompt for |
|
934 | The Mercurial webserver does no authentication (it does not prompt for | |
935 | usernames and passwords to validate *who* users are), but it does do |
|
935 | usernames and passwords to validate *who* users are), but it does do | |
936 | authorization (it grants or denies access for *authenticated users* |
|
936 | authorization (it grants or denies access for *authenticated users* | |
937 | based on settings in this section). You must either configure your |
|
937 | based on settings in this section). You must either configure your | |
938 | webserver to do authentication for you, or disable the authorization |
|
938 | webserver to do authentication for you, or disable the authorization | |
939 | checks. |
|
939 | checks. | |
940 |
|
940 | |||
941 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
941 | For a quick setup in a trusted environment, e.g., a private LAN, where | |
942 | you want it to accept pushes from anybody, you can use the following |
|
942 | you want it to accept pushes from anybody, you can use the following | |
943 | command line:: |
|
943 | command line:: | |
944 |
|
944 | |||
945 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
945 | $ hg --config web.allow_push=* --config web.push_ssl=False serve | |
946 |
|
946 | |||
947 | Note that this will allow anybody to push anything to the server and |
|
947 | Note that this will allow anybody to push anything to the server and | |
948 | that this should not be used for public servers. |
|
948 | that this should not be used for public servers. | |
949 |
|
949 | |||
950 | The full set of options is: |
|
950 | The full set of options is: | |
951 |
|
951 | |||
952 | ``accesslog`` |
|
952 | ``accesslog`` | |
953 | Where to output the access log. Default is stdout. |
|
953 | Where to output the access log. Default is stdout. | |
954 | ``address`` |
|
954 | ``address`` | |
955 | Interface address to bind to. Default is all. |
|
955 | Interface address to bind to. Default is all. | |
956 | ``allow_archive`` |
|
956 | ``allow_archive`` | |
957 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
957 | List of archive format (bz2, gz, zip) allowed for downloading. | |
958 | Default is empty. |
|
958 | Default is empty. | |
959 | ``allowbz2`` |
|
959 | ``allowbz2`` | |
960 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
960 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
961 | revisions. |
|
961 | revisions. | |
962 | Default is False. |
|
962 | Default is False. | |
963 | ``allowgz`` |
|
963 | ``allowgz`` | |
964 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
964 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
965 | revisions. |
|
965 | revisions. | |
966 | Default is False. |
|
966 | Default is False. | |
967 | ``allowpull`` |
|
967 | ``allowpull`` | |
968 | Whether to allow pulling from the repository. Default is True. |
|
968 | Whether to allow pulling from the repository. Default is True. | |
969 | ``allow_push`` |
|
969 | ``allow_push`` | |
970 | Whether to allow pushing to the repository. If empty or not set, |
|
970 | Whether to allow pushing to the repository. If empty or not set, | |
971 | push is not allowed. If the special value ``*``, any remote user can |
|
971 | push is not allowed. If the special value ``*``, any remote user can | |
972 | push, including unauthenticated users. Otherwise, the remote user |
|
972 | push, including unauthenticated users. Otherwise, the remote user | |
973 | must have been authenticated, and the authenticated user name must |
|
973 | must have been authenticated, and the authenticated user name must | |
974 | be present in this list. The contents of the allow_push list are |
|
974 | be present in this list. The contents of the allow_push list are | |
975 | examined after the deny_push list. |
|
975 | examined after the deny_push list. | |
976 | ``allow_read`` |
|
976 | ``allow_read`` | |
977 | If the user has not already been denied repository access due to |
|
977 | If the user has not already been denied repository access due to | |
978 | the contents of deny_read, this list determines whether to grant |
|
978 | the contents of deny_read, this list determines whether to grant | |
979 | repository access to the user. If this list is not empty, and the |
|
979 | repository access to the user. If this list is not empty, and the | |
980 | user is unauthenticated or not present in the list, then access is |
|
980 | user is unauthenticated or not present in the list, then access is | |
981 | denied for the user. If the list is empty or not set, then access |
|
981 | denied for the user. If the list is empty or not set, then access | |
982 | is permitted to all users by default. Setting allow_read to the |
|
982 | is permitted to all users by default. Setting allow_read to the | |
983 | special value ``*`` is equivalent to it not being set (i.e. access |
|
983 | special value ``*`` is equivalent to it not being set (i.e. access | |
984 | is permitted to all users). The contents of the allow_read list are |
|
984 | is permitted to all users). The contents of the allow_read list are | |
985 | examined after the deny_read list. |
|
985 | examined after the deny_read list. | |
986 | ``allowzip`` |
|
986 | ``allowzip`` | |
987 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
987 | (DEPRECATED) Whether to allow .zip downloading of repository | |
988 | revisions. Default is False. This feature creates temporary files. |
|
988 | revisions. Default is False. This feature creates temporary files. | |
989 | ``baseurl`` |
|
989 | ``baseurl`` | |
990 | Base URL to use when publishing URLs in other locations, so |
|
990 | Base URL to use when publishing URLs in other locations, so | |
991 | third-party tools like email notification hooks can construct |
|
991 | third-party tools like email notification hooks can construct | |
992 | URLs. Example: ``http://hgserver/repos/``. |
|
992 | URLs. Example: ``http://hgserver/repos/``. | |
993 | ``cacerts`` |
|
993 | ``cacerts`` | |
994 | Path to file containing a list of PEM encoded certificate authority |
|
994 | Path to file containing a list of PEM encoded certificate authority | |
995 | certificates. If specified on the client, then it will verify the identity |
|
995 | certificates. If specified on the client, then it will verify the identity | |
996 | of remote HTTPS servers with these certificates. The form must be |
|
996 | of remote HTTPS servers with these certificates. The form must be | |
997 | as follows:: |
|
997 | as follows:: | |
998 |
|
998 | |||
999 | -----BEGIN CERTIFICATE----- |
|
999 | -----BEGIN CERTIFICATE----- | |
1000 | ... (certificate in base64 PEM encoding) ... |
|
1000 | ... (certificate in base64 PEM encoding) ... | |
1001 | -----END CERTIFICATE----- |
|
1001 | -----END CERTIFICATE----- | |
1002 | -----BEGIN CERTIFICATE----- |
|
1002 | -----BEGIN CERTIFICATE----- | |
1003 | ... (certificate in base64 PEM encoding) ... |
|
1003 | ... (certificate in base64 PEM encoding) ... | |
1004 | -----END CERTIFICATE----- |
|
1004 | -----END CERTIFICATE----- | |
1005 |
|
1005 | |||
1006 | This feature is only supported when using Python 2.6 or later. If you wish |
|
1006 | This feature is only supported when using Python 2.6 or later. If you wish | |
1007 | to use it with earlier versions of Python, install the backported |
|
1007 | to use it with earlier versions of Python, install the backported | |
1008 | version of the ssl library that is available from |
|
1008 | version of the ssl library that is available from | |
1009 | ``http://pypi.python.org``. |
|
1009 | ``http://pypi.python.org``. | |
1010 |
|
1010 | |||
1011 | You can use OpenSSL's CA certificate file if your platform has one. |
|
1011 | You can use OpenSSL's CA certificate file if your platform has one. | |
1012 | On most Linux systems this will be ``/etc/ssl/certs/ca-certificates.crt``. |
|
1012 | On most Linux systems this will be ``/etc/ssl/certs/ca-certificates.crt``. | |
1013 | Otherwise you will have to generate this file manually. |
|
1013 | Otherwise you will have to generate this file manually. | |
1014 | ``contact`` |
|
1014 | ``contact`` | |
1015 | Name or email address of the person in charge of the repository. |
|
1015 | Name or email address of the person in charge of the repository. | |
1016 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. |
|
1016 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. | |
1017 | ``deny_push`` |
|
1017 | ``deny_push`` | |
1018 | Whether to deny pushing to the repository. If empty or not set, |
|
1018 | Whether to deny pushing to the repository. If empty or not set, | |
1019 | push is not denied. If the special value ``*``, all remote users are |
|
1019 | push is not denied. If the special value ``*``, all remote users are | |
1020 | denied push. Otherwise, unauthenticated users are all denied, and |
|
1020 | denied push. Otherwise, unauthenticated users are all denied, and | |
1021 | any authenticated user name present in this list is also denied. The |
|
1021 | any authenticated user name present in this list is also denied. The | |
1022 | contents of the deny_push list are examined before the allow_push list. |
|
1022 | contents of the deny_push list are examined before the allow_push list. | |
1023 | ``deny_read`` |
|
1023 | ``deny_read`` | |
1024 | Whether to deny reading/viewing of the repository. If this list is |
|
1024 | Whether to deny reading/viewing of the repository. If this list is | |
1025 | not empty, unauthenticated users are all denied, and any |
|
1025 | not empty, unauthenticated users are all denied, and any | |
1026 | authenticated user name present in this list is also denied access to |
|
1026 | authenticated user name present in this list is also denied access to | |
1027 | the repository. If set to the special value ``*``, all remote users |
|
1027 | the repository. If set to the special value ``*``, all remote users | |
1028 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
1028 | are denied access (rarely needed ;). If deny_read is empty or not set, | |
1029 | the determination of repository access depends on the presence and |
|
1029 | the determination of repository access depends on the presence and | |
1030 | content of the allow_read list (see description). If both |
|
1030 | content of the allow_read list (see description). If both | |
1031 | deny_read and allow_read are empty or not set, then access is |
|
1031 | deny_read and allow_read are empty or not set, then access is | |
1032 | permitted to all users by default. If the repository is being |
|
1032 | permitted to all users by default. If the repository is being | |
1033 | served via hgwebdir, denied users will not be able to see it in |
|
1033 | served via hgwebdir, denied users will not be able to see it in | |
1034 | the list of repositories. The contents of the deny_read list have |
|
1034 | the list of repositories. The contents of the deny_read list have | |
1035 | priority over (are examined before) the contents of the allow_read |
|
1035 | priority over (are examined before) the contents of the allow_read | |
1036 | list. |
|
1036 | list. | |
1037 | ``descend`` |
|
1037 | ``descend`` | |
1038 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
1038 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
1039 | directly in the current path will be shown (other repositories are still |
|
1039 | directly in the current path will be shown (other repositories are still | |
1040 | available from the index corresponding to their containing path). |
|
1040 | available from the index corresponding to their containing path). | |
1041 | ``description`` |
|
1041 | ``description`` | |
1042 | Textual description of the repository's purpose or contents. |
|
1042 | Textual description of the repository's purpose or contents. | |
1043 | Default is "unknown". |
|
1043 | Default is "unknown". | |
1044 | ``encoding`` |
|
1044 | ``encoding`` | |
1045 | Character encoding name. Default is the current locale charset. |
|
1045 | Character encoding name. Default is the current locale charset. | |
1046 | Example: "UTF-8" |
|
1046 | Example: "UTF-8" | |
1047 | ``errorlog`` |
|
1047 | ``errorlog`` | |
1048 | Where to output the error log. Default is stderr. |
|
1048 | Where to output the error log. Default is stderr. | |
1049 | ``hidden`` |
|
1049 | ``hidden`` | |
1050 | Whether to hide the repository in the hgwebdir index. |
|
1050 | Whether to hide the repository in the hgwebdir index. | |
1051 | Default is False. |
|
1051 | Default is False. | |
1052 | ``ipv6`` |
|
1052 | ``ipv6`` | |
1053 | Whether to use IPv6. Default is False. |
|
1053 | Whether to use IPv6. Default is False. | |
1054 | ``name`` |
|
1054 | ``name`` | |
1055 | Repository name to use in the web interface. Default is current |
|
1055 | Repository name to use in the web interface. Default is current | |
1056 | working directory. |
|
1056 | working directory. | |
1057 | ``maxchanges`` |
|
1057 | ``maxchanges`` | |
1058 | Maximum number of changes to list on the changelog. Default is 10. |
|
1058 | Maximum number of changes to list on the changelog. Default is 10. | |
1059 | ``maxfiles`` |
|
1059 | ``maxfiles`` | |
1060 | Maximum number of files to list per changeset. Default is 10. |
|
1060 | Maximum number of files to list per changeset. Default is 10. | |
1061 | ``port`` |
|
1061 | ``port`` | |
1062 | Port to listen on. Default is 8000. |
|
1062 | Port to listen on. Default is 8000. | |
1063 | ``prefix`` |
|
1063 | ``prefix`` | |
1064 | Prefix path to serve from. Default is '' (server root). |
|
1064 | Prefix path to serve from. Default is '' (server root). | |
1065 | ``push_ssl`` |
|
1065 | ``push_ssl`` | |
1066 | Whether to require that inbound pushes be transported over SSL to |
|
1066 | Whether to require that inbound pushes be transported over SSL to | |
1067 | prevent password sniffing. Default is True. |
|
1067 | prevent password sniffing. Default is True. | |
1068 | ``staticurl`` |
|
1068 | ``staticurl`` | |
1069 | Base URL to use for static files. If unset, static files (e.g. the |
|
1069 | Base URL to use for static files. If unset, static files (e.g. the | |
1070 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
1070 | hgicon.png favicon) will be served by the CGI script itself. Use | |
1071 | this setting to serve them directly with the HTTP server. |
|
1071 | this setting to serve them directly with the HTTP server. | |
1072 | Example: ``http://hgserver/static/``. |
|
1072 | Example: ``http://hgserver/static/``. | |
1073 | ``stripes`` |
|
1073 | ``stripes`` | |
1074 | How many lines a "zebra stripe" should span in multiline output. |
|
1074 | How many lines a "zebra stripe" should span in multiline output. | |
1075 | Default is 1; set to 0 to disable. |
|
1075 | Default is 1; set to 0 to disable. | |
1076 | ``style`` |
|
1076 | ``style`` | |
1077 | Which template map style to use. |
|
1077 | Which template map style to use. | |
1078 | ``templates`` |
|
1078 | ``templates`` | |
1079 | Where to find the HTML templates. Default is install path. |
|
1079 | Where to find the HTML templates. Default is install path. | |
1080 |
|
1080 | |||
1081 |
|
1081 | |||
1082 | Author |
|
1082 | Author | |
1083 | ------ |
|
1083 | ------ | |
1084 | Bryan O'Sullivan <bos@serpentine.com>. |
|
1084 | Bryan O'Sullivan <bos@serpentine.com>. | |
1085 |
|
1085 | |||
1086 | Mercurial was written by Matt Mackall <mpm@selenic.com>. |
|
1086 | Mercurial was written by Matt Mackall <mpm@selenic.com>. | |
1087 |
|
1087 | |||
1088 | See Also |
|
1088 | See Also | |
1089 | -------- |
|
1089 | -------- | |
1090 | |hg(1)|_, |hgignore(5)|_ |
|
1090 | |hg(1)|_, |hgignore(5)|_ | |
1091 |
|
1091 | |||
1092 | Copying |
|
1092 | Copying | |
1093 | ------- |
|
1093 | ------- | |
1094 | This manual page is copyright 2005 Bryan O'Sullivan. |
|
1094 | This manual page is copyright 2005 Bryan O'Sullivan. | |
1095 | Mercurial is copyright 2005-2010 Matt Mackall. |
|
1095 | Mercurial is copyright 2005-2010 Matt Mackall. | |
1096 | Free use of this software is granted under the terms of the GNU General |
|
1096 | Free use of this software is granted under the terms of the GNU General | |
1097 | Public License version 2 or any later version. |
|
1097 | Public License version 2 or any later version. | |
1098 |
|
1098 | |||
1099 | .. include:: common.txt |
|
1099 | .. include:: common.txt |
@@ -1,226 +1,233 | |||||
1 | # mail.py - mail sending bits for mercurial |
|
1 | # mail.py - mail sending bits for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2006 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2006 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from i18n import _ |
|
8 | from i18n import _ | |
9 | import util, encoding |
|
9 | import util, encoding | |
10 | import os, smtplib, socket, quopri |
|
10 | import os, smtplib, socket, quopri | |
11 | import email.Header, email.MIMEText, email.Utils |
|
11 | import email.Header, email.MIMEText, email.Utils | |
12 |
|
12 | |||
13 | _oldheaderinit = email.Header.Header.__init__ |
|
13 | _oldheaderinit = email.Header.Header.__init__ | |
14 | def _unifiedheaderinit(self, *args, **kw): |
|
14 | def _unifiedheaderinit(self, *args, **kw): | |
15 | """ |
|
15 | """ | |
16 | Python2.7 introduces a backwards incompatible change |
|
16 | Python2.7 introduces a backwards incompatible change | |
17 | (Python issue1974, r70772) in email.Generator.Generator code: |
|
17 | (Python issue1974, r70772) in email.Generator.Generator code: | |
18 | pre-2.7 code passed "continuation_ws='\t'" to the Header |
|
18 | pre-2.7 code passed "continuation_ws='\t'" to the Header | |
19 | constructor, and 2.7 removed this parameter. |
|
19 | constructor, and 2.7 removed this parameter. | |
20 |
|
20 | |||
21 | Default argument is continuation_ws=' ', which means that the |
|
21 | Default argument is continuation_ws=' ', which means that the | |
22 | behaviour is different in <2.7 and 2.7 |
|
22 | behaviour is different in <2.7 and 2.7 | |
23 |
|
23 | |||
24 | We consider the 2.7 behaviour to be preferable, but need |
|
24 | We consider the 2.7 behaviour to be preferable, but need | |
25 | to have an unified behaviour for versions 2.4 to 2.7 |
|
25 | to have an unified behaviour for versions 2.4 to 2.7 | |
26 | """ |
|
26 | """ | |
27 | # override continuation_ws |
|
27 | # override continuation_ws | |
28 | kw['continuation_ws'] = ' ' |
|
28 | kw['continuation_ws'] = ' ' | |
29 | _oldheaderinit(self, *args, **kw) |
|
29 | _oldheaderinit(self, *args, **kw) | |
30 |
|
30 | |||
31 | email.Header.Header.__dict__['__init__'] = _unifiedheaderinit |
|
31 | email.Header.Header.__dict__['__init__'] = _unifiedheaderinit | |
32 |
|
32 | |||
33 | def _smtp(ui): |
|
33 | def _smtp(ui): | |
34 | '''build an smtp connection and return a function to send mail''' |
|
34 | '''build an smtp connection and return a function to send mail''' | |
35 | local_hostname = ui.config('smtp', 'local_hostname') |
|
35 | local_hostname = ui.config('smtp', 'local_hostname') | |
|
36 | tls = ui.config('smtp', 'tls') | |||
|
37 | # backward compatible: when tls = true, we use starttls. | |||
|
38 | starttls = tls == 'starttls' or util.parsebool(tls) | |||
|
39 | smtps = tls == 'smtps' | |||
|
40 | if (starttls or smtps) and not hasattr(socket, 'ssl'): | |||
|
41 | raise util.Abort(_("can't use TLS: Python SSL support not installed")) | |||
|
42 | if smtps: | |||
|
43 | ui.note(_('(using smtps)\n')) | |||
|
44 | s = smtplib.SMTP_SSL(local_hostname=local_hostname) | |||
|
45 | else: | |||
36 | s = smtplib.SMTP(local_hostname=local_hostname) |
|
46 | s = smtplib.SMTP(local_hostname=local_hostname) | |
37 | mailhost = ui.config('smtp', 'host') |
|
47 | mailhost = ui.config('smtp', 'host') | |
38 | if not mailhost: |
|
48 | if not mailhost: | |
39 | raise util.Abort(_('smtp.host not configured - cannot send mail')) |
|
49 | raise util.Abort(_('smtp.host not configured - cannot send mail')) | |
40 | mailport = util.getport(ui.config('smtp', 'port', 25)) |
|
50 | mailport = util.getport(ui.config('smtp', 'port', 25)) | |
41 | ui.note(_('sending mail: smtp host %s, port %s\n') % |
|
51 | ui.note(_('sending mail: smtp host %s, port %s\n') % | |
42 | (mailhost, mailport)) |
|
52 | (mailhost, mailport)) | |
43 | s.connect(host=mailhost, port=mailport) |
|
53 | s.connect(host=mailhost, port=mailport) | |
44 | if ui.configbool('smtp', 'tls'): |
|
54 | if starttls: | |
45 | if not hasattr(socket, 'ssl'): |
|
55 | ui.note(_('(using starttls)\n')) | |
46 | raise util.Abort(_("can't use TLS: Python SSL support " |
|
|||
47 | "not installed")) |
|
|||
48 | ui.note(_('(using tls)\n')) |
|
|||
49 | s.ehlo() |
|
56 | s.ehlo() | |
50 | s.starttls() |
|
57 | s.starttls() | |
51 | s.ehlo() |
|
58 | s.ehlo() | |
52 | username = ui.config('smtp', 'username') |
|
59 | username = ui.config('smtp', 'username') | |
53 | password = ui.config('smtp', 'password') |
|
60 | password = ui.config('smtp', 'password') | |
54 | if username and not password: |
|
61 | if username and not password: | |
55 | password = ui.getpass() |
|
62 | password = ui.getpass() | |
56 | if username and password: |
|
63 | if username and password: | |
57 | ui.note(_('(authenticating to mail server as %s)\n') % |
|
64 | ui.note(_('(authenticating to mail server as %s)\n') % | |
58 | (username)) |
|
65 | (username)) | |
59 | try: |
|
66 | try: | |
60 | s.login(username, password) |
|
67 | s.login(username, password) | |
61 | except smtplib.SMTPException, inst: |
|
68 | except smtplib.SMTPException, inst: | |
62 | raise util.Abort(inst) |
|
69 | raise util.Abort(inst) | |
63 |
|
70 | |||
64 | def send(sender, recipients, msg): |
|
71 | def send(sender, recipients, msg): | |
65 | try: |
|
72 | try: | |
66 | return s.sendmail(sender, recipients, msg) |
|
73 | return s.sendmail(sender, recipients, msg) | |
67 | except smtplib.SMTPRecipientsRefused, inst: |
|
74 | except smtplib.SMTPRecipientsRefused, inst: | |
68 | recipients = [r[1] for r in inst.recipients.values()] |
|
75 | recipients = [r[1] for r in inst.recipients.values()] | |
69 | raise util.Abort('\n' + '\n'.join(recipients)) |
|
76 | raise util.Abort('\n' + '\n'.join(recipients)) | |
70 | except smtplib.SMTPException, inst: |
|
77 | except smtplib.SMTPException, inst: | |
71 | raise util.Abort(inst) |
|
78 | raise util.Abort(inst) | |
72 |
|
79 | |||
73 | return send |
|
80 | return send | |
74 |
|
81 | |||
75 | def _sendmail(ui, sender, recipients, msg): |
|
82 | def _sendmail(ui, sender, recipients, msg): | |
76 | '''send mail using sendmail.''' |
|
83 | '''send mail using sendmail.''' | |
77 | program = ui.config('email', 'method') |
|
84 | program = ui.config('email', 'method') | |
78 | cmdline = '%s -f %s %s' % (program, util.email(sender), |
|
85 | cmdline = '%s -f %s %s' % (program, util.email(sender), | |
79 | ' '.join(map(util.email, recipients))) |
|
86 | ' '.join(map(util.email, recipients))) | |
80 | ui.note(_('sending mail: %s\n') % cmdline) |
|
87 | ui.note(_('sending mail: %s\n') % cmdline) | |
81 | fp = util.popen(cmdline, 'w') |
|
88 | fp = util.popen(cmdline, 'w') | |
82 | fp.write(msg) |
|
89 | fp.write(msg) | |
83 | ret = fp.close() |
|
90 | ret = fp.close() | |
84 | if ret: |
|
91 | if ret: | |
85 | raise util.Abort('%s %s' % ( |
|
92 | raise util.Abort('%s %s' % ( | |
86 | os.path.basename(program.split(None, 1)[0]), |
|
93 | os.path.basename(program.split(None, 1)[0]), | |
87 | util.explain_exit(ret)[0])) |
|
94 | util.explain_exit(ret)[0])) | |
88 |
|
95 | |||
89 | def connect(ui): |
|
96 | def connect(ui): | |
90 | '''make a mail connection. return a function to send mail. |
|
97 | '''make a mail connection. return a function to send mail. | |
91 | call as sendmail(sender, list-of-recipients, msg).''' |
|
98 | call as sendmail(sender, list-of-recipients, msg).''' | |
92 | if ui.config('email', 'method', 'smtp') == 'smtp': |
|
99 | if ui.config('email', 'method', 'smtp') == 'smtp': | |
93 | return _smtp(ui) |
|
100 | return _smtp(ui) | |
94 | return lambda s, r, m: _sendmail(ui, s, r, m) |
|
101 | return lambda s, r, m: _sendmail(ui, s, r, m) | |
95 |
|
102 | |||
96 | def sendmail(ui, sender, recipients, msg): |
|
103 | def sendmail(ui, sender, recipients, msg): | |
97 | send = connect(ui) |
|
104 | send = connect(ui) | |
98 | return send(sender, recipients, msg) |
|
105 | return send(sender, recipients, msg) | |
99 |
|
106 | |||
100 | def validateconfig(ui): |
|
107 | def validateconfig(ui): | |
101 | '''determine if we have enough config data to try sending email.''' |
|
108 | '''determine if we have enough config data to try sending email.''' | |
102 | method = ui.config('email', 'method', 'smtp') |
|
109 | method = ui.config('email', 'method', 'smtp') | |
103 | if method == 'smtp': |
|
110 | if method == 'smtp': | |
104 | if not ui.config('smtp', 'host'): |
|
111 | if not ui.config('smtp', 'host'): | |
105 | raise util.Abort(_('smtp specified as email transport, ' |
|
112 | raise util.Abort(_('smtp specified as email transport, ' | |
106 | 'but no smtp host configured')) |
|
113 | 'but no smtp host configured')) | |
107 | else: |
|
114 | else: | |
108 | if not util.find_exe(method): |
|
115 | if not util.find_exe(method): | |
109 | raise util.Abort(_('%r specified as email transport, ' |
|
116 | raise util.Abort(_('%r specified as email transport, ' | |
110 | 'but not in PATH') % method) |
|
117 | 'but not in PATH') % method) | |
111 |
|
118 | |||
112 | def mimetextpatch(s, subtype='plain', display=False): |
|
119 | def mimetextpatch(s, subtype='plain', display=False): | |
113 | '''If patch in utf-8 transfer-encode it.''' |
|
120 | '''If patch in utf-8 transfer-encode it.''' | |
114 |
|
121 | |||
115 | enc = None |
|
122 | enc = None | |
116 | for line in s.splitlines(): |
|
123 | for line in s.splitlines(): | |
117 | if len(line) > 950: |
|
124 | if len(line) > 950: | |
118 | s = quopri.encodestring(s) |
|
125 | s = quopri.encodestring(s) | |
119 | enc = "quoted-printable" |
|
126 | enc = "quoted-printable" | |
120 | break |
|
127 | break | |
121 |
|
128 | |||
122 | cs = 'us-ascii' |
|
129 | cs = 'us-ascii' | |
123 | if not display: |
|
130 | if not display: | |
124 | try: |
|
131 | try: | |
125 | s.decode('us-ascii') |
|
132 | s.decode('us-ascii') | |
126 | except UnicodeDecodeError: |
|
133 | except UnicodeDecodeError: | |
127 | try: |
|
134 | try: | |
128 | s.decode('utf-8') |
|
135 | s.decode('utf-8') | |
129 | cs = 'utf-8' |
|
136 | cs = 'utf-8' | |
130 | except UnicodeDecodeError: |
|
137 | except UnicodeDecodeError: | |
131 | # We'll go with us-ascii as a fallback. |
|
138 | # We'll go with us-ascii as a fallback. | |
132 | pass |
|
139 | pass | |
133 |
|
140 | |||
134 | msg = email.MIMEText.MIMEText(s, subtype, cs) |
|
141 | msg = email.MIMEText.MIMEText(s, subtype, cs) | |
135 | if enc: |
|
142 | if enc: | |
136 | del msg['Content-Transfer-Encoding'] |
|
143 | del msg['Content-Transfer-Encoding'] | |
137 | msg['Content-Transfer-Encoding'] = enc |
|
144 | msg['Content-Transfer-Encoding'] = enc | |
138 | return msg |
|
145 | return msg | |
139 |
|
146 | |||
140 | def _charsets(ui): |
|
147 | def _charsets(ui): | |
141 | '''Obtains charsets to send mail parts not containing patches.''' |
|
148 | '''Obtains charsets to send mail parts not containing patches.''' | |
142 | charsets = [cs.lower() for cs in ui.configlist('email', 'charsets')] |
|
149 | charsets = [cs.lower() for cs in ui.configlist('email', 'charsets')] | |
143 | fallbacks = [encoding.fallbackencoding.lower(), |
|
150 | fallbacks = [encoding.fallbackencoding.lower(), | |
144 | encoding.encoding.lower(), 'utf-8'] |
|
151 | encoding.encoding.lower(), 'utf-8'] | |
145 | for cs in fallbacks: # find unique charsets while keeping order |
|
152 | for cs in fallbacks: # find unique charsets while keeping order | |
146 | if cs not in charsets: |
|
153 | if cs not in charsets: | |
147 | charsets.append(cs) |
|
154 | charsets.append(cs) | |
148 | return [cs for cs in charsets if not cs.endswith('ascii')] |
|
155 | return [cs for cs in charsets if not cs.endswith('ascii')] | |
149 |
|
156 | |||
150 | def _encode(ui, s, charsets): |
|
157 | def _encode(ui, s, charsets): | |
151 | '''Returns (converted) string, charset tuple. |
|
158 | '''Returns (converted) string, charset tuple. | |
152 | Finds out best charset by cycling through sendcharsets in descending |
|
159 | Finds out best charset by cycling through sendcharsets in descending | |
153 | order. Tries both encoding and fallbackencoding for input. Only as |
|
160 | order. Tries both encoding and fallbackencoding for input. Only as | |
154 | last resort send as is in fake ascii. |
|
161 | last resort send as is in fake ascii. | |
155 | Caveat: Do not use for mail parts containing patches!''' |
|
162 | Caveat: Do not use for mail parts containing patches!''' | |
156 | try: |
|
163 | try: | |
157 | s.decode('ascii') |
|
164 | s.decode('ascii') | |
158 | except UnicodeDecodeError: |
|
165 | except UnicodeDecodeError: | |
159 | sendcharsets = charsets or _charsets(ui) |
|
166 | sendcharsets = charsets or _charsets(ui) | |
160 | for ics in (encoding.encoding, encoding.fallbackencoding): |
|
167 | for ics in (encoding.encoding, encoding.fallbackencoding): | |
161 | try: |
|
168 | try: | |
162 | u = s.decode(ics) |
|
169 | u = s.decode(ics) | |
163 | except UnicodeDecodeError: |
|
170 | except UnicodeDecodeError: | |
164 | continue |
|
171 | continue | |
165 | for ocs in sendcharsets: |
|
172 | for ocs in sendcharsets: | |
166 | try: |
|
173 | try: | |
167 | return u.encode(ocs), ocs |
|
174 | return u.encode(ocs), ocs | |
168 | except UnicodeEncodeError: |
|
175 | except UnicodeEncodeError: | |
169 | pass |
|
176 | pass | |
170 | except LookupError: |
|
177 | except LookupError: | |
171 | ui.warn(_('ignoring invalid sendcharset: %s\n') % ocs) |
|
178 | ui.warn(_('ignoring invalid sendcharset: %s\n') % ocs) | |
172 | # if ascii, or all conversion attempts fail, send (broken) ascii |
|
179 | # if ascii, or all conversion attempts fail, send (broken) ascii | |
173 | return s, 'us-ascii' |
|
180 | return s, 'us-ascii' | |
174 |
|
181 | |||
175 | def headencode(ui, s, charsets=None, display=False): |
|
182 | def headencode(ui, s, charsets=None, display=False): | |
176 | '''Returns RFC-2047 compliant header from given string.''' |
|
183 | '''Returns RFC-2047 compliant header from given string.''' | |
177 | if not display: |
|
184 | if not display: | |
178 | # split into words? |
|
185 | # split into words? | |
179 | s, cs = _encode(ui, s, charsets) |
|
186 | s, cs = _encode(ui, s, charsets) | |
180 | return str(email.Header.Header(s, cs)) |
|
187 | return str(email.Header.Header(s, cs)) | |
181 | return s |
|
188 | return s | |
182 |
|
189 | |||
183 | def _addressencode(ui, name, addr, charsets=None): |
|
190 | def _addressencode(ui, name, addr, charsets=None): | |
184 | name = headencode(ui, name, charsets) |
|
191 | name = headencode(ui, name, charsets) | |
185 | try: |
|
192 | try: | |
186 | acc, dom = addr.split('@') |
|
193 | acc, dom = addr.split('@') | |
187 | acc = acc.encode('ascii') |
|
194 | acc = acc.encode('ascii') | |
188 | dom = dom.decode(encoding.encoding).encode('idna') |
|
195 | dom = dom.decode(encoding.encoding).encode('idna') | |
189 | addr = '%s@%s' % (acc, dom) |
|
196 | addr = '%s@%s' % (acc, dom) | |
190 | except UnicodeDecodeError: |
|
197 | except UnicodeDecodeError: | |
191 | raise util.Abort(_('invalid email address: %s') % addr) |
|
198 | raise util.Abort(_('invalid email address: %s') % addr) | |
192 | except ValueError: |
|
199 | except ValueError: | |
193 | try: |
|
200 | try: | |
194 | # too strict? |
|
201 | # too strict? | |
195 | addr = addr.encode('ascii') |
|
202 | addr = addr.encode('ascii') | |
196 | except UnicodeDecodeError: |
|
203 | except UnicodeDecodeError: | |
197 | raise util.Abort(_('invalid local address: %s') % addr) |
|
204 | raise util.Abort(_('invalid local address: %s') % addr) | |
198 | return email.Utils.formataddr((name, addr)) |
|
205 | return email.Utils.formataddr((name, addr)) | |
199 |
|
206 | |||
200 | def addressencode(ui, address, charsets=None, display=False): |
|
207 | def addressencode(ui, address, charsets=None, display=False): | |
201 | '''Turns address into RFC-2047 compliant header.''' |
|
208 | '''Turns address into RFC-2047 compliant header.''' | |
202 | if display or not address: |
|
209 | if display or not address: | |
203 | return address or '' |
|
210 | return address or '' | |
204 | name, addr = email.Utils.parseaddr(address) |
|
211 | name, addr = email.Utils.parseaddr(address) | |
205 | return _addressencode(ui, name, addr, charsets) |
|
212 | return _addressencode(ui, name, addr, charsets) | |
206 |
|
213 | |||
207 | def addrlistencode(ui, addrs, charsets=None, display=False): |
|
214 | def addrlistencode(ui, addrs, charsets=None, display=False): | |
208 | '''Turns a list of addresses into a list of RFC-2047 compliant headers. |
|
215 | '''Turns a list of addresses into a list of RFC-2047 compliant headers. | |
209 | A single element of input list may contain multiple addresses, but output |
|
216 | A single element of input list may contain multiple addresses, but output | |
210 | always has one address per item''' |
|
217 | always has one address per item''' | |
211 | if display: |
|
218 | if display: | |
212 | return [a.strip() for a in addrs if a.strip()] |
|
219 | return [a.strip() for a in addrs if a.strip()] | |
213 |
|
220 | |||
214 | result = [] |
|
221 | result = [] | |
215 | for name, addr in email.Utils.getaddresses(addrs): |
|
222 | for name, addr in email.Utils.getaddresses(addrs): | |
216 | if name or addr: |
|
223 | if name or addr: | |
217 | result.append(_addressencode(ui, name, addr, charsets)) |
|
224 | result.append(_addressencode(ui, name, addr, charsets)) | |
218 | return result |
|
225 | return result | |
219 |
|
226 | |||
220 | def mimeencode(ui, s, charsets=None, display=False): |
|
227 | def mimeencode(ui, s, charsets=None, display=False): | |
221 | '''creates mime text object, encodes it if needed, and sets |
|
228 | '''creates mime text object, encodes it if needed, and sets | |
222 | charset and transfer-encoding accordingly.''' |
|
229 | charset and transfer-encoding accordingly.''' | |
223 | cs = 'us-ascii' |
|
230 | cs = 'us-ascii' | |
224 | if not display: |
|
231 | if not display: | |
225 | s, cs = _encode(ui, s, charsets) |
|
232 | s, cs = _encode(ui, s, charsets) | |
226 | return email.MIMEText.MIMEText(s, 'plain', cs) |
|
233 | return email.MIMEText.MIMEText(s, 'plain', cs) |
General Comments 0
You need to be logged in to leave comments.
Login now