Show More
@@ -1,1519 +1,1520 b'' | |||||
1 | The Mercurial system uses a set of configuration files to control |
|
1 | The Mercurial system uses a set of configuration files to control | |
2 | aspects of its behavior. |
|
2 | aspects of its behavior. | |
3 |
|
3 | |||
4 | The configuration files use a simple ini-file format. A configuration |
|
4 | The configuration files use a simple ini-file format. A configuration | |
5 | file consists of sections, led by a ``[section]`` header and followed |
|
5 | file consists of sections, led by a ``[section]`` header and followed | |
6 | by ``name = value`` entries:: |
|
6 | by ``name = value`` entries:: | |
7 |
|
7 | |||
8 | [ui] |
|
8 | [ui] | |
9 | username = Firstname Lastname <firstname.lastname@example.net> |
|
9 | username = Firstname Lastname <firstname.lastname@example.net> | |
10 | verbose = True |
|
10 | verbose = True | |
11 |
|
11 | |||
12 | The above entries will be referred to as ``ui.username`` and |
|
12 | The above entries will be referred to as ``ui.username`` and | |
13 | ``ui.verbose``, respectively. See the Syntax section below. |
|
13 | ``ui.verbose``, respectively. See the Syntax section below. | |
14 |
|
14 | |||
15 | Files |
|
15 | Files | |
16 | ===== |
|
16 | ===== | |
17 |
|
17 | |||
18 | Mercurial reads configuration data from several files, if they exist. |
|
18 | Mercurial reads configuration data from several files, if they exist. | |
19 | These files do not exist by default and you will have to create the |
|
19 | These files do not exist by default and you will have to create the | |
20 | appropriate configuration files yourself: global configuration like |
|
20 | appropriate configuration files yourself: global configuration like | |
21 | the username setting is typically put into |
|
21 | the username setting is typically put into | |
22 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local |
|
22 | ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local | |
23 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. |
|
23 | configuration is put into the per-repository ``<repo>/.hg/hgrc`` file. | |
24 |
|
24 | |||
25 | The names of these files depend on the system on which Mercurial is |
|
25 | The names of these files depend on the system on which Mercurial is | |
26 | installed. ``*.rc`` files from a single directory are read in |
|
26 | installed. ``*.rc`` files from a single directory are read in | |
27 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
27 | alphabetical order, later ones overriding earlier ones. Where multiple | |
28 | paths are given below, settings from earlier paths override later |
|
28 | paths are given below, settings from earlier paths override later | |
29 | ones. |
|
29 | ones. | |
30 |
|
30 | |||
31 | | (All) ``<repo>/.hg/hgrc`` |
|
31 | | (All) ``<repo>/.hg/hgrc`` | |
32 |
|
32 | |||
33 | Per-repository configuration options that only apply in a |
|
33 | Per-repository configuration options that only apply in a | |
34 | particular repository. This file is not version-controlled, and |
|
34 | particular repository. This file is not version-controlled, and | |
35 | will not get transferred during a "clone" operation. Options in |
|
35 | will not get transferred during a "clone" operation. Options in | |
36 | this file override options in all other configuration files. On |
|
36 | this file override options in all other configuration files. On | |
37 | Plan 9 and Unix, most of this file will be ignored if it doesn't |
|
37 | Plan 9 and Unix, most of this file will be ignored if it doesn't | |
38 | belong to a trusted user or to a trusted group. See the documentation |
|
38 | belong to a trusted user or to a trusted group. See the documentation | |
39 | for the ``[trusted]`` section below for more details. |
|
39 | for the ``[trusted]`` section below for more details. | |
40 |
|
40 | |||
41 | | (Plan 9) ``$home/lib/hgrc`` |
|
41 | | (Plan 9) ``$home/lib/hgrc`` | |
42 | | (Unix) ``$HOME/.hgrc`` |
|
42 | | (Unix) ``$HOME/.hgrc`` | |
43 | | (Windows) ``%USERPROFILE%\.hgrc`` |
|
43 | | (Windows) ``%USERPROFILE%\.hgrc`` | |
44 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` |
|
44 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` | |
45 | | (Windows) ``%HOME%\.hgrc`` |
|
45 | | (Windows) ``%HOME%\.hgrc`` | |
46 | | (Windows) ``%HOME%\Mercurial.ini`` |
|
46 | | (Windows) ``%HOME%\Mercurial.ini`` | |
47 |
|
47 | |||
48 | Per-user configuration file(s), for the user running Mercurial. On |
|
48 | Per-user configuration file(s), for the user running Mercurial. On | |
49 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these |
|
49 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these | |
50 | files apply to all Mercurial commands executed by this user in any |
|
50 | files apply to all Mercurial commands executed by this user in any | |
51 | directory. Options in these files override per-system and per-installation |
|
51 | directory. Options in these files override per-system and per-installation | |
52 | options. |
|
52 | options. | |
53 |
|
53 | |||
54 | | (Plan 9) ``/lib/mercurial/hgrc`` |
|
54 | | (Plan 9) ``/lib/mercurial/hgrc`` | |
55 | | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc`` |
|
55 | | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc`` | |
56 | | (Unix) ``/etc/mercurial/hgrc`` |
|
56 | | (Unix) ``/etc/mercurial/hgrc`` | |
57 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` |
|
57 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` | |
58 |
|
58 | |||
59 | Per-system configuration files, for the system on which Mercurial |
|
59 | Per-system configuration files, for the system on which Mercurial | |
60 | is running. Options in these files apply to all Mercurial commands |
|
60 | is running. Options in these files apply to all Mercurial commands | |
61 | executed by any user in any directory. Options in these files |
|
61 | executed by any user in any directory. Options in these files | |
62 | override per-installation options. |
|
62 | override per-installation options. | |
63 |
|
63 | |||
64 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc`` |
|
64 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc`` | |
65 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc`` |
|
65 | | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc`` | |
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` |
|
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` | |
67 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` |
|
67 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` | |
68 |
|
68 | |||
69 | Per-installation configuration files, searched for in the |
|
69 | Per-installation configuration files, searched for in the | |
70 | directory where Mercurial is installed. ``<install-root>`` is the |
|
70 | directory where Mercurial is installed. ``<install-root>`` is the | |
71 | parent directory of the **hg** executable (or symlink) being run. For |
|
71 | parent directory of the **hg** executable (or symlink) being run. For | |
72 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look |
|
72 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look | |
73 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply |
|
73 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply | |
74 | to all Mercurial commands executed by any user in any directory. |
|
74 | to all Mercurial commands executed by any user in any directory. | |
75 |
|
75 | |||
76 | | (Windows) ``<install-dir>\Mercurial.ini`` **or** |
|
76 | | (Windows) ``<install-dir>\Mercurial.ini`` **or** | |
77 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or** |
|
77 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or** | |
78 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` |
|
78 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` | |
79 |
|
79 | |||
80 | Per-installation/system configuration files, for the system on |
|
80 | Per-installation/system configuration files, for the system on | |
81 | which Mercurial is running. Options in these files apply to all |
|
81 | which Mercurial is running. Options in these files apply to all | |
82 | Mercurial commands executed by any user in any directory. Registry |
|
82 | Mercurial commands executed by any user in any directory. Registry | |
83 | keys contain PATH-like strings, every part of which must reference |
|
83 | keys contain PATH-like strings, every part of which must reference | |
84 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
84 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
85 | be read. Mercurial checks each of these locations in the specified |
|
85 | be read. Mercurial checks each of these locations in the specified | |
86 | order until one or more configuration files are detected. |
|
86 | order until one or more configuration files are detected. | |
87 |
|
87 | |||
88 | Syntax |
|
88 | Syntax | |
89 | ====== |
|
89 | ====== | |
90 |
|
90 | |||
91 | A configuration file consists of sections, led by a ``[section]`` header |
|
91 | A configuration file consists of sections, led by a ``[section]`` header | |
92 | and followed by ``name = value`` entries (sometimes called |
|
92 | and followed by ``name = value`` entries (sometimes called | |
93 | ``configuration keys``):: |
|
93 | ``configuration keys``):: | |
94 |
|
94 | |||
95 | [spam] |
|
95 | [spam] | |
96 | eggs=ham |
|
96 | eggs=ham | |
97 | green= |
|
97 | green= | |
98 | eggs |
|
98 | eggs | |
99 |
|
99 | |||
100 | Each line contains one entry. If the lines that follow are indented, |
|
100 | Each line contains one entry. If the lines that follow are indented, | |
101 | they are treated as continuations of that entry. Leading whitespace is |
|
101 | they are treated as continuations of that entry. Leading whitespace is | |
102 | removed from values. Empty lines are skipped. Lines beginning with |
|
102 | removed from values. Empty lines are skipped. Lines beginning with | |
103 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
103 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
104 |
|
104 | |||
105 | Configuration keys can be set multiple times, in which case Mercurial |
|
105 | Configuration keys can be set multiple times, in which case Mercurial | |
106 | will use the value that was configured last. As an example:: |
|
106 | will use the value that was configured last. As an example:: | |
107 |
|
107 | |||
108 | [spam] |
|
108 | [spam] | |
109 | eggs=large |
|
109 | eggs=large | |
110 | ham=serrano |
|
110 | ham=serrano | |
111 | eggs=small |
|
111 | eggs=small | |
112 |
|
112 | |||
113 | This would set the configuration key named ``eggs`` to ``small``. |
|
113 | This would set the configuration key named ``eggs`` to ``small``. | |
114 |
|
114 | |||
115 | It is also possible to define a section multiple times. A section can |
|
115 | It is also possible to define a section multiple times. A section can | |
116 | be redefined on the same and/or on different configuration files. For |
|
116 | be redefined on the same and/or on different configuration files. For | |
117 | example:: |
|
117 | 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 configuration file, the purpose of each section, its possible |
|
177 | Mercurial configuration file, the purpose of each section, its possible | |
178 | keys, and their possible values. |
|
178 | keys, and their possible values. | |
179 |
|
179 | |||
180 | ``alias`` |
|
180 | ``alias`` | |
181 | --------- |
|
181 | --------- | |
182 |
|
182 | |||
183 | Defines command aliases. |
|
183 | Defines command aliases. | |
184 | Aliases allow you to define your own commands in terms of other |
|
184 | Aliases allow you to define your own commands in terms of other | |
185 | commands (or aliases), optionally including arguments. Positional |
|
185 | commands (or aliases), optionally including arguments. Positional | |
186 | arguments in the form of ``$1``, ``$2``, etc in the alias definition |
|
186 | arguments in the form of ``$1``, ``$2``, etc in the alias definition | |
187 | are expanded by Mercurial before execution. Positional arguments not |
|
187 | are expanded by Mercurial before execution. Positional arguments not | |
188 | already used by ``$N`` in the definition are put at the end of the |
|
188 | already used by ``$N`` in the definition are put at the end of the | |
189 | command to be executed. |
|
189 | command to be executed. | |
190 |
|
190 | |||
191 | Alias definitions consist of lines of the form:: |
|
191 | Alias definitions consist of lines of the form:: | |
192 |
|
192 | |||
193 | <alias> = <command> [<argument>]... |
|
193 | <alias> = <command> [<argument>]... | |
194 |
|
194 | |||
195 | For example, this definition:: |
|
195 | For example, this definition:: | |
196 |
|
196 | |||
197 | latest = log --limit 5 |
|
197 | latest = log --limit 5 | |
198 |
|
198 | |||
199 | creates a new command ``latest`` that shows only the five most recent |
|
199 | creates a new command ``latest`` that shows only the five most recent | |
200 | changesets. You can define subsequent aliases using earlier ones:: |
|
200 | changesets. You can define subsequent aliases using earlier ones:: | |
201 |
|
201 | |||
202 | stable5 = latest -b stable |
|
202 | stable5 = latest -b stable | |
203 |
|
203 | |||
204 | .. note:: It is possible to create aliases with the same names as |
|
204 | .. note:: It is possible to create aliases with the same names as | |
205 | existing commands, which will then override the original |
|
205 | existing commands, which will then override the original | |
206 | definitions. This is almost always a bad idea! |
|
206 | definitions. This is almost always a bad idea! | |
207 |
|
207 | |||
208 | An alias can start with an exclamation point (``!``) to make it a |
|
208 | An alias can start with an exclamation point (``!``) to make it a | |
209 | shell alias. A shell alias is executed with the shell and will let you |
|
209 | shell alias. A shell alias is executed with the shell and will let you | |
210 | run arbitrary commands. As an example, :: |
|
210 | run arbitrary commands. As an example, :: | |
211 |
|
211 | |||
212 | echo = !echo $@ |
|
212 | echo = !echo $@ | |
213 |
|
213 | |||
214 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
214 | will let you do ``hg echo foo`` to have ``foo`` printed in your | |
215 | terminal. A better example might be:: |
|
215 | terminal. A better example might be:: | |
216 |
|
216 | |||
217 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm |
|
217 | purge = !$HG status --no-status --unknown -0 | xargs -0 rm | |
218 |
|
218 | |||
219 | which will make ``hg purge`` delete all unknown files in the |
|
219 | which will make ``hg purge`` delete all unknown files in the | |
220 | repository in the same manner as the purge extension. |
|
220 | repository in the same manner as the purge extension. | |
221 |
|
221 | |||
222 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition |
|
222 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition | |
223 | expand to the command arguments. Unmatched arguments are |
|
223 | expand to the command arguments. Unmatched arguments are | |
224 | removed. ``$0`` expands to the alias name and ``$@`` expands to all |
|
224 | removed. ``$0`` expands to the alias name and ``$@`` expands to all | |
225 | arguments separated by a space. These expansions happen before the |
|
225 | arguments separated by a space. These expansions happen before the | |
226 | command is passed to the shell. |
|
226 | command is passed to the shell. | |
227 |
|
227 | |||
228 | Shell aliases are executed in an environment where ``$HG`` expands to |
|
228 | Shell aliases are executed in an environment where ``$HG`` expands to | |
229 | the path of the Mercurial that was used to execute the alias. This is |
|
229 | the path of the Mercurial that was used to execute the alias. This is | |
230 | useful when you want to call further Mercurial commands in a shell |
|
230 | useful when you want to call further Mercurial commands in a shell | |
231 | alias, as was done above for the purge alias. In addition, |
|
231 | alias, as was done above for the purge alias. In addition, | |
232 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg |
|
232 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg | |
233 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
233 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. | |
234 |
|
234 | |||
235 | .. note:: Some global configuration options such as ``-R`` are |
|
235 | .. note:: Some global configuration options such as ``-R`` are | |
236 | processed before shell aliases and will thus not be passed to |
|
236 | processed before shell aliases and will thus not be passed to | |
237 | aliases. |
|
237 | aliases. | |
238 |
|
238 | |||
239 |
|
239 | |||
240 | ``annotate`` |
|
240 | ``annotate`` | |
241 | ------------ |
|
241 | ------------ | |
242 |
|
242 | |||
243 | Settings used when displaying file annotations. All values are |
|
243 | Settings used when displaying file annotations. All values are | |
244 | Booleans and default to False. See ``diff`` section for related |
|
244 | Booleans and default to False. See ``diff`` section for related | |
245 | options for the diff command. |
|
245 | options for the diff command. | |
246 |
|
246 | |||
247 | ``ignorews`` |
|
247 | ``ignorews`` | |
248 | Ignore white space when comparing lines. |
|
248 | Ignore white space when comparing lines. | |
249 |
|
249 | |||
250 | ``ignorewsamount`` |
|
250 | ``ignorewsamount`` | |
251 | Ignore changes in the amount of white space. |
|
251 | Ignore changes in the amount of white space. | |
252 |
|
252 | |||
253 | ``ignoreblanklines`` |
|
253 | ``ignoreblanklines`` | |
254 | Ignore changes whose lines are all blank. |
|
254 | Ignore changes whose lines are all blank. | |
255 |
|
255 | |||
256 |
|
256 | |||
257 | ``auth`` |
|
257 | ``auth`` | |
258 | -------- |
|
258 | -------- | |
259 |
|
259 | |||
260 | Authentication credentials for HTTP authentication. This section |
|
260 | Authentication credentials for HTTP authentication. This section | |
261 | allows you to store usernames and passwords for use when logging |
|
261 | allows you to store usernames and passwords for use when logging | |
262 | *into* HTTP servers. See the ``[web]`` configuration section if |
|
262 | *into* HTTP servers. See the ``[web]`` configuration section if | |
263 | you want to configure *who* can login to your HTTP server. |
|
263 | you want to configure *who* can login to your HTTP server. | |
264 |
|
264 | |||
265 | Each line has the following format:: |
|
265 | Each line has the following format:: | |
266 |
|
266 | |||
267 | <name>.<argument> = <value> |
|
267 | <name>.<argument> = <value> | |
268 |
|
268 | |||
269 | where ``<name>`` is used to group arguments into authentication |
|
269 | where ``<name>`` is used to group arguments into authentication | |
270 | entries. Example:: |
|
270 | entries. Example:: | |
271 |
|
271 | |||
272 | foo.prefix = hg.intevation.org/mercurial |
|
272 | foo.prefix = hg.intevation.org/mercurial | |
273 | foo.username = foo |
|
273 | foo.username = foo | |
274 | foo.password = bar |
|
274 | foo.password = bar | |
275 | foo.schemes = http https |
|
275 | foo.schemes = http https | |
276 |
|
276 | |||
277 | bar.prefix = secure.example.org |
|
277 | bar.prefix = secure.example.org | |
278 | bar.key = path/to/file.key |
|
278 | bar.key = path/to/file.key | |
279 | bar.cert = path/to/file.cert |
|
279 | bar.cert = path/to/file.cert | |
280 | bar.schemes = https |
|
280 | bar.schemes = https | |
281 |
|
281 | |||
282 | Supported arguments: |
|
282 | Supported arguments: | |
283 |
|
283 | |||
284 | ``prefix`` |
|
284 | ``prefix`` | |
285 | Either ``*`` or a URI prefix with or without the scheme part. |
|
285 | Either ``*`` or a URI prefix with or without the scheme part. | |
286 | The authentication entry with the longest matching prefix is used |
|
286 | The authentication entry with the longest matching prefix is used | |
287 | (where ``*`` matches everything and counts as a match of length |
|
287 | (where ``*`` matches everything and counts as a match of length | |
288 | 1). If the prefix doesn't include a scheme, the match is performed |
|
288 | 1). If the prefix doesn't include a scheme, the match is performed | |
289 | against the URI with its scheme stripped as well, and the schemes |
|
289 | against the URI with its scheme stripped as well, and the schemes | |
290 | argument, q.v., is then subsequently consulted. |
|
290 | argument, q.v., is then subsequently consulted. | |
291 |
|
291 | |||
292 | ``username`` |
|
292 | ``username`` | |
293 | Optional. Username to authenticate with. If not given, and the |
|
293 | Optional. Username to authenticate with. If not given, and the | |
294 | remote site requires basic or digest authentication, the user will |
|
294 | remote site requires basic or digest authentication, the user will | |
295 | be prompted for it. Environment variables are expanded in the |
|
295 | be prompted for it. Environment variables are expanded in the | |
296 | username letting you do ``foo.username = $USER``. If the URI |
|
296 | username letting you do ``foo.username = $USER``. If the URI | |
297 | includes a username, only ``[auth]`` entries with a matching |
|
297 | includes a username, only ``[auth]`` entries with a matching | |
298 | username or without a username will be considered. |
|
298 | username or without a username will be considered. | |
299 |
|
299 | |||
300 | ``password`` |
|
300 | ``password`` | |
301 | Optional. Password to authenticate with. If not given, and the |
|
301 | Optional. Password to authenticate with. If not given, and the | |
302 | remote site requires basic or digest authentication, the user |
|
302 | remote site requires basic or digest authentication, the user | |
303 | will be prompted for it. |
|
303 | will be prompted for it. | |
304 |
|
304 | |||
305 | ``key`` |
|
305 | ``key`` | |
306 | Optional. PEM encoded client certificate key file. Environment |
|
306 | Optional. PEM encoded client certificate key file. Environment | |
307 | variables are expanded in the filename. |
|
307 | variables are expanded in the filename. | |
308 |
|
308 | |||
309 | ``cert`` |
|
309 | ``cert`` | |
310 | Optional. PEM encoded client certificate chain file. Environment |
|
310 | Optional. PEM encoded client certificate chain file. Environment | |
311 | variables are expanded in the filename. |
|
311 | variables are expanded in the filename. | |
312 |
|
312 | |||
313 | ``schemes`` |
|
313 | ``schemes`` | |
314 | Optional. Space separated list of URI schemes to use this |
|
314 | Optional. Space separated list of URI schemes to use this | |
315 | authentication entry with. Only used if the prefix doesn't include |
|
315 | authentication entry with. Only used if the prefix doesn't include | |
316 | a scheme. Supported schemes are http and https. They will match |
|
316 | a scheme. Supported schemes are http and https. They will match | |
317 | static-http and static-https respectively, as well. |
|
317 | static-http and static-https respectively, as well. | |
318 | Default: https. |
|
318 | Default: https. | |
319 |
|
319 | |||
320 | If no suitable authentication entry is found, the user is prompted |
|
320 | If no suitable authentication entry is found, the user is prompted | |
321 | for credentials as usual if required by the remote. |
|
321 | for credentials as usual if required by the remote. | |
322 |
|
322 | |||
323 |
|
323 | |||
324 | ``decode/encode`` |
|
324 | ``decode/encode`` | |
325 | ----------------- |
|
325 | ----------------- | |
326 |
|
326 | |||
327 | Filters for transforming files on checkout/checkin. This would |
|
327 | Filters for transforming files on checkout/checkin. This would | |
328 | typically be used for newline processing or other |
|
328 | typically be used for newline processing or other | |
329 | localization/canonicalization of files. |
|
329 | localization/canonicalization of files. | |
330 |
|
330 | |||
331 | Filters consist of a filter pattern followed by a filter command. |
|
331 | Filters consist of a filter pattern followed by a filter command. | |
332 | Filter patterns are globs by default, rooted at the repository root. |
|
332 | Filter patterns are globs by default, rooted at the repository root. | |
333 | For example, to match any file ending in ``.txt`` in the root |
|
333 | For example, to match any file ending in ``.txt`` in the root | |
334 | directory only, use the pattern ``*.txt``. To match any file ending |
|
334 | directory only, use the pattern ``*.txt``. To match any file ending | |
335 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
335 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
336 | For each file only the first matching filter applies. |
|
336 | For each file only the first matching filter applies. | |
337 |
|
337 | |||
338 | The filter command can start with a specifier, either ``pipe:`` or |
|
338 | The filter command can start with a specifier, either ``pipe:`` or | |
339 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
339 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
340 |
|
340 | |||
341 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
341 | A ``pipe:`` command must accept data on stdin and return the transformed | |
342 | data on stdout. |
|
342 | data on stdout. | |
343 |
|
343 | |||
344 | Pipe example:: |
|
344 | Pipe example:: | |
345 |
|
345 | |||
346 | [encode] |
|
346 | [encode] | |
347 | # uncompress gzip files on checkin to improve delta compression |
|
347 | # uncompress gzip files on checkin to improve delta compression | |
348 | # note: not necessarily a good idea, just an example |
|
348 | # note: not necessarily a good idea, just an example | |
349 | *.gz = pipe: gunzip |
|
349 | *.gz = pipe: gunzip | |
350 |
|
350 | |||
351 | [decode] |
|
351 | [decode] | |
352 | # recompress gzip files when writing them to the working dir (we |
|
352 | # recompress gzip files when writing them to the working dir (we | |
353 | # can safely omit "pipe:", because it's the default) |
|
353 | # can safely omit "pipe:", because it's the default) | |
354 | *.gz = gzip |
|
354 | *.gz = gzip | |
355 |
|
355 | |||
356 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
356 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
357 | with the name of a temporary file that contains the data to be |
|
357 | with the name of a temporary file that contains the data to be | |
358 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
358 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
359 | of an empty temporary file, where the filtered data must be written by |
|
359 | of an empty temporary file, where the filtered data must be written by | |
360 | the command. |
|
360 | the command. | |
361 |
|
361 | |||
362 | .. note:: The tempfile mechanism is recommended for Windows systems, |
|
362 | .. note:: The tempfile mechanism is recommended for Windows systems, | |
363 | where the standard shell I/O redirection operators often have |
|
363 | where the standard shell I/O redirection operators often have | |
364 | strange effects and may corrupt the contents of your files. |
|
364 | strange effects and may corrupt the contents of your files. | |
365 |
|
365 | |||
366 | This filter mechanism is used internally by the ``eol`` extension to |
|
366 | This filter mechanism is used internally by the ``eol`` extension to | |
367 | translate line ending characters between Windows (CRLF) and Unix (LF) |
|
367 | translate line ending characters between Windows (CRLF) and Unix (LF) | |
368 | format. We suggest you use the ``eol`` extension for convenience. |
|
368 | format. We suggest you use the ``eol`` extension for convenience. | |
369 |
|
369 | |||
370 |
|
370 | |||
371 | ``defaults`` |
|
371 | ``defaults`` | |
372 | ------------ |
|
372 | ------------ | |
373 |
|
373 | |||
374 | (defaults are deprecated. Don't use them. Use aliases instead) |
|
374 | (defaults are deprecated. Don't use them. Use aliases instead) | |
375 |
|
375 | |||
376 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
376 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
377 | default options/arguments to pass to the specified commands. |
|
377 | default options/arguments to pass to the specified commands. | |
378 |
|
378 | |||
379 | The following example makes :hg:`log` run in verbose mode, and |
|
379 | The following example makes :hg:`log` run in verbose mode, and | |
380 | :hg:`status` show only the modified files, by default:: |
|
380 | :hg:`status` show only the modified files, by default:: | |
381 |
|
381 | |||
382 | [defaults] |
|
382 | [defaults] | |
383 | log = -v |
|
383 | log = -v | |
384 | status = -m |
|
384 | status = -m | |
385 |
|
385 | |||
386 | The actual commands, instead of their aliases, must be used when |
|
386 | The actual commands, instead of their aliases, must be used when | |
387 | defining command defaults. The command defaults will also be applied |
|
387 | defining command defaults. The command defaults will also be applied | |
388 | to the aliases of the commands defined. |
|
388 | to the aliases of the commands defined. | |
389 |
|
389 | |||
390 |
|
390 | |||
391 | ``diff`` |
|
391 | ``diff`` | |
392 | -------- |
|
392 | -------- | |
393 |
|
393 | |||
394 | Settings used when displaying diffs. Everything except for ``unified`` |
|
394 | Settings used when displaying diffs. Everything except for ``unified`` | |
395 | is a Boolean and defaults to False. See ``annotate`` section for |
|
395 | is a Boolean and defaults to False. See ``annotate`` section for | |
396 | related options for the annotate command. |
|
396 | related options for the annotate command. | |
397 |
|
397 | |||
398 | ``git`` |
|
398 | ``git`` | |
399 | Use git extended diff format. |
|
399 | Use git extended diff format. | |
400 |
|
400 | |||
401 | ``nodates`` |
|
401 | ``nodates`` | |
402 | Don't include dates in diff headers. |
|
402 | Don't include dates in diff headers. | |
403 |
|
403 | |||
404 | ``showfunc`` |
|
404 | ``showfunc`` | |
405 | Show which function each change is in. |
|
405 | Show which function each change is in. | |
406 |
|
406 | |||
407 | ``ignorews`` |
|
407 | ``ignorews`` | |
408 | Ignore white space when comparing lines. |
|
408 | Ignore white space when comparing lines. | |
409 |
|
409 | |||
410 | ``ignorewsamount`` |
|
410 | ``ignorewsamount`` | |
411 | Ignore changes in the amount of white space. |
|
411 | Ignore changes in the amount of white space. | |
412 |
|
412 | |||
413 | ``ignoreblanklines`` |
|
413 | ``ignoreblanklines`` | |
414 | Ignore changes whose lines are all blank. |
|
414 | Ignore changes whose lines are all blank. | |
415 |
|
415 | |||
416 | ``unified`` |
|
416 | ``unified`` | |
417 | Number of lines of context to show. |
|
417 | Number of lines of context to show. | |
418 |
|
418 | |||
419 | ``email`` |
|
419 | ``email`` | |
420 | --------- |
|
420 | --------- | |
421 |
|
421 | |||
422 | Settings for extensions that send email messages. |
|
422 | Settings for extensions that send email messages. | |
423 |
|
423 | |||
424 | ``from`` |
|
424 | ``from`` | |
425 | Optional. Email address to use in "From" header and SMTP envelope |
|
425 | Optional. Email address to use in "From" header and SMTP envelope | |
426 | of outgoing messages. |
|
426 | of outgoing messages. | |
427 |
|
427 | |||
428 | ``to`` |
|
428 | ``to`` | |
429 | Optional. Comma-separated list of recipients' email addresses. |
|
429 | Optional. Comma-separated list of recipients' email addresses. | |
430 |
|
430 | |||
431 | ``cc`` |
|
431 | ``cc`` | |
432 | Optional. Comma-separated list of carbon copy recipients' |
|
432 | Optional. Comma-separated list of carbon copy recipients' | |
433 | email addresses. |
|
433 | email addresses. | |
434 |
|
434 | |||
435 | ``bcc`` |
|
435 | ``bcc`` | |
436 | Optional. Comma-separated list of blind carbon copy recipients' |
|
436 | Optional. Comma-separated list of blind carbon copy recipients' | |
437 | email addresses. |
|
437 | email addresses. | |
438 |
|
438 | |||
439 | ``method`` |
|
439 | ``method`` | |
440 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
440 | Optional. Method to use to send email messages. If value is ``smtp`` | |
441 | (default), use SMTP (see the ``[smtp]`` section for configuration). |
|
441 | (default), use SMTP (see the ``[smtp]`` section for configuration). | |
442 | Otherwise, use as name of program to run that acts like sendmail |
|
442 | Otherwise, use as name of program to run that acts like sendmail | |
443 | (takes ``-f`` option for sender, list of recipients on command line, |
|
443 | (takes ``-f`` option for sender, list of recipients on command line, | |
444 | message on stdin). Normally, setting this to ``sendmail`` or |
|
444 | message on stdin). Normally, setting this to ``sendmail`` or | |
445 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
445 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
446 |
|
446 | |||
447 | ``charsets`` |
|
447 | ``charsets`` | |
448 | Optional. Comma-separated list of character sets considered |
|
448 | Optional. Comma-separated list of character sets considered | |
449 | convenient for recipients. Addresses, headers, and parts not |
|
449 | convenient for recipients. Addresses, headers, and parts not | |
450 | containing patches of outgoing messages will be encoded in the |
|
450 | containing patches of outgoing messages will be encoded in the | |
451 | first character set to which conversion from local encoding |
|
451 | first character set to which conversion from local encoding | |
452 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
452 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
453 | conversion fails, the text in question is sent as is. Defaults to |
|
453 | conversion fails, the text in question is sent as is. Defaults to | |
454 | empty (explicit) list. |
|
454 | empty (explicit) list. | |
455 |
|
455 | |||
456 | Order of outgoing email character sets: |
|
456 | Order of outgoing email character sets: | |
457 |
|
457 | |||
458 | 1. ``us-ascii``: always first, regardless of settings |
|
458 | 1. ``us-ascii``: always first, regardless of settings | |
459 | 2. ``email.charsets``: in order given by user |
|
459 | 2. ``email.charsets``: in order given by user | |
460 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
460 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
461 | 4. ``$HGENCODING``: if not in email.charsets |
|
461 | 4. ``$HGENCODING``: if not in email.charsets | |
462 | 5. ``utf-8``: always last, regardless of settings |
|
462 | 5. ``utf-8``: always last, regardless of settings | |
463 |
|
463 | |||
464 | Email example:: |
|
464 | Email example:: | |
465 |
|
465 | |||
466 | [email] |
|
466 | [email] | |
467 | from = Joseph User <joe.user@example.com> |
|
467 | from = Joseph User <joe.user@example.com> | |
468 | method = /usr/sbin/sendmail |
|
468 | method = /usr/sbin/sendmail | |
469 | # charsets for western Europeans |
|
469 | # charsets for western Europeans | |
470 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
470 | # us-ascii, utf-8 omitted, as they are tried first and last | |
471 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
471 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
472 |
|
472 | |||
473 |
|
473 | |||
474 | ``extensions`` |
|
474 | ``extensions`` | |
475 | -------------- |
|
475 | -------------- | |
476 |
|
476 | |||
477 | Mercurial has an extension mechanism for adding new features. To |
|
477 | Mercurial has an extension mechanism for adding new features. To | |
478 | enable an extension, create an entry for it in this section. |
|
478 | enable an extension, create an entry for it in this section. | |
479 |
|
479 | |||
480 | If you know that the extension is already in Python's search path, |
|
480 | If you know that the extension is already in Python's search path, | |
481 | you can give the name of the module, followed by ``=``, with nothing |
|
481 | you can give the name of the module, followed by ``=``, with nothing | |
482 | after the ``=``. |
|
482 | after the ``=``. | |
483 |
|
483 | |||
484 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
484 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
485 | the path to the ``.py`` file (including the file name extension) that |
|
485 | the path to the ``.py`` file (including the file name extension) that | |
486 | defines the extension. |
|
486 | defines the extension. | |
487 |
|
487 | |||
488 | To explicitly disable an extension that is enabled in an hgrc of |
|
488 | To explicitly disable an extension that is enabled in an hgrc of | |
489 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` |
|
489 | broader scope, prepend its path with ``!``, as in ``foo = !/ext/path`` | |
490 | or ``foo = !`` when path is not supplied. |
|
490 | or ``foo = !`` when path is not supplied. | |
491 |
|
491 | |||
492 | Example for ``~/.hgrc``:: |
|
492 | Example for ``~/.hgrc``:: | |
493 |
|
493 | |||
494 | [extensions] |
|
494 | [extensions] | |
495 | # (the mq extension will get loaded from Mercurial's path) |
|
495 | # (the mq extension will get loaded from Mercurial's path) | |
496 | mq = |
|
496 | mq = | |
497 | # (this extension will get loaded from the file specified) |
|
497 | # (this extension will get loaded from the file specified) | |
498 | myfeature = ~/.hgext/myfeature.py |
|
498 | myfeature = ~/.hgext/myfeature.py | |
499 |
|
499 | |||
500 |
|
500 | |||
501 | ``format`` |
|
501 | ``format`` | |
502 | ---------- |
|
502 | ---------- | |
503 |
|
503 | |||
504 | ``usestore`` |
|
504 | ``usestore`` | |
505 | Enable or disable the "store" repository format which improves |
|
505 | Enable or disable the "store" repository format which improves | |
506 | compatibility with systems that fold case or otherwise mangle |
|
506 | compatibility with systems that fold case or otherwise mangle | |
507 | filenames. Enabled by default. Disabling this option will allow |
|
507 | filenames. Enabled by default. Disabling this option will allow | |
508 | you to store longer filenames in some situations at the expense of |
|
508 | you to store longer filenames in some situations at the expense of | |
509 | compatibility and ensures that the on-disk format of newly created |
|
509 | compatibility and ensures that the on-disk format of newly created | |
510 | repositories will be compatible with Mercurial before version 0.9.4. |
|
510 | repositories will be compatible with Mercurial before version 0.9.4. | |
511 |
|
511 | |||
512 | ``usefncache`` |
|
512 | ``usefncache`` | |
513 | Enable or disable the "fncache" repository format which enhances |
|
513 | Enable or disable the "fncache" repository format which enhances | |
514 | the "store" repository format (which has to be enabled to use |
|
514 | the "store" repository format (which has to be enabled to use | |
515 | fncache) to allow longer filenames and avoids using Windows |
|
515 | fncache) to allow longer filenames and avoids using Windows | |
516 | reserved names, e.g. "nul". Enabled by default. Disabling this |
|
516 | reserved names, e.g. "nul". Enabled by default. Disabling this | |
517 | option ensures that the on-disk format of newly created |
|
517 | option ensures that the on-disk format of newly created | |
518 | repositories will be compatible with Mercurial before version 1.1. |
|
518 | repositories will be compatible with Mercurial before version 1.1. | |
519 |
|
519 | |||
520 | ``dotencode`` |
|
520 | ``dotencode`` | |
521 | Enable or disable the "dotencode" repository format which enhances |
|
521 | Enable or disable the "dotencode" repository format which enhances | |
522 | the "fncache" repository format (which has to be enabled to use |
|
522 | the "fncache" repository format (which has to be enabled to use | |
523 | dotencode) to avoid issues with filenames starting with ._ on |
|
523 | dotencode) to avoid issues with filenames starting with ._ on | |
524 | Mac OS X and spaces on Windows. Enabled by default. Disabling this |
|
524 | Mac OS X and spaces on Windows. Enabled by default. Disabling this | |
525 | option ensures that the on-disk format of newly created |
|
525 | option ensures that the on-disk format of newly created | |
526 | repositories will be compatible with Mercurial before version 1.7. |
|
526 | repositories will be compatible with Mercurial before version 1.7. | |
527 |
|
527 | |||
528 | ``graph`` |
|
528 | ``graph`` | |
529 | --------- |
|
529 | --------- | |
530 |
|
530 | |||
531 | Web graph view configuration. This section let you change graph |
|
531 | Web graph view configuration. This section let you change graph | |
532 | elements display properties by branches, for instance to make the |
|
532 | elements display properties by branches, for instance to make the | |
533 | ``default`` branch stand out. |
|
533 | ``default`` branch stand out. | |
534 |
|
534 | |||
535 | Each line has the following format:: |
|
535 | Each line has the following format:: | |
536 |
|
536 | |||
537 | <branch>.<argument> = <value> |
|
537 | <branch>.<argument> = <value> | |
538 |
|
538 | |||
539 | where ``<branch>`` is the name of the branch being |
|
539 | where ``<branch>`` is the name of the branch being | |
540 | customized. Example:: |
|
540 | customized. Example:: | |
541 |
|
541 | |||
542 | [graph] |
|
542 | [graph] | |
543 | # 2px width |
|
543 | # 2px width | |
544 | default.width = 2 |
|
544 | default.width = 2 | |
545 | # red color |
|
545 | # red color | |
546 | default.color = FF0000 |
|
546 | default.color = FF0000 | |
547 |
|
547 | |||
548 | Supported arguments: |
|
548 | Supported arguments: | |
549 |
|
549 | |||
550 | ``width`` |
|
550 | ``width`` | |
551 | Set branch edges width in pixels. |
|
551 | Set branch edges width in pixels. | |
552 |
|
552 | |||
553 | ``color`` |
|
553 | ``color`` | |
554 | Set branch edges color in hexadecimal RGB notation. |
|
554 | Set branch edges color in hexadecimal RGB notation. | |
555 |
|
555 | |||
556 | ``hooks`` |
|
556 | ``hooks`` | |
557 | --------- |
|
557 | --------- | |
558 |
|
558 | |||
559 | Commands or Python functions that get automatically executed by |
|
559 | Commands or Python functions that get automatically executed by | |
560 | various actions such as starting or finishing a commit. Multiple |
|
560 | various actions such as starting or finishing a commit. Multiple | |
561 | hooks can be run for the same action by appending a suffix to the |
|
561 | hooks can be run for the same action by appending a suffix to the | |
562 | action. Overriding a site-wide hook can be done by changing its |
|
562 | action. Overriding a site-wide hook can be done by changing its | |
563 | value or setting it to an empty string. Hooks can be prioritized |
|
563 | value or setting it to an empty string. Hooks can be prioritized | |
564 | by adding a prefix of ``priority`` to the hook name on a new line |
|
564 | by adding a prefix of ``priority`` to the hook name on a new line | |
565 | and setting the priority. The default priority is 0 if |
|
565 | and setting the priority. The default priority is 0 if | |
566 | not specified. |
|
566 | not specified. | |
567 |
|
567 | |||
568 | Example ``.hg/hgrc``:: |
|
568 | Example ``.hg/hgrc``:: | |
569 |
|
569 | |||
570 | [hooks] |
|
570 | [hooks] | |
571 | # update working directory after adding changesets |
|
571 | # update working directory after adding changesets | |
572 | changegroup.update = hg update |
|
572 | changegroup.update = hg update | |
573 | # do not use the site-wide hook |
|
573 | # do not use the site-wide hook | |
574 | incoming = |
|
574 | incoming = | |
575 | incoming.email = /my/email/hook |
|
575 | incoming.email = /my/email/hook | |
576 | incoming.autobuild = /my/build/hook |
|
576 | incoming.autobuild = /my/build/hook | |
577 | # force autobuild hook to run before other incoming hooks |
|
577 | # force autobuild hook to run before other incoming hooks | |
578 | priority.incoming.autobuild = 1 |
|
578 | priority.incoming.autobuild = 1 | |
579 |
|
579 | |||
580 | Most hooks are run with environment variables set that give useful |
|
580 | Most hooks are run with environment variables set that give useful | |
581 | additional information. For each hook below, the environment |
|
581 | additional information. For each hook below, the environment | |
582 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
582 | variables it is passed are listed with names of the form ``$HG_foo``. | |
583 |
|
583 | |||
584 | ``changegroup`` |
|
584 | ``changegroup`` | |
585 | Run after a changegroup has been added via push, pull or unbundle. |
|
585 | Run after a changegroup has been added via push, pull or unbundle. | |
586 | ID of the first new changeset is in ``$HG_NODE``. URL from which |
|
586 | ID of the first new changeset is in ``$HG_NODE``. URL from which | |
587 | changes came is in ``$HG_URL``. |
|
587 | changes came is in ``$HG_URL``. | |
588 |
|
588 | |||
589 | ``commit`` |
|
589 | ``commit`` | |
590 | Run after a changeset has been created in the local repository. ID |
|
590 | Run after a changeset has been created in the local repository. ID | |
591 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
591 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
592 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
592 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
593 |
|
593 | |||
594 | ``incoming`` |
|
594 | ``incoming`` | |
595 | Run after a changeset has been pulled, pushed, or unbundled into |
|
595 | Run after a changeset has been pulled, pushed, or unbundled into | |
596 | the local repository. The ID of the newly arrived changeset is in |
|
596 | the local repository. The ID of the newly arrived changeset is in | |
597 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
597 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. | |
598 |
|
598 | |||
599 | ``outgoing`` |
|
599 | ``outgoing`` | |
600 | Run after sending changes from local repository to another. ID of |
|
600 | Run after sending changes from local repository to another. ID of | |
601 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
601 | first changeset sent is in ``$HG_NODE``. Source of operation is in | |
602 | ``$HG_SOURCE``; see "preoutgoing" hook for description. |
|
602 | ``$HG_SOURCE``; see "preoutgoing" hook for description. | |
603 |
|
603 | |||
604 | ``post-<command>`` |
|
604 | ``post-<command>`` | |
605 | Run after successful invocations of the associated command. The |
|
605 | Run after successful invocations of the associated command. The | |
606 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
606 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
607 | code in ``$HG_RESULT``. Parsed command line arguments are passed as |
|
607 | code in ``$HG_RESULT``. Parsed command line arguments are passed as | |
608 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of |
|
608 | ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of | |
609 | the python data internally passed to <command>. ``$HG_OPTS`` is a |
|
609 | the python data internally passed to <command>. ``$HG_OPTS`` is a | |
610 | dictionary of options (with unspecified options set to their defaults). |
|
610 | dictionary of options (with unspecified options set to their defaults). | |
611 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. |
|
611 | ``$HG_PATS`` is a list of arguments. Hook failure is ignored. | |
612 |
|
612 | |||
613 | ``pre-<command>`` |
|
613 | ``pre-<command>`` | |
614 | Run before executing the associated command. The contents of the |
|
614 | Run before executing the associated command. The contents of the | |
615 | command line are passed as ``$HG_ARGS``. Parsed command line arguments |
|
615 | command line are passed as ``$HG_ARGS``. Parsed command line arguments | |
616 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string |
|
616 | are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string | |
617 | representations of the data internally passed to <command>. ``$HG_OPTS`` |
|
617 | representations of the data internally passed to <command>. ``$HG_OPTS`` | |
618 | is a dictionary of options (with unspecified options set to their |
|
618 | is a dictionary of options (with unspecified options set to their | |
619 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns |
|
619 | defaults). ``$HG_PATS`` is a list of arguments. If the hook returns | |
620 | failure, the command doesn't execute and Mercurial returns the failure |
|
620 | failure, the command doesn't execute and Mercurial returns the failure | |
621 | code. |
|
621 | code. | |
622 |
|
622 | |||
623 | ``prechangegroup`` |
|
623 | ``prechangegroup`` | |
624 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
624 | Run before a changegroup is added via push, pull or unbundle. Exit | |
625 | status 0 allows the changegroup to proceed. Non-zero status will |
|
625 | status 0 allows the changegroup to proceed. Non-zero status will | |
626 | cause the push, pull or unbundle to fail. URL from which changes |
|
626 | cause the push, pull or unbundle to fail. URL from which changes | |
627 | will come is in ``$HG_URL``. |
|
627 | will come is in ``$HG_URL``. | |
628 |
|
628 | |||
629 | ``precommit`` |
|
629 | ``precommit`` | |
630 | Run before starting a local commit. Exit status 0 allows the |
|
630 | Run before starting a local commit. Exit status 0 allows the | |
631 | commit to proceed. Non-zero status will cause the commit to fail. |
|
631 | commit to proceed. Non-zero status will cause the commit to fail. | |
632 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
632 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
633 |
|
633 | |||
634 | ``prelistkeys`` |
|
634 | ``prelistkeys`` | |
635 | Run before listing pushkeys (like bookmarks) in the |
|
635 | Run before listing pushkeys (like bookmarks) in the | |
636 | repository. Non-zero status will cause failure. The key namespace is |
|
636 | repository. Non-zero status will cause failure. The key namespace is | |
637 | in ``$HG_NAMESPACE``. |
|
637 | in ``$HG_NAMESPACE``. | |
638 |
|
638 | |||
639 | ``preoutgoing`` |
|
639 | ``preoutgoing`` | |
640 | Run before collecting changes to send from the local repository to |
|
640 | Run before collecting changes to send from the local repository to | |
641 | another. Non-zero status will cause failure. This lets you prevent |
|
641 | another. Non-zero status will cause failure. This lets you prevent | |
642 | pull over HTTP or SSH. Also prevents against local pull, push |
|
642 | pull over HTTP or SSH. Also prevents against local pull, push | |
643 | (outbound) or bundle commands, but not effective, since you can |
|
643 | (outbound) or bundle commands, but not effective, since you can | |
644 | just copy files instead then. Source of operation is in |
|
644 | just copy files instead then. Source of operation is in | |
645 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
645 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote | |
646 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
646 | SSH or HTTP repository. If "push", "pull" or "bundle", operation | |
647 | is happening on behalf of repository on same system. |
|
647 | is happening on behalf of repository on same system. | |
648 |
|
648 | |||
649 | ``prepushkey`` |
|
649 | ``prepushkey`` | |
650 | Run before a pushkey (like a bookmark) is added to the |
|
650 | Run before a pushkey (like a bookmark) is added to the | |
651 | repository. Non-zero status will cause the key to be rejected. The |
|
651 | repository. Non-zero status will cause the key to be rejected. The | |
652 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, |
|
652 | key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``, | |
653 | the old value (if any) is in ``$HG_OLD``, and the new value is in |
|
653 | the old value (if any) is in ``$HG_OLD``, and the new value is in | |
654 | ``$HG_NEW``. |
|
654 | ``$HG_NEW``. | |
655 |
|
655 | |||
656 | ``pretag`` |
|
656 | ``pretag`` | |
657 | Run before creating a tag. Exit status 0 allows the tag to be |
|
657 | Run before creating a tag. Exit status 0 allows the tag to be | |
658 | created. Non-zero status will cause the tag to fail. ID of |
|
658 | created. Non-zero status will cause the tag to fail. ID of | |
659 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
659 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is | |
660 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
660 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. | |
661 |
|
661 | |||
662 | ``pretxnchangegroup`` |
|
662 | ``pretxnchangegroup`` | |
663 | Run after a changegroup has been added via push, pull or unbundle, |
|
663 | Run after a changegroup has been added via push, pull or unbundle, | |
664 | but before the transaction has been committed. Changegroup is |
|
664 | but before the transaction has been committed. Changegroup is | |
665 | visible to hook program. This lets you validate incoming changes |
|
665 | visible to hook program. This lets you validate incoming changes | |
666 | before accepting them. Passed the ID of the first new changeset in |
|
666 | before accepting them. Passed the ID of the first new changeset in | |
667 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero |
|
667 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero | |
668 | status will cause the transaction to be rolled back and the push, |
|
668 | status will cause the transaction to be rolled back and the push, | |
669 | pull or unbundle will fail. URL that was source of changes is in |
|
669 | pull or unbundle will fail. URL that was source of changes is in | |
670 | ``$HG_URL``. |
|
670 | ``$HG_URL``. | |
671 |
|
671 | |||
672 | ``pretxncommit`` |
|
672 | ``pretxncommit`` | |
673 | Run after a changeset has been created but the transaction not yet |
|
673 | Run after a changeset has been created but the transaction not yet | |
674 | committed. Changeset is visible to hook program. This lets you |
|
674 | committed. Changeset is visible to hook program. This lets you | |
675 | validate commit message and changes. Exit status 0 allows the |
|
675 | validate commit message and changes. Exit status 0 allows the | |
676 | commit to proceed. Non-zero status will cause the transaction to |
|
676 | commit to proceed. Non-zero status will cause the transaction to | |
677 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
677 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset | |
678 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
678 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
679 |
|
679 | |||
680 | ``preupdate`` |
|
680 | ``preupdate`` | |
681 | Run before updating the working directory. Exit status 0 allows |
|
681 | Run before updating the working directory. Exit status 0 allows | |
682 | the update to proceed. Non-zero status will prevent the update. |
|
682 | the update to proceed. Non-zero status will prevent the update. | |
683 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
683 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID | |
684 | of second new parent is in ``$HG_PARENT2``. |
|
684 | of second new parent is in ``$HG_PARENT2``. | |
685 |
|
685 | |||
686 | ``listkeys`` |
|
686 | ``listkeys`` | |
687 | Run after listing pushkeys (like bookmarks) in the repository. The |
|
687 | Run after listing pushkeys (like bookmarks) in the repository. The | |
688 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a |
|
688 | key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a | |
689 | dictionary containing the keys and values. |
|
689 | dictionary containing the keys and values. | |
690 |
|
690 | |||
691 | ``pushkey`` |
|
691 | ``pushkey`` | |
692 | Run after a pushkey (like a bookmark) is added to the |
|
692 | Run after a pushkey (like a bookmark) is added to the | |
693 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in |
|
693 | repository. The key namespace is in ``$HG_NAMESPACE``, the key is in | |
694 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new |
|
694 | ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new | |
695 | value is in ``$HG_NEW``. |
|
695 | value is in ``$HG_NEW``. | |
696 |
|
696 | |||
697 | ``tag`` |
|
697 | ``tag`` | |
698 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
698 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. | |
699 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
699 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in | |
700 | repository if ``$HG_LOCAL=0``. |
|
700 | repository if ``$HG_LOCAL=0``. | |
701 |
|
701 | |||
702 | ``update`` |
|
702 | ``update`` | |
703 | Run after updating the working directory. Changeset ID of first |
|
703 | Run after updating the working directory. Changeset ID of first | |
704 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
704 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is | |
705 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
705 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
706 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
706 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. | |
707 |
|
707 | |||
708 | .. note:: It is generally better to use standard hooks rather than the |
|
708 | .. note:: It is generally better to use standard hooks rather than the | |
709 | generic pre- and post- command hooks as they are guaranteed to be |
|
709 | generic pre- and post- command hooks as they are guaranteed to be | |
710 | called in the appropriate contexts for influencing transactions. |
|
710 | called in the appropriate contexts for influencing transactions. | |
711 | Also, hooks like "commit" will be called in all contexts that |
|
711 | Also, hooks like "commit" will be called in all contexts that | |
712 | generate a commit (e.g. tag) and not just the commit command. |
|
712 | generate a commit (e.g. tag) and not just the commit command. | |
713 |
|
713 | |||
714 | .. note:: Environment variables with empty values may not be passed to |
|
714 | .. note:: Environment variables with empty values may not be passed to | |
715 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
715 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
716 | will have an empty value under Unix-like platforms for non-merge |
|
716 | will have an empty value under Unix-like platforms for non-merge | |
717 | changesets, while it will not be available at all under Windows. |
|
717 | changesets, while it will not be available at all under Windows. | |
718 |
|
718 | |||
719 | The syntax for Python hooks is as follows:: |
|
719 | The syntax for Python hooks is as follows:: | |
720 |
|
720 | |||
721 | hookname = python:modulename.submodule.callable |
|
721 | hookname = python:modulename.submodule.callable | |
722 | hookname = python:/path/to/python/module.py:callable |
|
722 | hookname = python:/path/to/python/module.py:callable | |
723 |
|
723 | |||
724 | Python hooks are run within the Mercurial process. Each hook is |
|
724 | Python hooks are run within the Mercurial process. Each hook is | |
725 | called with at least three keyword arguments: a ui object (keyword |
|
725 | called with at least three keyword arguments: a ui object (keyword | |
726 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
726 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
727 | keyword that tells what kind of hook is used. Arguments listed as |
|
727 | keyword that tells what kind of hook is used. Arguments listed as | |
728 | environment variables above are passed as keyword arguments, with no |
|
728 | environment variables above are passed as keyword arguments, with no | |
729 | ``HG_`` prefix, and names in lower case. |
|
729 | ``HG_`` prefix, and names in lower case. | |
730 |
|
730 | |||
731 | If a Python hook returns a "true" value or raises an exception, this |
|
731 | If a Python hook returns a "true" value or raises an exception, this | |
732 | is treated as a failure. |
|
732 | is treated as a failure. | |
733 |
|
733 | |||
734 |
|
734 | |||
735 | ``hostfingerprints`` |
|
735 | ``hostfingerprints`` | |
736 | -------------------- |
|
736 | -------------------- | |
737 |
|
737 | |||
738 | Fingerprints of the certificates of known HTTPS servers. |
|
738 | Fingerprints of the certificates of known HTTPS servers. | |
739 | A HTTPS connection to a server with a fingerprint configured here will |
|
739 | A HTTPS connection to a server with a fingerprint configured here will | |
740 | only succeed if the servers certificate matches the fingerprint. |
|
740 | only succeed if the servers certificate matches the fingerprint. | |
741 | This is very similar to how ssh known hosts works. |
|
741 | This is very similar to how ssh known hosts works. | |
742 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. |
|
742 | The fingerprint is the SHA-1 hash value of the DER encoded certificate. | |
743 | The CA chain and web.cacerts is not used for servers with a fingerprint. |
|
743 | The CA chain and web.cacerts is not used for servers with a fingerprint. | |
744 |
|
744 | |||
745 | For example:: |
|
745 | For example:: | |
746 |
|
746 | |||
747 | [hostfingerprints] |
|
747 | [hostfingerprints] | |
748 | hg.intevation.org = 44:ed:af:1f:97:11:b6:01:7a:48:45:fc:10:3c:b7:f9:d4:89:2a:9d |
|
748 | hg.intevation.org = 44:ed:af:1f:97:11:b6:01:7a:48:45:fc:10:3c:b7:f9:d4:89:2a:9d | |
749 |
|
749 | |||
750 | This feature is only supported when using Python 2.6 or later. |
|
750 | This feature is only supported when using Python 2.6 or later. | |
751 |
|
751 | |||
752 |
|
752 | |||
753 | ``http_proxy`` |
|
753 | ``http_proxy`` | |
754 | -------------- |
|
754 | -------------- | |
755 |
|
755 | |||
756 | Used to access web-based Mercurial repositories through a HTTP |
|
756 | Used to access web-based Mercurial repositories through a HTTP | |
757 | proxy. |
|
757 | proxy. | |
758 |
|
758 | |||
759 | ``host`` |
|
759 | ``host`` | |
760 | Host name and (optional) port of the proxy server, for example |
|
760 | Host name and (optional) port of the proxy server, for example | |
761 | "myproxy:8000". |
|
761 | "myproxy:8000". | |
762 |
|
762 | |||
763 | ``no`` |
|
763 | ``no`` | |
764 | Optional. Comma-separated list of host names that should bypass |
|
764 | Optional. Comma-separated list of host names that should bypass | |
765 | the proxy. |
|
765 | the proxy. | |
766 |
|
766 | |||
767 | ``passwd`` |
|
767 | ``passwd`` | |
768 | Optional. Password to authenticate with at the proxy server. |
|
768 | Optional. Password to authenticate with at the proxy server. | |
769 |
|
769 | |||
770 | ``user`` |
|
770 | ``user`` | |
771 | Optional. User name to authenticate with at the proxy server. |
|
771 | Optional. User name to authenticate with at the proxy server. | |
772 |
|
772 | |||
773 | ``always`` |
|
773 | ``always`` | |
774 | Optional. Always use the proxy, even for localhost and any entries |
|
774 | Optional. Always use the proxy, even for localhost and any entries | |
775 | in ``http_proxy.no``. True or False. Default: False. |
|
775 | in ``http_proxy.no``. True or False. Default: False. | |
776 |
|
776 | |||
777 | ``merge-patterns`` |
|
777 | ``merge-patterns`` | |
778 | ------------------ |
|
778 | ------------------ | |
779 |
|
779 | |||
780 | This section specifies merge tools to associate with particular file |
|
780 | This section specifies merge tools to associate with particular file | |
781 | patterns. Tools matched here will take precedence over the default |
|
781 | patterns. Tools matched here will take precedence over the default | |
782 | merge tool. Patterns are globs by default, rooted at the repository |
|
782 | merge tool. Patterns are globs by default, rooted at the repository | |
783 | root. |
|
783 | root. | |
784 |
|
784 | |||
785 | Example:: |
|
785 | Example:: | |
786 |
|
786 | |||
787 | [merge-patterns] |
|
787 | [merge-patterns] | |
788 | **.c = kdiff3 |
|
788 | **.c = kdiff3 | |
789 | **.jpg = myimgmerge |
|
789 | **.jpg = myimgmerge | |
790 |
|
790 | |||
791 | ``merge-tools`` |
|
791 | ``merge-tools`` | |
792 | --------------- |
|
792 | --------------- | |
793 |
|
793 | |||
794 | This section configures external merge tools to use for file-level |
|
794 | This section configures external merge tools to use for file-level | |
795 | merges. |
|
795 | merges. | |
796 |
|
796 | |||
797 | Example ``~/.hgrc``:: |
|
797 | Example ``~/.hgrc``:: | |
798 |
|
798 | |||
799 | [merge-tools] |
|
799 | [merge-tools] | |
800 | # Override stock tool location |
|
800 | # Override stock tool location | |
801 | kdiff3.executable = ~/bin/kdiff3 |
|
801 | kdiff3.executable = ~/bin/kdiff3 | |
802 | # Specify command line |
|
802 | # Specify command line | |
803 | kdiff3.args = $base $local $other -o $output |
|
803 | kdiff3.args = $base $local $other -o $output | |
804 | # Give higher priority |
|
804 | # Give higher priority | |
805 | kdiff3.priority = 1 |
|
805 | kdiff3.priority = 1 | |
806 |
|
806 | |||
807 | # Define new tool |
|
807 | # Define new tool | |
808 | myHtmlTool.args = -m $local $other $base $output |
|
808 | myHtmlTool.args = -m $local $other $base $output | |
809 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
809 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
810 | myHtmlTool.priority = 1 |
|
810 | myHtmlTool.priority = 1 | |
811 |
|
811 | |||
812 | Supported arguments: |
|
812 | Supported arguments: | |
813 |
|
813 | |||
814 | ``priority`` |
|
814 | ``priority`` | |
815 | The priority in which to evaluate this tool. |
|
815 | The priority in which to evaluate this tool. | |
816 | Default: 0. |
|
816 | Default: 0. | |
817 |
|
817 | |||
818 | ``executable`` |
|
818 | ``executable`` | |
819 | Either just the name of the executable or its pathname. On Windows, |
|
819 | Either just the name of the executable or its pathname. On Windows, | |
820 | the path can use environment variables with ${ProgramFiles} syntax. |
|
820 | the path can use environment variables with ${ProgramFiles} syntax. | |
821 | Default: the tool name. |
|
821 | Default: the tool name. | |
822 |
|
822 | |||
823 | ``args`` |
|
823 | ``args`` | |
824 | The arguments to pass to the tool executable. You can refer to the |
|
824 | The arguments to pass to the tool executable. You can refer to the | |
825 | files being merged as well as the output file through these |
|
825 | files being merged as well as the output file through these | |
826 | variables: ``$base``, ``$local``, ``$other``, ``$output``. |
|
826 | variables: ``$base``, ``$local``, ``$other``, ``$output``. | |
827 | Default: ``$local $base $other`` |
|
827 | Default: ``$local $base $other`` | |
828 |
|
828 | |||
829 | ``premerge`` |
|
829 | ``premerge`` | |
830 | Attempt to run internal non-interactive 3-way merge tool before |
|
830 | Attempt to run internal non-interactive 3-way merge tool before | |
831 | launching external tool. Options are ``true``, ``false``, or ``keep`` |
|
831 | launching external tool. Options are ``true``, ``false``, or ``keep`` | |
832 | to leave markers in the file if the premerge fails. |
|
832 | to leave markers in the file if the premerge fails. | |
833 | Default: True |
|
833 | Default: True | |
834 |
|
834 | |||
835 | ``binary`` |
|
835 | ``binary`` | |
836 | This tool can merge binary files. Defaults to False, unless tool |
|
836 | This tool can merge binary files. Defaults to False, unless tool | |
837 | was selected by file pattern match. |
|
837 | was selected by file pattern match. | |
838 |
|
838 | |||
839 | ``symlink`` |
|
839 | ``symlink`` | |
840 | This tool can merge symlinks. Defaults to False, even if tool was |
|
840 | This tool can merge symlinks. Defaults to False, even if tool was | |
841 | selected by file pattern match. |
|
841 | selected by file pattern match. | |
842 |
|
842 | |||
843 | ``check`` |
|
843 | ``check`` | |
844 | A list of merge success-checking options: |
|
844 | A list of merge success-checking options: | |
845 |
|
845 | |||
846 | ``changed`` |
|
846 | ``changed`` | |
847 | Ask whether merge was successful when the merged file shows no changes. |
|
847 | Ask whether merge was successful when the merged file shows no changes. | |
848 | ``conflicts`` |
|
848 | ``conflicts`` | |
849 | Check whether there are conflicts even though the tool reported success. |
|
849 | Check whether there are conflicts even though the tool reported success. | |
850 | ``prompt`` |
|
850 | ``prompt`` | |
851 | Always prompt for merge success, regardless of success reported by tool. |
|
851 | Always prompt for merge success, regardless of success reported by tool. | |
852 |
|
852 | |||
853 | ``fixeol`` |
|
853 | ``fixeol`` | |
854 | Attempt to fix up EOL changes caused by the merge tool. |
|
854 | Attempt to fix up EOL changes caused by the merge tool. | |
855 | Default: False |
|
855 | Default: False | |
856 |
|
856 | |||
857 | ``gui`` |
|
857 | ``gui`` | |
858 | This tool requires a graphical interface to run. Default: False |
|
858 | This tool requires a graphical interface to run. Default: False | |
859 |
|
859 | |||
860 | ``regkey`` |
|
860 | ``regkey`` | |
861 | Windows registry key which describes install location of this |
|
861 | Windows registry key which describes install location of this | |
862 | tool. Mercurial will search for this key first under |
|
862 | tool. Mercurial will search for this key first under | |
863 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
863 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
864 | Default: None |
|
864 | Default: None | |
865 |
|
865 | |||
866 | ``regkeyalt`` |
|
866 | ``regkeyalt`` | |
867 | An alternate Windows registry key to try if the first key is not |
|
867 | An alternate Windows registry key to try if the first key is not | |
868 | found. The alternate key uses the same ``regname`` and ``regappend`` |
|
868 | found. The alternate key uses the same ``regname`` and ``regappend`` | |
869 | semantics of the primary key. The most common use for this key |
|
869 | semantics of the primary key. The most common use for this key | |
870 | is to search for 32bit applications on 64bit operating systems. |
|
870 | is to search for 32bit applications on 64bit operating systems. | |
871 | Default: None |
|
871 | Default: None | |
872 |
|
872 | |||
873 | ``regname`` |
|
873 | ``regname`` | |
874 | Name of value to read from specified registry key. Defaults to the |
|
874 | Name of value to read from specified registry key. Defaults to the | |
875 | unnamed (default) value. |
|
875 | unnamed (default) value. | |
876 |
|
876 | |||
877 | ``regappend`` |
|
877 | ``regappend`` | |
878 | String to append to the value read from the registry, typically |
|
878 | String to append to the value read from the registry, typically | |
879 | the executable name of the tool. |
|
879 | the executable name of the tool. | |
880 | Default: None |
|
880 | Default: None | |
881 |
|
881 | |||
882 |
|
882 | |||
883 | ``patch`` |
|
883 | ``patch`` | |
884 | --------- |
|
884 | --------- | |
885 |
|
885 | |||
886 | Settings used when applying patches, for instance through the 'import' |
|
886 | Settings used when applying patches, for instance through the 'import' | |
887 | command or with Mercurial Queues extension. |
|
887 | command or with Mercurial Queues extension. | |
888 |
|
888 | |||
889 | ``eol`` |
|
889 | ``eol`` | |
890 | When set to 'strict' patch content and patched files end of lines |
|
890 | When set to 'strict' patch content and patched files end of lines | |
891 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
891 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
892 | lines are ignored when patching and the result line endings are |
|
892 | lines are ignored when patching and the result line endings are | |
893 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
893 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
894 | ``auto``, end of lines are again ignored while patching but line |
|
894 | ``auto``, end of lines are again ignored while patching but line | |
895 | endings in patched files are normalized to their original setting |
|
895 | endings in patched files are normalized to their original setting | |
896 | on a per-file basis. If target file does not exist or has no end |
|
896 | on a per-file basis. If target file does not exist or has no end | |
897 | of line, patch line endings are preserved. |
|
897 | of line, patch line endings are preserved. | |
898 | Default: strict. |
|
898 | Default: strict. | |
899 |
|
899 | |||
900 |
|
900 | |||
901 | ``paths`` |
|
901 | ``paths`` | |
902 | --------- |
|
902 | --------- | |
903 |
|
903 | |||
904 | Assigns symbolic names to repositories. The left side is the |
|
904 | Assigns symbolic names to repositories. The left side is the | |
905 | symbolic name, and the right gives the directory or URL that is the |
|
905 | symbolic name, and the right gives the directory or URL that is the | |
906 | location of the repository. Default paths can be declared by setting |
|
906 | location of the repository. Default paths can be declared by setting | |
907 | the following entries. |
|
907 | the following entries. | |
908 |
|
908 | |||
909 | ``default`` |
|
909 | ``default`` | |
910 | Directory or URL to use when pulling if no source is specified. |
|
910 | Directory or URL to use when pulling if no source is specified. | |
911 | Default is set to repository from which the current repository was |
|
911 | Default is set to repository from which the current repository was | |
912 | cloned. |
|
912 | cloned. | |
913 |
|
913 | |||
914 | ``default-push`` |
|
914 | ``default-push`` | |
915 | Optional. Directory or URL to use when pushing if no destination |
|
915 | Optional. Directory or URL to use when pushing if no destination | |
916 | is specified. |
|
916 | is specified. | |
917 |
|
917 | |||
918 | Custom paths can be defined by assigning the path to a name that later can be |
|
918 | Custom paths can be defined by assigning the path to a name that later can be | |
919 | used from the command line. Example:: |
|
919 | used from the command line. Example:: | |
920 |
|
920 | |||
921 | [paths] |
|
921 | [paths] | |
922 | my_path = http://example.com/path |
|
922 | my_path = http://example.com/path | |
923 |
|
923 | |||
924 | To push to the path defined in ``my_path`` run the command:: |
|
924 | To push to the path defined in ``my_path`` run the command:: | |
925 |
|
925 | |||
926 | hg push my_path |
|
926 | hg push my_path | |
927 |
|
927 | |||
928 |
|
928 | |||
929 | ``phases`` |
|
929 | ``phases`` | |
930 | ---------- |
|
930 | ---------- | |
931 |
|
931 | |||
932 | Specifies default handling of phases. See :hg:`help phases` for more |
|
932 | Specifies default handling of phases. See :hg:`help phases` for more | |
933 | information about working with phases. |
|
933 | information about working with phases. | |
934 |
|
934 | |||
935 | ``publish`` |
|
935 | ``publish`` | |
936 | Controls draft phase behavior when working as a server. When true, |
|
936 | Controls draft phase behavior when working as a server. When true, | |
937 | pushed changesets are set to public in both client and server and |
|
937 | pushed changesets are set to public in both client and server and | |
938 | pulled or cloned changesets are set to public in the client. |
|
938 | pulled or cloned changesets are set to public in the client. | |
939 | Default: True |
|
939 | Default: True | |
940 |
|
940 | |||
941 | ``new-commit`` |
|
941 | ``new-commit`` | |
942 | Phase of newly-created commits. |
|
942 | Phase of newly-created commits. | |
943 | Default: draft |
|
943 | Default: draft | |
944 |
|
944 | |||
945 | ``profiling`` |
|
945 | ``profiling`` | |
946 | ------------- |
|
946 | ------------- | |
947 |
|
947 | |||
948 | Specifies profiling type, format, and file output. Two profilers are |
|
948 | Specifies profiling type, format, and file output. Two profilers are | |
949 | supported: an instrumenting profiler (named ``ls``), and a sampling |
|
949 | supported: an instrumenting profiler (named ``ls``), and a sampling | |
950 | profiler (named ``stat``). |
|
950 | profiler (named ``stat``). | |
951 |
|
951 | |||
952 | In this section description, 'profiling data' stands for the raw data |
|
952 | In this section description, 'profiling data' stands for the raw data | |
953 | collected during profiling, while 'profiling report' stands for a |
|
953 | collected during profiling, while 'profiling report' stands for a | |
954 | statistical text report generated from the profiling data. The |
|
954 | statistical text report generated from the profiling data. The | |
955 | profiling is done using lsprof. |
|
955 | profiling is done using lsprof. | |
956 |
|
956 | |||
957 | ``type`` |
|
957 | ``type`` | |
958 | The type of profiler to use. |
|
958 | The type of profiler to use. | |
959 | Default: ls. |
|
959 | Default: ls. | |
960 |
|
960 | |||
961 | ``ls`` |
|
961 | ``ls`` | |
962 | Use Python's built-in instrumenting profiler. This profiler |
|
962 | Use Python's built-in instrumenting profiler. This profiler | |
963 | works on all platforms, but each line number it reports is the |
|
963 | works on all platforms, but each line number it reports is the | |
964 | first line of a function. This restriction makes it difficult to |
|
964 | first line of a function. This restriction makes it difficult to | |
965 | identify the expensive parts of a non-trivial function. |
|
965 | identify the expensive parts of a non-trivial function. | |
966 | ``stat`` |
|
966 | ``stat`` | |
967 | Use a third-party statistical profiler, statprof. This profiler |
|
967 | Use a third-party statistical profiler, statprof. This profiler | |
968 | currently runs only on Unix systems, and is most useful for |
|
968 | currently runs only on Unix systems, and is most useful for | |
969 | profiling commands that run for longer than about 0.1 seconds. |
|
969 | profiling commands that run for longer than about 0.1 seconds. | |
970 |
|
970 | |||
971 | ``format`` |
|
971 | ``format`` | |
972 | Profiling format. Specific to the ``ls`` instrumenting profiler. |
|
972 | Profiling format. Specific to the ``ls`` instrumenting profiler. | |
973 | Default: text. |
|
973 | Default: text. | |
974 |
|
974 | |||
975 | ``text`` |
|
975 | ``text`` | |
976 | Generate a profiling report. When saving to a file, it should be |
|
976 | Generate a profiling report. When saving to a file, it should be | |
977 | noted that only the report is saved, and the profiling data is |
|
977 | noted that only the report is saved, and the profiling data is | |
978 | not kept. |
|
978 | not kept. | |
979 | ``kcachegrind`` |
|
979 | ``kcachegrind`` | |
980 | Format profiling data for kcachegrind use: when saving to a |
|
980 | Format profiling data for kcachegrind use: when saving to a | |
981 | file, the generated file can directly be loaded into |
|
981 | file, the generated file can directly be loaded into | |
982 | kcachegrind. |
|
982 | kcachegrind. | |
983 |
|
983 | |||
984 | ``frequency`` |
|
984 | ``frequency`` | |
985 | Sampling frequency. Specific to the ``stat`` sampling profiler. |
|
985 | Sampling frequency. Specific to the ``stat`` sampling profiler. | |
986 | Default: 1000. |
|
986 | Default: 1000. | |
987 |
|
987 | |||
988 | ``output`` |
|
988 | ``output`` | |
989 | File path where profiling data or report should be saved. If the |
|
989 | File path where profiling data or report should be saved. If the | |
990 | file exists, it is replaced. Default: None, data is printed on |
|
990 | file exists, it is replaced. Default: None, data is printed on | |
991 | stderr |
|
991 | stderr | |
992 |
|
992 | |||
993 | ``sort`` |
|
993 | ``sort`` | |
994 | Sort field. Specific to the ``ls`` instrumenting profiler. |
|
994 | Sort field. Specific to the ``ls`` instrumenting profiler. | |
995 | One of ``callcount``, ``reccallcount``, ``totaltime`` and |
|
995 | One of ``callcount``, ``reccallcount``, ``totaltime`` and | |
996 | ``inlinetime``. |
|
996 | ``inlinetime``. | |
997 | Default: inlinetime. |
|
997 | Default: inlinetime. | |
998 |
|
998 | |||
999 | ``limit`` |
|
999 | ``limit`` | |
1000 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. |
|
1000 | Number of lines to show. Specific to the ``ls`` instrumenting profiler. | |
1001 | Default: 30. |
|
1001 | Default: 30. | |
1002 |
|
1002 | |||
1003 | ``nested`` |
|
1003 | ``nested`` | |
1004 | Show at most this number of lines of drill-down info after each main entry. |
|
1004 | Show at most this number of lines of drill-down info after each main entry. | |
1005 | This can help explain the difference between Total and Inline. |
|
1005 | This can help explain the difference between Total and Inline. | |
1006 | Specific to the ``ls`` instrumenting profiler. |
|
1006 | Specific to the ``ls`` instrumenting profiler. | |
1007 | Default: 5. |
|
1007 | Default: 5. | |
1008 |
|
1008 | |||
1009 | ``revsetalias`` |
|
1009 | ``revsetalias`` | |
1010 | --------------- |
|
1010 | --------------- | |
1011 |
|
1011 | |||
1012 | Alias definitions for revsets. See :hg:`help revsets` for details. |
|
1012 | Alias definitions for revsets. See :hg:`help revsets` for details. | |
1013 |
|
1013 | |||
1014 | ``server`` |
|
1014 | ``server`` | |
1015 | ---------- |
|
1015 | ---------- | |
1016 |
|
1016 | |||
1017 | Controls generic server settings. |
|
1017 | Controls generic server settings. | |
1018 |
|
1018 | |||
1019 | ``uncompressed`` |
|
1019 | ``uncompressed`` | |
1020 | Whether to allow clients to clone a repository using the |
|
1020 | Whether to allow clients to clone a repository using the | |
1021 | uncompressed streaming protocol. This transfers about 40% more |
|
1021 | uncompressed streaming protocol. This transfers about 40% more | |
1022 | data than a regular clone, but uses less memory and CPU on both |
|
1022 | data than a regular clone, but uses less memory and CPU on both | |
1023 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
1023 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
1024 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
1024 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
1025 | regular clone. Over most WAN connections (anything slower than |
|
1025 | regular clone. Over most WAN connections (anything slower than | |
1026 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
1026 | about 6 Mbps), uncompressed streaming is slower, because of the | |
1027 | extra data transfer overhead. This mode will also temporarily hold |
|
1027 | extra data transfer overhead. This mode will also temporarily hold | |
1028 | the write lock while determining what data to transfer. |
|
1028 | the write lock while determining what data to transfer. | |
1029 | Default is True. |
|
1029 | Default is True. | |
1030 |
|
1030 | |||
1031 | ``preferuncompressed`` |
|
1031 | ``preferuncompressed`` | |
1032 | When set, clients will try to use the uncompressed streaming |
|
1032 | When set, clients will try to use the uncompressed streaming | |
1033 | protocol. Default is False. |
|
1033 | protocol. Default is False. | |
1034 |
|
1034 | |||
1035 | ``validate`` |
|
1035 | ``validate`` | |
1036 | Whether to validate the completeness of pushed changesets by |
|
1036 | Whether to validate the completeness of pushed changesets by | |
1037 | checking that all new file revisions specified in manifests are |
|
1037 | checking that all new file revisions specified in manifests are | |
1038 | present. Default is False. |
|
1038 | present. Default is False. | |
1039 |
|
1039 | |||
1040 | ``smtp`` |
|
1040 | ``smtp`` | |
1041 | -------- |
|
1041 | -------- | |
1042 |
|
1042 | |||
1043 | Configuration for extensions that need to send email messages. |
|
1043 | Configuration for extensions that need to send email messages. | |
1044 |
|
1044 | |||
1045 | ``host`` |
|
1045 | ``host`` | |
1046 | Host name of mail server, e.g. "mail.example.com". |
|
1046 | Host name of mail server, e.g. "mail.example.com". | |
1047 |
|
1047 | |||
1048 | ``port`` |
|
1048 | ``port`` | |
1049 |
Optional. Port to connect to on mail server. Default: |
|
1049 | Optional. Port to connect to on mail server. Default: 465 (if | |
|
1050 | ``tls`` is smtps) or 25 (otherwise). | |||
1050 |
|
1051 | |||
1051 | ``tls`` |
|
1052 | ``tls`` | |
1052 | Optional. Method to enable TLS when connecting to mail server: starttls, |
|
1053 | Optional. Method to enable TLS when connecting to mail server: starttls, | |
1053 | smtps or none. Default: none. |
|
1054 | smtps or none. Default: none. | |
1054 |
|
1055 | |||
1055 | ``verifycert`` |
|
1056 | ``verifycert`` | |
1056 | Optional. Verification for the certificate of mail server, when |
|
1057 | Optional. Verification for the certificate of mail server, when | |
1057 | ``tls`` is starttls or smtps. "strict", "loose" or False. For |
|
1058 | ``tls`` is starttls or smtps. "strict", "loose" or False. For | |
1058 | "strict" or "loose", the certificate is verified as same as the |
|
1059 | "strict" or "loose", the certificate is verified as same as the | |
1059 | verification for HTTPS connections (see ``[hostfingerprints]`` and |
|
1060 | verification for HTTPS connections (see ``[hostfingerprints]`` and | |
1060 | ``[web] cacerts`` also). For "strict", sending email is also |
|
1061 | ``[web] cacerts`` also). For "strict", sending email is also | |
1061 | aborted, if there is no configuration for mail server in |
|
1062 | aborted, if there is no configuration for mail server in | |
1062 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for |
|
1063 | ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for | |
1063 | :hg:`email` overwrites this as "loose". Default: "strict". |
|
1064 | :hg:`email` overwrites this as "loose". Default: "strict". | |
1064 |
|
1065 | |||
1065 | ``username`` |
|
1066 | ``username`` | |
1066 | Optional. User name for authenticating with the SMTP server. |
|
1067 | Optional. User name for authenticating with the SMTP server. | |
1067 | Default: none. |
|
1068 | Default: none. | |
1068 |
|
1069 | |||
1069 | ``password`` |
|
1070 | ``password`` | |
1070 | Optional. Password for authenticating with the SMTP server. If not |
|
1071 | Optional. Password for authenticating with the SMTP server. If not | |
1071 | specified, interactive sessions will prompt the user for a |
|
1072 | specified, interactive sessions will prompt the user for a | |
1072 | password; non-interactive sessions will fail. Default: none. |
|
1073 | password; non-interactive sessions will fail. Default: none. | |
1073 |
|
1074 | |||
1074 | ``local_hostname`` |
|
1075 | ``local_hostname`` | |
1075 | Optional. It's the hostname that the sender can use to identify |
|
1076 | Optional. It's the hostname that the sender can use to identify | |
1076 | itself to the MTA. |
|
1077 | itself to the MTA. | |
1077 |
|
1078 | |||
1078 |
|
1079 | |||
1079 | ``subpaths`` |
|
1080 | ``subpaths`` | |
1080 | ------------ |
|
1081 | ------------ | |
1081 |
|
1082 | |||
1082 | Subrepository source URLs can go stale if a remote server changes name |
|
1083 | Subrepository source URLs can go stale if a remote server changes name | |
1083 | or becomes temporarily unavailable. This section lets you define |
|
1084 | or becomes temporarily unavailable. This section lets you define | |
1084 | rewrite rules of the form:: |
|
1085 | rewrite rules of the form:: | |
1085 |
|
1086 | |||
1086 | <pattern> = <replacement> |
|
1087 | <pattern> = <replacement> | |
1087 |
|
1088 | |||
1088 | where ``pattern`` is a regular expression matching a subrepository |
|
1089 | where ``pattern`` is a regular expression matching a subrepository | |
1089 | source URL and ``replacement`` is the replacement string used to |
|
1090 | source URL and ``replacement`` is the replacement string used to | |
1090 | rewrite it. Groups can be matched in ``pattern`` and referenced in |
|
1091 | rewrite it. Groups can be matched in ``pattern`` and referenced in | |
1091 | ``replacements``. For instance:: |
|
1092 | ``replacements``. For instance:: | |
1092 |
|
1093 | |||
1093 | http://server/(.*)-hg/ = http://hg.server/\1/ |
|
1094 | http://server/(.*)-hg/ = http://hg.server/\1/ | |
1094 |
|
1095 | |||
1095 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. |
|
1096 | rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``. | |
1096 |
|
1097 | |||
1097 | Relative subrepository paths are first made absolute, and the |
|
1098 | Relative subrepository paths are first made absolute, and the | |
1098 | rewrite rules are then applied on the full (absolute) path. The rules |
|
1099 | rewrite rules are then applied on the full (absolute) path. The rules | |
1099 | are applied in definition order. |
|
1100 | are applied in definition order. | |
1100 |
|
1101 | |||
1101 | ``trusted`` |
|
1102 | ``trusted`` | |
1102 | ----------- |
|
1103 | ----------- | |
1103 |
|
1104 | |||
1104 | Mercurial will not use the settings in the |
|
1105 | Mercurial will not use the settings in the | |
1105 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
1106 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
1106 | user or to a trusted group, as various hgrc features allow arbitrary |
|
1107 | user or to a trusted group, as various hgrc features allow arbitrary | |
1107 | commands to be run. This issue is often encountered when configuring |
|
1108 | commands to be run. This issue is often encountered when configuring | |
1108 | hooks or extensions for shared repositories or servers. However, |
|
1109 | hooks or extensions for shared repositories or servers. However, | |
1109 | the web interface will use some safe settings from the ``[web]`` |
|
1110 | the web interface will use some safe settings from the ``[web]`` | |
1110 | section. |
|
1111 | section. | |
1111 |
|
1112 | |||
1112 | This section specifies what users and groups are trusted. The |
|
1113 | This section specifies what users and groups are trusted. The | |
1113 | current user is always trusted. To trust everybody, list a user or a |
|
1114 | current user is always trusted. To trust everybody, list a user or a | |
1114 | group with name ``*``. These settings must be placed in an |
|
1115 | group with name ``*``. These settings must be placed in an | |
1115 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the |
|
1116 | *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the | |
1116 | user or service running Mercurial. |
|
1117 | user or service running Mercurial. | |
1117 |
|
1118 | |||
1118 | ``users`` |
|
1119 | ``users`` | |
1119 | Comma-separated list of trusted users. |
|
1120 | Comma-separated list of trusted users. | |
1120 |
|
1121 | |||
1121 | ``groups`` |
|
1122 | ``groups`` | |
1122 | Comma-separated list of trusted groups. |
|
1123 | Comma-separated list of trusted groups. | |
1123 |
|
1124 | |||
1124 |
|
1125 | |||
1125 | ``ui`` |
|
1126 | ``ui`` | |
1126 | ------ |
|
1127 | ------ | |
1127 |
|
1128 | |||
1128 | User interface controls. |
|
1129 | User interface controls. | |
1129 |
|
1130 | |||
1130 | ``archivemeta`` |
|
1131 | ``archivemeta`` | |
1131 | Whether to include the .hg_archival.txt file containing meta data |
|
1132 | Whether to include the .hg_archival.txt file containing meta data | |
1132 | (hashes for the repository base and for tip) in archives created |
|
1133 | (hashes for the repository base and for tip) in archives created | |
1133 | by the :hg:`archive` command or downloaded via hgweb. |
|
1134 | by the :hg:`archive` command or downloaded via hgweb. | |
1134 | Default is True. |
|
1135 | Default is True. | |
1135 |
|
1136 | |||
1136 | ``askusername`` |
|
1137 | ``askusername`` | |
1137 | Whether to prompt for a username when committing. If True, and |
|
1138 | Whether to prompt for a username when committing. If True, and | |
1138 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
1139 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
1139 | be prompted to enter a username. If no username is entered, the |
|
1140 | be prompted to enter a username. If no username is entered, the | |
1140 | default ``USER@HOST`` is used instead. |
|
1141 | default ``USER@HOST`` is used instead. | |
1141 | Default is False. |
|
1142 | Default is False. | |
1142 |
|
1143 | |||
1143 | ``commitsubrepos`` |
|
1144 | ``commitsubrepos`` | |
1144 | Whether to commit modified subrepositories when committing the |
|
1145 | Whether to commit modified subrepositories when committing the | |
1145 | parent repository. If False and one subrepository has uncommitted |
|
1146 | parent repository. If False and one subrepository has uncommitted | |
1146 | changes, abort the commit. |
|
1147 | changes, abort the commit. | |
1147 | Default is False. |
|
1148 | Default is False. | |
1148 |
|
1149 | |||
1149 | ``debug`` |
|
1150 | ``debug`` | |
1150 | Print debugging information. True or False. Default is False. |
|
1151 | Print debugging information. True or False. Default is False. | |
1151 |
|
1152 | |||
1152 | ``editor`` |
|
1153 | ``editor`` | |
1153 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. |
|
1154 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. | |
1154 |
|
1155 | |||
1155 | ``fallbackencoding`` |
|
1156 | ``fallbackencoding`` | |
1156 | Encoding to try if it's not possible to decode the changelog using |
|
1157 | Encoding to try if it's not possible to decode the changelog using | |
1157 | UTF-8. Default is ISO-8859-1. |
|
1158 | UTF-8. Default is ISO-8859-1. | |
1158 |
|
1159 | |||
1159 | ``ignore`` |
|
1160 | ``ignore`` | |
1160 | A file to read per-user ignore patterns from. This file should be |
|
1161 | A file to read per-user ignore patterns from. This file should be | |
1161 | in the same format as a repository-wide .hgignore file. This |
|
1162 | in the same format as a repository-wide .hgignore file. This | |
1162 | option supports hook syntax, so if you want to specify multiple |
|
1163 | option supports hook syntax, so if you want to specify multiple | |
1163 | ignore files, you can do so by setting something like |
|
1164 | ignore files, you can do so by setting something like | |
1164 | ``ignore.other = ~/.hgignore2``. For details of the ignore file |
|
1165 | ``ignore.other = ~/.hgignore2``. For details of the ignore file | |
1165 | format, see the ``hgignore(5)`` man page. |
|
1166 | format, see the ``hgignore(5)`` man page. | |
1166 |
|
1167 | |||
1167 | ``interactive`` |
|
1168 | ``interactive`` | |
1168 | Allow to prompt the user. True or False. Default is True. |
|
1169 | Allow to prompt the user. True or False. Default is True. | |
1169 |
|
1170 | |||
1170 | ``logtemplate`` |
|
1171 | ``logtemplate`` | |
1171 | Template string for commands that print changesets. |
|
1172 | Template string for commands that print changesets. | |
1172 |
|
1173 | |||
1173 | ``merge`` |
|
1174 | ``merge`` | |
1174 | The conflict resolution program to use during a manual merge. |
|
1175 | The conflict resolution program to use during a manual merge. | |
1175 | For more information on merge tools see :hg:`help merge-tools`. |
|
1176 | For more information on merge tools see :hg:`help merge-tools`. | |
1176 | For configuring merge tools see the ``[merge-tools]`` section. |
|
1177 | For configuring merge tools see the ``[merge-tools]`` section. | |
1177 |
|
1178 | |||
1178 | ``portablefilenames`` |
|
1179 | ``portablefilenames`` | |
1179 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. |
|
1180 | Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``. | |
1180 | Default is ``warn``. |
|
1181 | Default is ``warn``. | |
1181 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX |
|
1182 | If set to ``warn`` (or ``true``), a warning message is printed on POSIX | |
1182 | platforms, if a file with a non-portable filename is added (e.g. a file |
|
1183 | platforms, if a file with a non-portable filename is added (e.g. a file | |
1183 | with a name that can't be created on Windows because it contains reserved |
|
1184 | with a name that can't be created on Windows because it contains reserved | |
1184 | parts like ``AUX``, reserved characters like ``:``, or would cause a case |
|
1185 | parts like ``AUX``, reserved characters like ``:``, or would cause a case | |
1185 | collision with an existing file). |
|
1186 | collision with an existing file). | |
1186 | If set to ``ignore`` (or ``false``), no warning is printed. |
|
1187 | If set to ``ignore`` (or ``false``), no warning is printed. | |
1187 | If set to ``abort``, the command is aborted. |
|
1188 | If set to ``abort``, the command is aborted. | |
1188 | On Windows, this configuration option is ignored and the command aborted. |
|
1189 | On Windows, this configuration option is ignored and the command aborted. | |
1189 |
|
1190 | |||
1190 | ``quiet`` |
|
1191 | ``quiet`` | |
1191 | Reduce the amount of output printed. True or False. Default is False. |
|
1192 | Reduce the amount of output printed. True or False. Default is False. | |
1192 |
|
1193 | |||
1193 | ``remotecmd`` |
|
1194 | ``remotecmd`` | |
1194 | remote command to use for clone/push/pull operations. Default is ``hg``. |
|
1195 | remote command to use for clone/push/pull operations. Default is ``hg``. | |
1195 |
|
1196 | |||
1196 | ``reportoldssl`` |
|
1197 | ``reportoldssl`` | |
1197 | Warn if an SSL certificate is unable to be due to using Python |
|
1198 | Warn if an SSL certificate is unable to be due to using Python | |
1198 | 2.5 or earlier. True or False. Default is True. |
|
1199 | 2.5 or earlier. True or False. Default is True. | |
1199 |
|
1200 | |||
1200 | ``report_untrusted`` |
|
1201 | ``report_untrusted`` | |
1201 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
1202 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
1202 | trusted user or group. True or False. Default is True. |
|
1203 | trusted user or group. True or False. Default is True. | |
1203 |
|
1204 | |||
1204 | ``slash`` |
|
1205 | ``slash`` | |
1205 | Display paths using a slash (``/``) as the path separator. This |
|
1206 | Display paths using a slash (``/``) as the path separator. This | |
1206 | only makes a difference on systems where the default path |
|
1207 | only makes a difference on systems where the default path | |
1207 | separator is not the slash character (e.g. Windows uses the |
|
1208 | separator is not the slash character (e.g. Windows uses the | |
1208 | backslash character (``\``)). |
|
1209 | backslash character (``\``)). | |
1209 | Default is False. |
|
1210 | Default is False. | |
1210 |
|
1211 | |||
1211 | ``ssh`` |
|
1212 | ``ssh`` | |
1212 | command to use for SSH connections. Default is ``ssh``. |
|
1213 | command to use for SSH connections. Default is ``ssh``. | |
1213 |
|
1214 | |||
1214 | ``strict`` |
|
1215 | ``strict`` | |
1215 | Require exact command names, instead of allowing unambiguous |
|
1216 | Require exact command names, instead of allowing unambiguous | |
1216 | abbreviations. True or False. Default is False. |
|
1217 | abbreviations. True or False. Default is False. | |
1217 |
|
1218 | |||
1218 | ``style`` |
|
1219 | ``style`` | |
1219 | Name of style to use for command output. |
|
1220 | Name of style to use for command output. | |
1220 |
|
1221 | |||
1221 | ``timeout`` |
|
1222 | ``timeout`` | |
1222 | The timeout used when a lock is held (in seconds), a negative value |
|
1223 | The timeout used when a lock is held (in seconds), a negative value | |
1223 | means no timeout. Default is 600. |
|
1224 | means no timeout. Default is 600. | |
1224 |
|
1225 | |||
1225 | ``traceback`` |
|
1226 | ``traceback`` | |
1226 | Mercurial always prints a traceback when an unknown exception |
|
1227 | Mercurial always prints a traceback when an unknown exception | |
1227 | occurs. Setting this to True will make Mercurial print a traceback |
|
1228 | occurs. Setting this to True will make Mercurial print a traceback | |
1228 | on all exceptions, even those recognized by Mercurial (such as |
|
1229 | on all exceptions, even those recognized by Mercurial (such as | |
1229 | IOError or MemoryError). Default is False. |
|
1230 | IOError or MemoryError). Default is False. | |
1230 |
|
1231 | |||
1231 | ``username`` |
|
1232 | ``username`` | |
1232 | The committer of a changeset created when running "commit". |
|
1233 | The committer of a changeset created when running "commit". | |
1233 | Typically a person's name and email address, e.g. ``Fred Widget |
|
1234 | Typically a person's name and email address, e.g. ``Fred Widget | |
1234 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If |
|
1235 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If | |
1235 | the username in hgrc is empty, it has to be specified manually or |
|
1236 | the username in hgrc is empty, it has to be specified manually or | |
1236 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set |
|
1237 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set | |
1237 | ``username =`` in the system hgrc). Environment variables in the |
|
1238 | ``username =`` in the system hgrc). Environment variables in the | |
1238 | username are expanded. |
|
1239 | username are expanded. | |
1239 |
|
1240 | |||
1240 | ``verbose`` |
|
1241 | ``verbose`` | |
1241 | Increase the amount of output printed. True or False. Default is False. |
|
1242 | Increase the amount of output printed. True or False. Default is False. | |
1242 |
|
1243 | |||
1243 |
|
1244 | |||
1244 | ``web`` |
|
1245 | ``web`` | |
1245 | ------- |
|
1246 | ------- | |
1246 |
|
1247 | |||
1247 | Web interface configuration. The settings in this section apply to |
|
1248 | Web interface configuration. The settings in this section apply to | |
1248 | both the builtin webserver (started by :hg:`serve`) and the script you |
|
1249 | both the builtin webserver (started by :hg:`serve`) and the script you | |
1249 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI |
|
1250 | run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI | |
1250 | and WSGI). |
|
1251 | and WSGI). | |
1251 |
|
1252 | |||
1252 | The Mercurial webserver does no authentication (it does not prompt for |
|
1253 | The Mercurial webserver does no authentication (it does not prompt for | |
1253 | usernames and passwords to validate *who* users are), but it does do |
|
1254 | usernames and passwords to validate *who* users are), but it does do | |
1254 | authorization (it grants or denies access for *authenticated users* |
|
1255 | authorization (it grants or denies access for *authenticated users* | |
1255 | based on settings in this section). You must either configure your |
|
1256 | based on settings in this section). You must either configure your | |
1256 | webserver to do authentication for you, or disable the authorization |
|
1257 | webserver to do authentication for you, or disable the authorization | |
1257 | checks. |
|
1258 | checks. | |
1258 |
|
1259 | |||
1259 | For a quick setup in a trusted environment, e.g., a private LAN, where |
|
1260 | For a quick setup in a trusted environment, e.g., a private LAN, where | |
1260 | you want it to accept pushes from anybody, you can use the following |
|
1261 | you want it to accept pushes from anybody, you can use the following | |
1261 | command line:: |
|
1262 | command line:: | |
1262 |
|
1263 | |||
1263 | $ hg --config web.allow_push=* --config web.push_ssl=False serve |
|
1264 | $ hg --config web.allow_push=* --config web.push_ssl=False serve | |
1264 |
|
1265 | |||
1265 | Note that this will allow anybody to push anything to the server and |
|
1266 | Note that this will allow anybody to push anything to the server and | |
1266 | that this should not be used for public servers. |
|
1267 | that this should not be used for public servers. | |
1267 |
|
1268 | |||
1268 | The full set of options is: |
|
1269 | The full set of options is: | |
1269 |
|
1270 | |||
1270 | ``accesslog`` |
|
1271 | ``accesslog`` | |
1271 | Where to output the access log. Default is stdout. |
|
1272 | Where to output the access log. Default is stdout. | |
1272 |
|
1273 | |||
1273 | ``address`` |
|
1274 | ``address`` | |
1274 | Interface address to bind to. Default is all. |
|
1275 | Interface address to bind to. Default is all. | |
1275 |
|
1276 | |||
1276 | ``allow_archive`` |
|
1277 | ``allow_archive`` | |
1277 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
1278 | List of archive format (bz2, gz, zip) allowed for downloading. | |
1278 | Default is empty. |
|
1279 | Default is empty. | |
1279 |
|
1280 | |||
1280 | ``allowbz2`` |
|
1281 | ``allowbz2`` | |
1281 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
1282 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
1282 | revisions. |
|
1283 | revisions. | |
1283 | Default is False. |
|
1284 | Default is False. | |
1284 |
|
1285 | |||
1285 | ``allowgz`` |
|
1286 | ``allowgz`` | |
1286 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
1287 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
1287 | revisions. |
|
1288 | revisions. | |
1288 | Default is False. |
|
1289 | Default is False. | |
1289 |
|
1290 | |||
1290 | ``allowpull`` |
|
1291 | ``allowpull`` | |
1291 | Whether to allow pulling from the repository. Default is True. |
|
1292 | Whether to allow pulling from the repository. Default is True. | |
1292 |
|
1293 | |||
1293 | ``allow_push`` |
|
1294 | ``allow_push`` | |
1294 | Whether to allow pushing to the repository. If empty or not set, |
|
1295 | Whether to allow pushing to the repository. If empty or not set, | |
1295 | push is not allowed. If the special value ``*``, any remote user can |
|
1296 | push is not allowed. If the special value ``*``, any remote user can | |
1296 | push, including unauthenticated users. Otherwise, the remote user |
|
1297 | push, including unauthenticated users. Otherwise, the remote user | |
1297 | must have been authenticated, and the authenticated user name must |
|
1298 | must have been authenticated, and the authenticated user name must | |
1298 | be present in this list. The contents of the allow_push list are |
|
1299 | be present in this list. The contents of the allow_push list are | |
1299 | examined after the deny_push list. |
|
1300 | examined after the deny_push list. | |
1300 |
|
1301 | |||
1301 | ``allow_read`` |
|
1302 | ``allow_read`` | |
1302 | If the user has not already been denied repository access due to |
|
1303 | If the user has not already been denied repository access due to | |
1303 | the contents of deny_read, this list determines whether to grant |
|
1304 | the contents of deny_read, this list determines whether to grant | |
1304 | repository access to the user. If this list is not empty, and the |
|
1305 | repository access to the user. If this list is not empty, and the | |
1305 | user is unauthenticated or not present in the list, then access is |
|
1306 | user is unauthenticated or not present in the list, then access is | |
1306 | denied for the user. If the list is empty or not set, then access |
|
1307 | denied for the user. If the list is empty or not set, then access | |
1307 | is permitted to all users by default. Setting allow_read to the |
|
1308 | is permitted to all users by default. Setting allow_read to the | |
1308 | special value ``*`` is equivalent to it not being set (i.e. access |
|
1309 | special value ``*`` is equivalent to it not being set (i.e. access | |
1309 | is permitted to all users). The contents of the allow_read list are |
|
1310 | is permitted to all users). The contents of the allow_read list are | |
1310 | examined after the deny_read list. |
|
1311 | examined after the deny_read list. | |
1311 |
|
1312 | |||
1312 | ``allowzip`` |
|
1313 | ``allowzip`` | |
1313 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
1314 | (DEPRECATED) Whether to allow .zip downloading of repository | |
1314 | revisions. Default is False. This feature creates temporary files. |
|
1315 | revisions. Default is False. This feature creates temporary files. | |
1315 |
|
1316 | |||
1316 | ``archivesubrepos`` |
|
1317 | ``archivesubrepos`` | |
1317 | Whether to recurse into subrepositories when archiving. Default is |
|
1318 | Whether to recurse into subrepositories when archiving. Default is | |
1318 | False. |
|
1319 | False. | |
1319 |
|
1320 | |||
1320 | ``baseurl`` |
|
1321 | ``baseurl`` | |
1321 | Base URL to use when publishing URLs in other locations, so |
|
1322 | Base URL to use when publishing URLs in other locations, so | |
1322 | third-party tools like email notification hooks can construct |
|
1323 | third-party tools like email notification hooks can construct | |
1323 | URLs. Example: ``http://hgserver/repos/``. |
|
1324 | URLs. Example: ``http://hgserver/repos/``. | |
1324 |
|
1325 | |||
1325 | ``cacerts`` |
|
1326 | ``cacerts`` | |
1326 | Path to file containing a list of PEM encoded certificate |
|
1327 | Path to file containing a list of PEM encoded certificate | |
1327 | authority certificates. Environment variables and ``~user`` |
|
1328 | authority certificates. Environment variables and ``~user`` | |
1328 | constructs are expanded in the filename. If specified on the |
|
1329 | constructs are expanded in the filename. If specified on the | |
1329 | client, then it will verify the identity of remote HTTPS servers |
|
1330 | client, then it will verify the identity of remote HTTPS servers | |
1330 | with these certificates. |
|
1331 | with these certificates. | |
1331 |
|
1332 | |||
1332 | This feature is only supported when using Python 2.6 or later. If you wish |
|
1333 | This feature is only supported when using Python 2.6 or later. If you wish | |
1333 | to use it with earlier versions of Python, install the backported |
|
1334 | to use it with earlier versions of Python, install the backported | |
1334 | version of the ssl library that is available from |
|
1335 | version of the ssl library that is available from | |
1335 | ``http://pypi.python.org``. |
|
1336 | ``http://pypi.python.org``. | |
1336 |
|
1337 | |||
1337 | To disable SSL verification temporarily, specify ``--insecure`` from |
|
1338 | To disable SSL verification temporarily, specify ``--insecure`` from | |
1338 | command line. |
|
1339 | command line. | |
1339 |
|
1340 | |||
1340 | You can use OpenSSL's CA certificate file if your platform has |
|
1341 | You can use OpenSSL's CA certificate file if your platform has | |
1341 | one. On most Linux systems this will be |
|
1342 | one. On most Linux systems this will be | |
1342 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to |
|
1343 | ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to | |
1343 | generate this file manually. The form must be as follows:: |
|
1344 | generate this file manually. The form must be as follows:: | |
1344 |
|
1345 | |||
1345 | -----BEGIN CERTIFICATE----- |
|
1346 | -----BEGIN CERTIFICATE----- | |
1346 | ... (certificate in base64 PEM encoding) ... |
|
1347 | ... (certificate in base64 PEM encoding) ... | |
1347 | -----END CERTIFICATE----- |
|
1348 | -----END CERTIFICATE----- | |
1348 | -----BEGIN CERTIFICATE----- |
|
1349 | -----BEGIN CERTIFICATE----- | |
1349 | ... (certificate in base64 PEM encoding) ... |
|
1350 | ... (certificate in base64 PEM encoding) ... | |
1350 | -----END CERTIFICATE----- |
|
1351 | -----END CERTIFICATE----- | |
1351 |
|
1352 | |||
1352 | ``cache`` |
|
1353 | ``cache`` | |
1353 | Whether to support caching in hgweb. Defaults to True. |
|
1354 | Whether to support caching in hgweb. Defaults to True. | |
1354 |
|
1355 | |||
1355 | ``collapse`` |
|
1356 | ``collapse`` | |
1356 | With ``descend`` enabled, repositories in subdirectories are shown at |
|
1357 | With ``descend`` enabled, repositories in subdirectories are shown at | |
1357 | a single level alongside repositories in the current path. With |
|
1358 | a single level alongside repositories in the current path. With | |
1358 | ``collapse`` also enabled, repositories residing at a deeper level than |
|
1359 | ``collapse`` also enabled, repositories residing at a deeper level than | |
1359 | the current path are grouped behind navigable directory entries that |
|
1360 | the current path are grouped behind navigable directory entries that | |
1360 | lead to the locations of these repositories. In effect, this setting |
|
1361 | lead to the locations of these repositories. In effect, this setting | |
1361 | collapses each collection of repositories found within a subdirectory |
|
1362 | collapses each collection of repositories found within a subdirectory | |
1362 | into a single entry for that subdirectory. Default is False. |
|
1363 | into a single entry for that subdirectory. Default is False. | |
1363 |
|
1364 | |||
1364 | ``comparisoncontext`` |
|
1365 | ``comparisoncontext`` | |
1365 | Number of lines of context to show in side-by-side file comparison. If |
|
1366 | Number of lines of context to show in side-by-side file comparison. If | |
1366 | negative or the value ``full``, whole files are shown. Default is 5. |
|
1367 | negative or the value ``full``, whole files are shown. Default is 5. | |
1367 | This setting can be overridden by a ``context`` request parameter to the |
|
1368 | This setting can be overridden by a ``context`` request parameter to the | |
1368 | ``comparison`` command, taking the same values. |
|
1369 | ``comparison`` command, taking the same values. | |
1369 |
|
1370 | |||
1370 | ``contact`` |
|
1371 | ``contact`` | |
1371 | Name or email address of the person in charge of the repository. |
|
1372 | Name or email address of the person in charge of the repository. | |
1372 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. |
|
1373 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. | |
1373 |
|
1374 | |||
1374 | ``deny_push`` |
|
1375 | ``deny_push`` | |
1375 | Whether to deny pushing to the repository. If empty or not set, |
|
1376 | Whether to deny pushing to the repository. If empty or not set, | |
1376 | push is not denied. If the special value ``*``, all remote users are |
|
1377 | push is not denied. If the special value ``*``, all remote users are | |
1377 | denied push. Otherwise, unauthenticated users are all denied, and |
|
1378 | denied push. Otherwise, unauthenticated users are all denied, and | |
1378 | any authenticated user name present in this list is also denied. The |
|
1379 | any authenticated user name present in this list is also denied. The | |
1379 | contents of the deny_push list are examined before the allow_push list. |
|
1380 | contents of the deny_push list are examined before the allow_push list. | |
1380 |
|
1381 | |||
1381 | ``deny_read`` |
|
1382 | ``deny_read`` | |
1382 | Whether to deny reading/viewing of the repository. If this list is |
|
1383 | Whether to deny reading/viewing of the repository. If this list is | |
1383 | not empty, unauthenticated users are all denied, and any |
|
1384 | not empty, unauthenticated users are all denied, and any | |
1384 | authenticated user name present in this list is also denied access to |
|
1385 | authenticated user name present in this list is also denied access to | |
1385 | the repository. If set to the special value ``*``, all remote users |
|
1386 | the repository. If set to the special value ``*``, all remote users | |
1386 | are denied access (rarely needed ;). If deny_read is empty or not set, |
|
1387 | are denied access (rarely needed ;). If deny_read is empty or not set, | |
1387 | the determination of repository access depends on the presence and |
|
1388 | the determination of repository access depends on the presence and | |
1388 | content of the allow_read list (see description). If both |
|
1389 | content of the allow_read list (see description). If both | |
1389 | deny_read and allow_read are empty or not set, then access is |
|
1390 | deny_read and allow_read are empty or not set, then access is | |
1390 | permitted to all users by default. If the repository is being |
|
1391 | permitted to all users by default. If the repository is being | |
1391 | served via hgwebdir, denied users will not be able to see it in |
|
1392 | served via hgwebdir, denied users will not be able to see it in | |
1392 | the list of repositories. The contents of the deny_read list have |
|
1393 | the list of repositories. The contents of the deny_read list have | |
1393 | priority over (are examined before) the contents of the allow_read |
|
1394 | priority over (are examined before) the contents of the allow_read | |
1394 | list. |
|
1395 | list. | |
1395 |
|
1396 | |||
1396 | ``descend`` |
|
1397 | ``descend`` | |
1397 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
1398 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
1398 | directly in the current path will be shown (other repositories are still |
|
1399 | directly in the current path will be shown (other repositories are still | |
1399 | available from the index corresponding to their containing path). |
|
1400 | available from the index corresponding to their containing path). | |
1400 |
|
1401 | |||
1401 | ``description`` |
|
1402 | ``description`` | |
1402 | Textual description of the repository's purpose or contents. |
|
1403 | Textual description of the repository's purpose or contents. | |
1403 | Default is "unknown". |
|
1404 | Default is "unknown". | |
1404 |
|
1405 | |||
1405 | ``encoding`` |
|
1406 | ``encoding`` | |
1406 | Character encoding name. Default is the current locale charset. |
|
1407 | Character encoding name. Default is the current locale charset. | |
1407 | Example: "UTF-8" |
|
1408 | Example: "UTF-8" | |
1408 |
|
1409 | |||
1409 | ``errorlog`` |
|
1410 | ``errorlog`` | |
1410 | Where to output the error log. Default is stderr. |
|
1411 | Where to output the error log. Default is stderr. | |
1411 |
|
1412 | |||
1412 | ``guessmime`` |
|
1413 | ``guessmime`` | |
1413 | Control MIME types for raw download of file content. |
|
1414 | Control MIME types for raw download of file content. | |
1414 | Set to True to let hgweb guess the content type from the file |
|
1415 | Set to True to let hgweb guess the content type from the file | |
1415 | extension. This will serve HTML files as ``text/html`` and might |
|
1416 | extension. This will serve HTML files as ``text/html`` and might | |
1416 | allow cross-site scripting attacks when serving untrusted |
|
1417 | allow cross-site scripting attacks when serving untrusted | |
1417 | repositories. Default is False. |
|
1418 | repositories. Default is False. | |
1418 |
|
1419 | |||
1419 | ``hidden`` |
|
1420 | ``hidden`` | |
1420 | Whether to hide the repository in the hgwebdir index. |
|
1421 | Whether to hide the repository in the hgwebdir index. | |
1421 | Default is False. |
|
1422 | Default is False. | |
1422 |
|
1423 | |||
1423 | ``ipv6`` |
|
1424 | ``ipv6`` | |
1424 | Whether to use IPv6. Default is False. |
|
1425 | Whether to use IPv6. Default is False. | |
1425 |
|
1426 | |||
1426 | ``logoimg`` |
|
1427 | ``logoimg`` | |
1427 | File name of the logo image that some templates display on each page. |
|
1428 | File name of the logo image that some templates display on each page. | |
1428 | The file name is relative to ``staticurl``. That is, the full path to |
|
1429 | The file name is relative to ``staticurl``. That is, the full path to | |
1429 | the logo image is "staticurl/logoimg". |
|
1430 | the logo image is "staticurl/logoimg". | |
1430 | If unset, ``hglogo.png`` will be used. |
|
1431 | If unset, ``hglogo.png`` will be used. | |
1431 |
|
1432 | |||
1432 | ``logourl`` |
|
1433 | ``logourl`` | |
1433 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` |
|
1434 | Base URL to use for logos. If unset, ``http://mercurial.selenic.com/`` | |
1434 | will be used. |
|
1435 | will be used. | |
1435 |
|
1436 | |||
1436 | ``maxchanges`` |
|
1437 | ``maxchanges`` | |
1437 | Maximum number of changes to list on the changelog. Default is 10. |
|
1438 | Maximum number of changes to list on the changelog. Default is 10. | |
1438 |
|
1439 | |||
1439 | ``maxfiles`` |
|
1440 | ``maxfiles`` | |
1440 | Maximum number of files to list per changeset. Default is 10. |
|
1441 | Maximum number of files to list per changeset. Default is 10. | |
1441 |
|
1442 | |||
1442 | ``maxshortchanges`` |
|
1443 | ``maxshortchanges`` | |
1443 | Maximum number of changes to list on the shortlog, graph or filelog |
|
1444 | Maximum number of changes to list on the shortlog, graph or filelog | |
1444 | pages. Default is 60. |
|
1445 | pages. Default is 60. | |
1445 |
|
1446 | |||
1446 | ``name`` |
|
1447 | ``name`` | |
1447 | Repository name to use in the web interface. Default is current |
|
1448 | Repository name to use in the web interface. Default is current | |
1448 | working directory. |
|
1449 | working directory. | |
1449 |
|
1450 | |||
1450 | ``port`` |
|
1451 | ``port`` | |
1451 | Port to listen on. Default is 8000. |
|
1452 | Port to listen on. Default is 8000. | |
1452 |
|
1453 | |||
1453 | ``prefix`` |
|
1454 | ``prefix`` | |
1454 | Prefix path to serve from. Default is '' (server root). |
|
1455 | Prefix path to serve from. Default is '' (server root). | |
1455 |
|
1456 | |||
1456 | ``push_ssl`` |
|
1457 | ``push_ssl`` | |
1457 | Whether to require that inbound pushes be transported over SSL to |
|
1458 | Whether to require that inbound pushes be transported over SSL to | |
1458 | prevent password sniffing. Default is True. |
|
1459 | prevent password sniffing. Default is True. | |
1459 |
|
1460 | |||
1460 | ``staticurl`` |
|
1461 | ``staticurl`` | |
1461 | Base URL to use for static files. If unset, static files (e.g. the |
|
1462 | Base URL to use for static files. If unset, static files (e.g. the | |
1462 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
1463 | hgicon.png favicon) will be served by the CGI script itself. Use | |
1463 | this setting to serve them directly with the HTTP server. |
|
1464 | this setting to serve them directly with the HTTP server. | |
1464 | Example: ``http://hgserver/static/``. |
|
1465 | Example: ``http://hgserver/static/``. | |
1465 |
|
1466 | |||
1466 | ``stripes`` |
|
1467 | ``stripes`` | |
1467 | How many lines a "zebra stripe" should span in multi-line output. |
|
1468 | How many lines a "zebra stripe" should span in multi-line output. | |
1468 | Default is 1; set to 0 to disable. |
|
1469 | Default is 1; set to 0 to disable. | |
1469 |
|
1470 | |||
1470 | ``style`` |
|
1471 | ``style`` | |
1471 | Which template map style to use. |
|
1472 | Which template map style to use. | |
1472 |
|
1473 | |||
1473 | ``templates`` |
|
1474 | ``templates`` | |
1474 | Where to find the HTML templates. Default is install path. |
|
1475 | Where to find the HTML templates. Default is install path. | |
1475 |
|
1476 | |||
1476 | ``websub`` |
|
1477 | ``websub`` | |
1477 | ---------- |
|
1478 | ---------- | |
1478 |
|
1479 | |||
1479 | Web substitution filter definition. You can use this section to |
|
1480 | Web substitution filter definition. You can use this section to | |
1480 | define a set of regular expression substitution patterns which |
|
1481 | define a set of regular expression substitution patterns which | |
1481 | let you automatically modify the hgweb server output. |
|
1482 | let you automatically modify the hgweb server output. | |
1482 |
|
1483 | |||
1483 | The default hgweb templates only apply these substitution patterns |
|
1484 | The default hgweb templates only apply these substitution patterns | |
1484 | on the revision description fields. You can apply them anywhere |
|
1485 | on the revision description fields. You can apply them anywhere | |
1485 | you want when you create your own templates by adding calls to the |
|
1486 | you want when you create your own templates by adding calls to the | |
1486 | "websub" filter (usually after calling the "escape" filter). |
|
1487 | "websub" filter (usually after calling the "escape" filter). | |
1487 |
|
1488 | |||
1488 | This can be used, for example, to convert issue references to links |
|
1489 | This can be used, for example, to convert issue references to links | |
1489 | to your issue tracker, or to convert "markdown-like" syntax into |
|
1490 | to your issue tracker, or to convert "markdown-like" syntax into | |
1490 | HTML (see the examples below). |
|
1491 | HTML (see the examples below). | |
1491 |
|
1492 | |||
1492 | Each entry in this section names a substitution filter. |
|
1493 | Each entry in this section names a substitution filter. | |
1493 | The value of each entry defines the substitution expression itself. |
|
1494 | The value of each entry defines the substitution expression itself. | |
1494 | The websub expressions follow the old interhg extension syntax, |
|
1495 | The websub expressions follow the old interhg extension syntax, | |
1495 | which in turn imitates the Unix sed replacement syntax:: |
|
1496 | which in turn imitates the Unix sed replacement syntax:: | |
1496 |
|
1497 | |||
1497 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] |
|
1498 | patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i] | |
1498 |
|
1499 | |||
1499 | You can use any separator other than "/". The final "i" is optional |
|
1500 | You can use any separator other than "/". The final "i" is optional | |
1500 | and indicates that the search must be case insensitive. |
|
1501 | and indicates that the search must be case insensitive. | |
1501 |
|
1502 | |||
1502 | Examples:: |
|
1503 | Examples:: | |
1503 |
|
1504 | |||
1504 | [websub] |
|
1505 | [websub] | |
1505 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i |
|
1506 | issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i | |
1506 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ |
|
1507 | italic = s/\b_(\S+)_\b/<i>\1<\/i>/ | |
1507 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ |
|
1508 | bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/ | |
1508 |
|
1509 | |||
1509 | ``worker`` |
|
1510 | ``worker`` | |
1510 | ---------- |
|
1511 | ---------- | |
1511 |
|
1512 | |||
1512 | Parallel master/worker configuration. We currently perform working |
|
1513 | Parallel master/worker configuration. We currently perform working | |
1513 | directory updates in parallel on Unix-like systems, which greatly |
|
1514 | directory updates in parallel on Unix-like systems, which greatly | |
1514 | helps performance. |
|
1515 | helps performance. | |
1515 |
|
1516 | |||
1516 | ``numcpus`` |
|
1517 | ``numcpus`` | |
1517 | Number of CPUs to use for parallel operations. Default is 4 or the |
|
1518 | Number of CPUs to use for parallel operations. Default is 4 or the | |
1518 | number of CPUs on the system, whichever is larger. A zero or |
|
1519 | number of CPUs on the system, whichever is larger. A zero or | |
1519 | negative value is treated as ``use the default``. |
|
1520 | negative value is treated as ``use the default``. |
@@ -1,322 +1,326 b'' | |||||
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, sslutil |
|
9 | import util, encoding, sslutil | |
10 | import os, smtplib, socket, quopri, time, sys |
|
10 | import os, smtplib, socket, quopri, time, sys | |
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 | Python 2.7 introduces a backwards incompatible change |
|
16 | Python 2.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 | class STARTTLS(smtplib.SMTP): |
|
33 | class STARTTLS(smtplib.SMTP): | |
34 | '''Derived class to verify the peer certificate for STARTTLS. |
|
34 | '''Derived class to verify the peer certificate for STARTTLS. | |
35 |
|
35 | |||
36 | This class allows to pass any keyword arguments to SSL socket creation. |
|
36 | This class allows to pass any keyword arguments to SSL socket creation. | |
37 | ''' |
|
37 | ''' | |
38 | def __init__(self, sslkwargs, **kwargs): |
|
38 | def __init__(self, sslkwargs, **kwargs): | |
39 | smtplib.SMTP.__init__(self, **kwargs) |
|
39 | smtplib.SMTP.__init__(self, **kwargs) | |
40 | self._sslkwargs = sslkwargs |
|
40 | self._sslkwargs = sslkwargs | |
41 |
|
41 | |||
42 | def starttls(self, keyfile=None, certfile=None): |
|
42 | def starttls(self, keyfile=None, certfile=None): | |
43 | if not self.has_extn("starttls"): |
|
43 | if not self.has_extn("starttls"): | |
44 | msg = "STARTTLS extension not supported by server" |
|
44 | msg = "STARTTLS extension not supported by server" | |
45 | raise smtplib.SMTPException(msg) |
|
45 | raise smtplib.SMTPException(msg) | |
46 | (resp, reply) = self.docmd("STARTTLS") |
|
46 | (resp, reply) = self.docmd("STARTTLS") | |
47 | if resp == 220: |
|
47 | if resp == 220: | |
48 | self.sock = sslutil.ssl_wrap_socket(self.sock, keyfile, certfile, |
|
48 | self.sock = sslutil.ssl_wrap_socket(self.sock, keyfile, certfile, | |
49 | **self._sslkwargs) |
|
49 | **self._sslkwargs) | |
50 | if not util.safehasattr(self.sock, "read"): |
|
50 | if not util.safehasattr(self.sock, "read"): | |
51 | # using httplib.FakeSocket with Python 2.5.x or earlier |
|
51 | # using httplib.FakeSocket with Python 2.5.x or earlier | |
52 | self.sock.read = self.sock.recv |
|
52 | self.sock.read = self.sock.recv | |
53 | self.file = smtplib.SSLFakeFile(self.sock) |
|
53 | self.file = smtplib.SSLFakeFile(self.sock) | |
54 | self.helo_resp = None |
|
54 | self.helo_resp = None | |
55 | self.ehlo_resp = None |
|
55 | self.ehlo_resp = None | |
56 | self.esmtp_features = {} |
|
56 | self.esmtp_features = {} | |
57 | self.does_esmtp = 0 |
|
57 | self.does_esmtp = 0 | |
58 | return (resp, reply) |
|
58 | return (resp, reply) | |
59 |
|
59 | |||
60 | if util.safehasattr(smtplib.SMTP, '_get_socket'): |
|
60 | if util.safehasattr(smtplib.SMTP, '_get_socket'): | |
61 | class SMTPS(smtplib.SMTP): |
|
61 | class SMTPS(smtplib.SMTP): | |
62 | '''Derived class to verify the peer certificate for SMTPS. |
|
62 | '''Derived class to verify the peer certificate for SMTPS. | |
63 |
|
63 | |||
64 | This class allows to pass any keyword arguments to SSL socket creation. |
|
64 | This class allows to pass any keyword arguments to SSL socket creation. | |
65 | ''' |
|
65 | ''' | |
66 | def __init__(self, sslkwargs, keyfile=None, certfile=None, **kwargs): |
|
66 | def __init__(self, sslkwargs, keyfile=None, certfile=None, **kwargs): | |
67 | self.keyfile = keyfile |
|
67 | self.keyfile = keyfile | |
68 | self.certfile = certfile |
|
68 | self.certfile = certfile | |
69 | smtplib.SMTP.__init__(self, **kwargs) |
|
69 | smtplib.SMTP.__init__(self, **kwargs) | |
70 | self.default_port = smtplib.SMTP_SSL_PORT |
|
70 | self.default_port = smtplib.SMTP_SSL_PORT | |
71 | self._sslkwargs = sslkwargs |
|
71 | self._sslkwargs = sslkwargs | |
72 |
|
72 | |||
73 | def _get_socket(self, host, port, timeout): |
|
73 | def _get_socket(self, host, port, timeout): | |
74 | if self.debuglevel > 0: |
|
74 | if self.debuglevel > 0: | |
75 | print >> sys.stderr, 'connect:', (host, port) |
|
75 | print >> sys.stderr, 'connect:', (host, port) | |
76 | new_socket = socket.create_connection((host, port), timeout) |
|
76 | new_socket = socket.create_connection((host, port), timeout) | |
77 | new_socket = sslutil.ssl_wrap_socket(new_socket, |
|
77 | new_socket = sslutil.ssl_wrap_socket(new_socket, | |
78 | self.keyfile, self.certfile, |
|
78 | self.keyfile, self.certfile, | |
79 | **self._sslkwargs) |
|
79 | **self._sslkwargs) | |
80 | self.file = smtplib.SSLFakeFile(new_socket) |
|
80 | self.file = smtplib.SSLFakeFile(new_socket) | |
81 | return new_socket |
|
81 | return new_socket | |
82 | else: |
|
82 | else: | |
83 | def SMTPS(sslkwargs, keyfile=None, certfile=None, **kwargs): |
|
83 | def SMTPS(sslkwargs, keyfile=None, certfile=None, **kwargs): | |
84 | raise util.Abort(_('SMTPS requires Python 2.6 or later')) |
|
84 | raise util.Abort(_('SMTPS requires Python 2.6 or later')) | |
85 |
|
85 | |||
86 | def _smtp(ui): |
|
86 | def _smtp(ui): | |
87 | '''build an smtp connection and return a function to send mail''' |
|
87 | '''build an smtp connection and return a function to send mail''' | |
88 | local_hostname = ui.config('smtp', 'local_hostname') |
|
88 | local_hostname = ui.config('smtp', 'local_hostname') | |
89 | tls = ui.config('smtp', 'tls', 'none') |
|
89 | tls = ui.config('smtp', 'tls', 'none') | |
90 | # backward compatible: when tls = true, we use starttls. |
|
90 | # backward compatible: when tls = true, we use starttls. | |
91 | starttls = tls == 'starttls' or util.parsebool(tls) |
|
91 | starttls = tls == 'starttls' or util.parsebool(tls) | |
92 | smtps = tls == 'smtps' |
|
92 | smtps = tls == 'smtps' | |
93 | if (starttls or smtps) and not util.safehasattr(socket, 'ssl'): |
|
93 | if (starttls or smtps) and not util.safehasattr(socket, 'ssl'): | |
94 | raise util.Abort(_("can't use TLS: Python SSL support not installed")) |
|
94 | raise util.Abort(_("can't use TLS: Python SSL support not installed")) | |
95 | mailhost = ui.config('smtp', 'host') |
|
95 | mailhost = ui.config('smtp', 'host') | |
96 | if not mailhost: |
|
96 | if not mailhost: | |
97 | raise util.Abort(_('smtp.host not configured - cannot send mail')) |
|
97 | raise util.Abort(_('smtp.host not configured - cannot send mail')) | |
98 | verifycert = ui.config('smtp', 'verifycert', 'strict') |
|
98 | verifycert = ui.config('smtp', 'verifycert', 'strict') | |
99 | if verifycert not in ['strict', 'loose']: |
|
99 | if verifycert not in ['strict', 'loose']: | |
100 | if util.parsebool(verifycert) is not False: |
|
100 | if util.parsebool(verifycert) is not False: | |
101 | raise util.Abort(_('invalid smtp.verifycert configuration: %s') |
|
101 | raise util.Abort(_('invalid smtp.verifycert configuration: %s') | |
102 | % (verifycert)) |
|
102 | % (verifycert)) | |
103 | if (starttls or smtps) and verifycert: |
|
103 | if (starttls or smtps) and verifycert: | |
104 | sslkwargs = sslutil.sslkwargs(ui, mailhost) |
|
104 | sslkwargs = sslutil.sslkwargs(ui, mailhost) | |
105 | else: |
|
105 | else: | |
106 | sslkwargs = {} |
|
106 | sslkwargs = {} | |
107 | if smtps: |
|
107 | if smtps: | |
108 | ui.note(_('(using smtps)\n')) |
|
108 | ui.note(_('(using smtps)\n')) | |
109 | s = SMTPS(sslkwargs, local_hostname=local_hostname) |
|
109 | s = SMTPS(sslkwargs, local_hostname=local_hostname) | |
110 | elif starttls: |
|
110 | elif starttls: | |
111 | s = STARTTLS(sslkwargs, local_hostname=local_hostname) |
|
111 | s = STARTTLS(sslkwargs, local_hostname=local_hostname) | |
112 | else: |
|
112 | else: | |
113 | s = smtplib.SMTP(local_hostname=local_hostname) |
|
113 | s = smtplib.SMTP(local_hostname=local_hostname) | |
114 | mailport = util.getport(ui.config('smtp', 'port', 25)) |
|
114 | if smtps: | |
|
115 | defaultport = 465 | |||
|
116 | else: | |||
|
117 | defaultport = 25 | |||
|
118 | mailport = util.getport(ui.config('smtp', 'port', defaultport)) | |||
115 | ui.note(_('sending mail: smtp host %s, port %s\n') % |
|
119 | ui.note(_('sending mail: smtp host %s, port %s\n') % | |
116 | (mailhost, mailport)) |
|
120 | (mailhost, mailport)) | |
117 | s.connect(host=mailhost, port=mailport) |
|
121 | s.connect(host=mailhost, port=mailport) | |
118 | if starttls: |
|
122 | if starttls: | |
119 | ui.note(_('(using starttls)\n')) |
|
123 | ui.note(_('(using starttls)\n')) | |
120 | s.ehlo() |
|
124 | s.ehlo() | |
121 | s.starttls() |
|
125 | s.starttls() | |
122 | s.ehlo() |
|
126 | s.ehlo() | |
123 | if (starttls or smtps) and verifycert: |
|
127 | if (starttls or smtps) and verifycert: | |
124 | ui.note(_('(verifying remote certificate)\n')) |
|
128 | ui.note(_('(verifying remote certificate)\n')) | |
125 | sslutil.validator(ui, mailhost)(s.sock, verifycert == 'strict') |
|
129 | sslutil.validator(ui, mailhost)(s.sock, verifycert == 'strict') | |
126 | username = ui.config('smtp', 'username') |
|
130 | username = ui.config('smtp', 'username') | |
127 | password = ui.config('smtp', 'password') |
|
131 | password = ui.config('smtp', 'password') | |
128 | if username and not password: |
|
132 | if username and not password: | |
129 | password = ui.getpass() |
|
133 | password = ui.getpass() | |
130 | if username and password: |
|
134 | if username and password: | |
131 | ui.note(_('(authenticating to mail server as %s)\n') % |
|
135 | ui.note(_('(authenticating to mail server as %s)\n') % | |
132 | (username)) |
|
136 | (username)) | |
133 | try: |
|
137 | try: | |
134 | s.login(username, password) |
|
138 | s.login(username, password) | |
135 | except smtplib.SMTPException, inst: |
|
139 | except smtplib.SMTPException, inst: | |
136 | raise util.Abort(inst) |
|
140 | raise util.Abort(inst) | |
137 |
|
141 | |||
138 | def send(sender, recipients, msg): |
|
142 | def send(sender, recipients, msg): | |
139 | try: |
|
143 | try: | |
140 | return s.sendmail(sender, recipients, msg) |
|
144 | return s.sendmail(sender, recipients, msg) | |
141 | except smtplib.SMTPRecipientsRefused, inst: |
|
145 | except smtplib.SMTPRecipientsRefused, inst: | |
142 | recipients = [r[1] for r in inst.recipients.values()] |
|
146 | recipients = [r[1] for r in inst.recipients.values()] | |
143 | raise util.Abort('\n' + '\n'.join(recipients)) |
|
147 | raise util.Abort('\n' + '\n'.join(recipients)) | |
144 | except smtplib.SMTPException, inst: |
|
148 | except smtplib.SMTPException, inst: | |
145 | raise util.Abort(inst) |
|
149 | raise util.Abort(inst) | |
146 |
|
150 | |||
147 | return send |
|
151 | return send | |
148 |
|
152 | |||
149 | def _sendmail(ui, sender, recipients, msg): |
|
153 | def _sendmail(ui, sender, recipients, msg): | |
150 | '''send mail using sendmail.''' |
|
154 | '''send mail using sendmail.''' | |
151 | program = ui.config('email', 'method') |
|
155 | program = ui.config('email', 'method') | |
152 | cmdline = '%s -f %s %s' % (program, util.email(sender), |
|
156 | cmdline = '%s -f %s %s' % (program, util.email(sender), | |
153 | ' '.join(map(util.email, recipients))) |
|
157 | ' '.join(map(util.email, recipients))) | |
154 | ui.note(_('sending mail: %s\n') % cmdline) |
|
158 | ui.note(_('sending mail: %s\n') % cmdline) | |
155 | fp = util.popen(cmdline, 'w') |
|
159 | fp = util.popen(cmdline, 'w') | |
156 | fp.write(msg) |
|
160 | fp.write(msg) | |
157 | ret = fp.close() |
|
161 | ret = fp.close() | |
158 | if ret: |
|
162 | if ret: | |
159 | raise util.Abort('%s %s' % ( |
|
163 | raise util.Abort('%s %s' % ( | |
160 | os.path.basename(program.split(None, 1)[0]), |
|
164 | os.path.basename(program.split(None, 1)[0]), | |
161 | util.explainexit(ret)[0])) |
|
165 | util.explainexit(ret)[0])) | |
162 |
|
166 | |||
163 | def _mbox(mbox, sender, recipients, msg): |
|
167 | def _mbox(mbox, sender, recipients, msg): | |
164 | '''write mails to mbox''' |
|
168 | '''write mails to mbox''' | |
165 | fp = open(mbox, 'ab+') |
|
169 | fp = open(mbox, 'ab+') | |
166 | # Should be time.asctime(), but Windows prints 2-characters day |
|
170 | # Should be time.asctime(), but Windows prints 2-characters day | |
167 | # of month instead of one. Make them print the same thing. |
|
171 | # of month instead of one. Make them print the same thing. | |
168 | date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime()) |
|
172 | date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime()) | |
169 | fp.write('From %s %s\n' % (sender, date)) |
|
173 | fp.write('From %s %s\n' % (sender, date)) | |
170 | fp.write(msg) |
|
174 | fp.write(msg) | |
171 | fp.write('\n\n') |
|
175 | fp.write('\n\n') | |
172 | fp.close() |
|
176 | fp.close() | |
173 |
|
177 | |||
174 | def connect(ui, mbox=None): |
|
178 | def connect(ui, mbox=None): | |
175 | '''make a mail connection. return a function to send mail. |
|
179 | '''make a mail connection. return a function to send mail. | |
176 | call as sendmail(sender, list-of-recipients, msg).''' |
|
180 | call as sendmail(sender, list-of-recipients, msg).''' | |
177 | if mbox: |
|
181 | if mbox: | |
178 | open(mbox, 'wb').close() |
|
182 | open(mbox, 'wb').close() | |
179 | return lambda s, r, m: _mbox(mbox, s, r, m) |
|
183 | return lambda s, r, m: _mbox(mbox, s, r, m) | |
180 | if ui.config('email', 'method', 'smtp') == 'smtp': |
|
184 | if ui.config('email', 'method', 'smtp') == 'smtp': | |
181 | return _smtp(ui) |
|
185 | return _smtp(ui) | |
182 | return lambda s, r, m: _sendmail(ui, s, r, m) |
|
186 | return lambda s, r, m: _sendmail(ui, s, r, m) | |
183 |
|
187 | |||
184 | def sendmail(ui, sender, recipients, msg, mbox=None): |
|
188 | def sendmail(ui, sender, recipients, msg, mbox=None): | |
185 | send = connect(ui, mbox=mbox) |
|
189 | send = connect(ui, mbox=mbox) | |
186 | return send(sender, recipients, msg) |
|
190 | return send(sender, recipients, msg) | |
187 |
|
191 | |||
188 | def validateconfig(ui): |
|
192 | def validateconfig(ui): | |
189 | '''determine if we have enough config data to try sending email.''' |
|
193 | '''determine if we have enough config data to try sending email.''' | |
190 | method = ui.config('email', 'method', 'smtp') |
|
194 | method = ui.config('email', 'method', 'smtp') | |
191 | if method == 'smtp': |
|
195 | if method == 'smtp': | |
192 | if not ui.config('smtp', 'host'): |
|
196 | if not ui.config('smtp', 'host'): | |
193 | raise util.Abort(_('smtp specified as email transport, ' |
|
197 | raise util.Abort(_('smtp specified as email transport, ' | |
194 | 'but no smtp host configured')) |
|
198 | 'but no smtp host configured')) | |
195 | else: |
|
199 | else: | |
196 | if not util.findexe(method): |
|
200 | if not util.findexe(method): | |
197 | raise util.Abort(_('%r specified as email transport, ' |
|
201 | raise util.Abort(_('%r specified as email transport, ' | |
198 | 'but not in PATH') % method) |
|
202 | 'but not in PATH') % method) | |
199 |
|
203 | |||
200 | def mimetextpatch(s, subtype='plain', display=False): |
|
204 | def mimetextpatch(s, subtype='plain', display=False): | |
201 | '''Return MIME message suitable for a patch. |
|
205 | '''Return MIME message suitable for a patch. | |
202 | Charset will be detected as utf-8 or (possibly fake) us-ascii. |
|
206 | Charset will be detected as utf-8 or (possibly fake) us-ascii. | |
203 | Transfer encodings will be used if necessary.''' |
|
207 | Transfer encodings will be used if necessary.''' | |
204 |
|
208 | |||
205 | cs = 'us-ascii' |
|
209 | cs = 'us-ascii' | |
206 | if not display: |
|
210 | if not display: | |
207 | try: |
|
211 | try: | |
208 | s.decode('us-ascii') |
|
212 | s.decode('us-ascii') | |
209 | except UnicodeDecodeError: |
|
213 | except UnicodeDecodeError: | |
210 | try: |
|
214 | try: | |
211 | s.decode('utf-8') |
|
215 | s.decode('utf-8') | |
212 | cs = 'utf-8' |
|
216 | cs = 'utf-8' | |
213 | except UnicodeDecodeError: |
|
217 | except UnicodeDecodeError: | |
214 | # We'll go with us-ascii as a fallback. |
|
218 | # We'll go with us-ascii as a fallback. | |
215 | pass |
|
219 | pass | |
216 |
|
220 | |||
217 | return mimetextqp(s, subtype, cs) |
|
221 | return mimetextqp(s, subtype, cs) | |
218 |
|
222 | |||
219 | def mimetextqp(body, subtype, charset): |
|
223 | def mimetextqp(body, subtype, charset): | |
220 | '''Return MIME message. |
|
224 | '''Return MIME message. | |
221 | Quoted-printable transfer encoding will be used if necessary. |
|
225 | Quoted-printable transfer encoding will be used if necessary. | |
222 | ''' |
|
226 | ''' | |
223 | enc = None |
|
227 | enc = None | |
224 | for line in body.splitlines(): |
|
228 | for line in body.splitlines(): | |
225 | if len(line) > 950: |
|
229 | if len(line) > 950: | |
226 | body = quopri.encodestring(body) |
|
230 | body = quopri.encodestring(body) | |
227 | enc = "quoted-printable" |
|
231 | enc = "quoted-printable" | |
228 | break |
|
232 | break | |
229 |
|
233 | |||
230 | msg = email.MIMEText.MIMEText(body, subtype, charset) |
|
234 | msg = email.MIMEText.MIMEText(body, subtype, charset) | |
231 | if enc: |
|
235 | if enc: | |
232 | del msg['Content-Transfer-Encoding'] |
|
236 | del msg['Content-Transfer-Encoding'] | |
233 | msg['Content-Transfer-Encoding'] = enc |
|
237 | msg['Content-Transfer-Encoding'] = enc | |
234 | return msg |
|
238 | return msg | |
235 |
|
239 | |||
236 | def _charsets(ui): |
|
240 | def _charsets(ui): | |
237 | '''Obtains charsets to send mail parts not containing patches.''' |
|
241 | '''Obtains charsets to send mail parts not containing patches.''' | |
238 | charsets = [cs.lower() for cs in ui.configlist('email', 'charsets')] |
|
242 | charsets = [cs.lower() for cs in ui.configlist('email', 'charsets')] | |
239 | fallbacks = [encoding.fallbackencoding.lower(), |
|
243 | fallbacks = [encoding.fallbackencoding.lower(), | |
240 | encoding.encoding.lower(), 'utf-8'] |
|
244 | encoding.encoding.lower(), 'utf-8'] | |
241 | for cs in fallbacks: # find unique charsets while keeping order |
|
245 | for cs in fallbacks: # find unique charsets while keeping order | |
242 | if cs not in charsets: |
|
246 | if cs not in charsets: | |
243 | charsets.append(cs) |
|
247 | charsets.append(cs) | |
244 | return [cs for cs in charsets if not cs.endswith('ascii')] |
|
248 | return [cs for cs in charsets if not cs.endswith('ascii')] | |
245 |
|
249 | |||
246 | def _encode(ui, s, charsets): |
|
250 | def _encode(ui, s, charsets): | |
247 | '''Returns (converted) string, charset tuple. |
|
251 | '''Returns (converted) string, charset tuple. | |
248 | Finds out best charset by cycling through sendcharsets in descending |
|
252 | Finds out best charset by cycling through sendcharsets in descending | |
249 | order. Tries both encoding and fallbackencoding for input. Only as |
|
253 | order. Tries both encoding and fallbackencoding for input. Only as | |
250 | last resort send as is in fake ascii. |
|
254 | last resort send as is in fake ascii. | |
251 | Caveat: Do not use for mail parts containing patches!''' |
|
255 | Caveat: Do not use for mail parts containing patches!''' | |
252 | try: |
|
256 | try: | |
253 | s.decode('ascii') |
|
257 | s.decode('ascii') | |
254 | except UnicodeDecodeError: |
|
258 | except UnicodeDecodeError: | |
255 | sendcharsets = charsets or _charsets(ui) |
|
259 | sendcharsets = charsets or _charsets(ui) | |
256 | for ics in (encoding.encoding, encoding.fallbackencoding): |
|
260 | for ics in (encoding.encoding, encoding.fallbackencoding): | |
257 | try: |
|
261 | try: | |
258 | u = s.decode(ics) |
|
262 | u = s.decode(ics) | |
259 | except UnicodeDecodeError: |
|
263 | except UnicodeDecodeError: | |
260 | continue |
|
264 | continue | |
261 | for ocs in sendcharsets: |
|
265 | for ocs in sendcharsets: | |
262 | try: |
|
266 | try: | |
263 | return u.encode(ocs), ocs |
|
267 | return u.encode(ocs), ocs | |
264 | except UnicodeEncodeError: |
|
268 | except UnicodeEncodeError: | |
265 | pass |
|
269 | pass | |
266 | except LookupError: |
|
270 | except LookupError: | |
267 | ui.warn(_('ignoring invalid sendcharset: %s\n') % ocs) |
|
271 | ui.warn(_('ignoring invalid sendcharset: %s\n') % ocs) | |
268 | # if ascii, or all conversion attempts fail, send (broken) ascii |
|
272 | # if ascii, or all conversion attempts fail, send (broken) ascii | |
269 | return s, 'us-ascii' |
|
273 | return s, 'us-ascii' | |
270 |
|
274 | |||
271 | def headencode(ui, s, charsets=None, display=False): |
|
275 | def headencode(ui, s, charsets=None, display=False): | |
272 | '''Returns RFC-2047 compliant header from given string.''' |
|
276 | '''Returns RFC-2047 compliant header from given string.''' | |
273 | if not display: |
|
277 | if not display: | |
274 | # split into words? |
|
278 | # split into words? | |
275 | s, cs = _encode(ui, s, charsets) |
|
279 | s, cs = _encode(ui, s, charsets) | |
276 | return str(email.Header.Header(s, cs)) |
|
280 | return str(email.Header.Header(s, cs)) | |
277 | return s |
|
281 | return s | |
278 |
|
282 | |||
279 | def _addressencode(ui, name, addr, charsets=None): |
|
283 | def _addressencode(ui, name, addr, charsets=None): | |
280 | name = headencode(ui, name, charsets) |
|
284 | name = headencode(ui, name, charsets) | |
281 | try: |
|
285 | try: | |
282 | acc, dom = addr.split('@') |
|
286 | acc, dom = addr.split('@') | |
283 | acc = acc.encode('ascii') |
|
287 | acc = acc.encode('ascii') | |
284 | dom = dom.decode(encoding.encoding).encode('idna') |
|
288 | dom = dom.decode(encoding.encoding).encode('idna') | |
285 | addr = '%s@%s' % (acc, dom) |
|
289 | addr = '%s@%s' % (acc, dom) | |
286 | except UnicodeDecodeError: |
|
290 | except UnicodeDecodeError: | |
287 | raise util.Abort(_('invalid email address: %s') % addr) |
|
291 | raise util.Abort(_('invalid email address: %s') % addr) | |
288 | except ValueError: |
|
292 | except ValueError: | |
289 | try: |
|
293 | try: | |
290 | # too strict? |
|
294 | # too strict? | |
291 | addr = addr.encode('ascii') |
|
295 | addr = addr.encode('ascii') | |
292 | except UnicodeDecodeError: |
|
296 | except UnicodeDecodeError: | |
293 | raise util.Abort(_('invalid local address: %s') % addr) |
|
297 | raise util.Abort(_('invalid local address: %s') % addr) | |
294 | return email.Utils.formataddr((name, addr)) |
|
298 | return email.Utils.formataddr((name, addr)) | |
295 |
|
299 | |||
296 | def addressencode(ui, address, charsets=None, display=False): |
|
300 | def addressencode(ui, address, charsets=None, display=False): | |
297 | '''Turns address into RFC-2047 compliant header.''' |
|
301 | '''Turns address into RFC-2047 compliant header.''' | |
298 | if display or not address: |
|
302 | if display or not address: | |
299 | return address or '' |
|
303 | return address or '' | |
300 | name, addr = email.Utils.parseaddr(address) |
|
304 | name, addr = email.Utils.parseaddr(address) | |
301 | return _addressencode(ui, name, addr, charsets) |
|
305 | return _addressencode(ui, name, addr, charsets) | |
302 |
|
306 | |||
303 | def addrlistencode(ui, addrs, charsets=None, display=False): |
|
307 | def addrlistencode(ui, addrs, charsets=None, display=False): | |
304 | '''Turns a list of addresses into a list of RFC-2047 compliant headers. |
|
308 | '''Turns a list of addresses into a list of RFC-2047 compliant headers. | |
305 | A single element of input list may contain multiple addresses, but output |
|
309 | A single element of input list may contain multiple addresses, but output | |
306 | always has one address per item''' |
|
310 | always has one address per item''' | |
307 | if display: |
|
311 | if display: | |
308 | return [a.strip() for a in addrs if a.strip()] |
|
312 | return [a.strip() for a in addrs if a.strip()] | |
309 |
|
313 | |||
310 | result = [] |
|
314 | result = [] | |
311 | for name, addr in email.Utils.getaddresses(addrs): |
|
315 | for name, addr in email.Utils.getaddresses(addrs): | |
312 | if name or addr: |
|
316 | if name or addr: | |
313 | result.append(_addressencode(ui, name, addr, charsets)) |
|
317 | result.append(_addressencode(ui, name, addr, charsets)) | |
314 | return result |
|
318 | return result | |
315 |
|
319 | |||
316 | def mimeencode(ui, s, charsets=None, display=False): |
|
320 | def mimeencode(ui, s, charsets=None, display=False): | |
317 | '''creates mime text object, encodes it if needed, and sets |
|
321 | '''creates mime text object, encodes it if needed, and sets | |
318 | charset and transfer-encoding accordingly.''' |
|
322 | charset and transfer-encoding accordingly.''' | |
319 | cs = 'us-ascii' |
|
323 | cs = 'us-ascii' | |
320 | if not display: |
|
324 | if not display: | |
321 | s, cs = _encode(ui, s, charsets) |
|
325 | s, cs = _encode(ui, s, charsets) | |
322 | return mimetextqp(s, 'plain', cs) |
|
326 | return mimetextqp(s, 'plain', cs) |
General Comments 0
You need to be logged in to leave comments.
Login now