Show More
@@ -1,960 +1,963 b'' | |||||
1 | ====== |
|
1 | ====== | |
2 | hgrc |
|
2 | hgrc | |
3 | ====== |
|
3 | ====== | |
4 |
|
4 | |||
5 | --------------------------------- |
|
5 | --------------------------------- | |
6 | configuration files for Mercurial |
|
6 | configuration files for Mercurial | |
7 | --------------------------------- |
|
7 | --------------------------------- | |
8 |
|
8 | |||
9 | :Author: Bryan O'Sullivan <bos@serpentine.com> |
|
9 | :Author: Bryan O'Sullivan <bos@serpentine.com> | |
10 | :Organization: Mercurial |
|
10 | :Organization: Mercurial | |
11 | :Manual section: 5 |
|
11 | :Manual section: 5 | |
12 | :Manual group: Mercurial Manual |
|
12 | :Manual group: Mercurial Manual | |
13 |
|
13 | |||
14 | .. contents:: |
|
14 | .. contents:: | |
15 | :backlinks: top |
|
15 | :backlinks: top | |
16 | :class: htmlonly |
|
16 | :class: htmlonly | |
17 |
|
17 | |||
18 |
|
18 | |||
19 | Synopsis |
|
19 | Synopsis | |
20 | -------- |
|
20 | -------- | |
21 |
|
21 | |||
22 | The Mercurial system uses a set of configuration files to control |
|
22 | The Mercurial system uses a set of configuration files to control | |
23 | aspects of its behavior. |
|
23 | aspects of its behavior. | |
24 |
|
24 | |||
25 | Files |
|
25 | Files | |
26 | ----- |
|
26 | ----- | |
27 |
|
27 | |||
28 | Mercurial reads configuration data from several files, if they exist. |
|
28 | Mercurial reads configuration data from several files, if they exist. | |
29 | The names of these files depend on the system on which Mercurial is |
|
29 | The names of these files depend on the system on which Mercurial is | |
30 | installed. ``*.rc`` files from a single directory are read in |
|
30 | installed. ``*.rc`` files from a single directory are read in | |
31 | alphabetical order, later ones overriding earlier ones. Where multiple |
|
31 | alphabetical order, later ones overriding earlier ones. Where multiple | |
32 | paths are given below, settings from earlier paths override later |
|
32 | paths are given below, settings from earlier paths override later | |
33 | ones. |
|
33 | ones. | |
34 |
|
34 | |||
35 | | (Unix, Windows) ``<repo>/.hg/hgrc`` |
|
35 | | (Unix, Windows) ``<repo>/.hg/hgrc`` | |
36 |
|
36 | |||
37 | Per-repository configuration options that only apply in a |
|
37 | Per-repository configuration options that only apply in a | |
38 | particular repository. This file is not version-controlled, and |
|
38 | particular repository. This file is not version-controlled, and | |
39 | will not get transferred during a "clone" operation. Options in |
|
39 | will not get transferred during a "clone" operation. Options in | |
40 | this file override options in all other configuration files. On |
|
40 | this file override options in all other configuration files. On | |
41 | Unix, most of this file will be ignored if it doesn't belong to a |
|
41 | Unix, most of this file will be ignored if it doesn't belong to a | |
42 | trusted user or to a trusted group. See the documentation for the |
|
42 | trusted user or to a trusted group. See the documentation for the | |
43 | trusted_ section below for more details. |
|
43 | trusted_ section below for more details. | |
44 |
|
44 | |||
45 | | (Unix) ``$HOME/.hgrc`` |
|
45 | | (Unix) ``$HOME/.hgrc`` | |
46 | | (Windows) ``%USERPROFILE%\.hgrc`` |
|
46 | | (Windows) ``%USERPROFILE%\.hgrc`` | |
47 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` |
|
47 | | (Windows) ``%USERPROFILE%\Mercurial.ini`` | |
48 | | (Windows) ``%HOME%\.hgrc`` |
|
48 | | (Windows) ``%HOME%\.hgrc`` | |
49 | | (Windows) ``%HOME%\Mercurial.ini`` |
|
49 | | (Windows) ``%HOME%\Mercurial.ini`` | |
50 |
|
50 | |||
51 | Per-user configuration file(s), for the user running Mercurial. On |
|
51 | Per-user configuration file(s), for the user running Mercurial. On | |
52 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these |
|
52 | Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these | |
53 | files apply to all Mercurial commands executed by this user in any |
|
53 | files apply to all Mercurial commands executed by this user in any | |
54 | directory. Options in these files override per-system and per-installation |
|
54 | directory. Options in these files override per-system and per-installation | |
55 | options. |
|
55 | options. | |
56 |
|
56 | |||
57 | | (Unix) ``/etc/mercurial/hgrc`` |
|
57 | | (Unix) ``/etc/mercurial/hgrc`` | |
58 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` |
|
58 | | (Unix) ``/etc/mercurial/hgrc.d/*.rc`` | |
59 |
|
59 | |||
60 | Per-system configuration files, for the system on which Mercurial |
|
60 | Per-system configuration files, for the system on which Mercurial | |
61 | is running. Options in these files apply to all Mercurial commands |
|
61 | is running. Options in these files apply to all Mercurial commands | |
62 | executed by any user in any directory. Options in these files |
|
62 | executed by any user in any directory. Options in these files | |
63 | override per-installation options. |
|
63 | override per-installation options. | |
64 |
|
64 | |||
65 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` |
|
65 | | (Unix) ``<install-root>/etc/mercurial/hgrc`` | |
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` |
|
66 | | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc`` | |
67 |
|
67 | |||
68 | Per-installation configuration files, searched for in the |
|
68 | Per-installation configuration files, searched for in the | |
69 | directory where Mercurial is installed. ``<install-root>`` is the |
|
69 | directory where Mercurial is installed. ``<install-root>`` is the | |
70 | parent directory of the **hg** executable (or symlink) being run. For |
|
70 | parent directory of the **hg** executable (or symlink) being run. For | |
71 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look |
|
71 | example, if installed in ``/shared/tools/bin/hg``, Mercurial will look | |
72 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply |
|
72 | in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply | |
73 | to all Mercurial commands executed by any user in any directory. |
|
73 | to all Mercurial commands executed by any user in any directory. | |
74 |
|
74 | |||
75 |
| (Windows) `` |
|
75 | | (Windows) ``<install-dir>\Mercurial.ini`` | |
|
76 | | (Windows) ``<install-dir>\hgrc.d\*.rc`` | |||
76 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` |
|
77 | | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` | |
77 | | (Windows) ``<install-dir>\Mercurial.ini`` |
|
|||
78 |
|
78 | |||
79 | Per-installation/system configuration files, for the system on |
|
79 | Per-installation/system configuration files, for the system on | |
80 | which Mercurial is running. Options in these files apply to all |
|
80 | which Mercurial is running. Options in these files apply to all | |
81 | Mercurial commands executed by any user in any directory. Registry |
|
81 | Mercurial commands executed by any user in any directory. Registry | |
82 | keys contain PATH-like strings, every part of which must reference |
|
82 | keys contain PATH-like strings, every part of which must reference | |
83 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will |
|
83 | a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will | |
84 | be read. |
|
84 | be read. Mercurial checks each of these locations in the specified | |
|
85 | order until one or more configuration files are detected. If the | |||
|
86 | py2win32 extensions are not installed, Mercurial will only look for | |||
|
87 | site-wide configuration in ``C:\Mercurial\Mercurial.ini``. | |||
85 |
|
88 | |||
86 | Syntax |
|
89 | Syntax | |
87 | ------ |
|
90 | ------ | |
88 |
|
91 | |||
89 | A configuration file consists of sections, led by a ``[section]`` header |
|
92 | A configuration file consists of sections, led by a ``[section]`` header | |
90 | and followed by ``name = value`` entries:: |
|
93 | and followed by ``name = value`` entries:: | |
91 |
|
94 | |||
92 | [spam] |
|
95 | [spam] | |
93 | eggs=ham |
|
96 | eggs=ham | |
94 | green= |
|
97 | green= | |
95 | eggs |
|
98 | eggs | |
96 |
|
99 | |||
97 | 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, | |
98 | they are treated as continuations of that entry. Leading whitespace is |
|
101 | they are treated as continuations of that entry. Leading whitespace is | |
99 | removed from values. Empty lines are skipped. Lines beginning with |
|
102 | removed from values. Empty lines are skipped. Lines beginning with | |
100 | ``#`` or ``;`` are ignored and may be used to provide comments. |
|
103 | ``#`` or ``;`` are ignored and may be used to provide comments. | |
101 |
|
104 | |||
102 | A line of the form ``%include file`` will include ``file`` into the |
|
105 | A line of the form ``%include file`` will include ``file`` into the | |
103 | current configuration file. The inclusion is recursive, which means |
|
106 | current configuration file. The inclusion is recursive, which means | |
104 | that included files can include other files. Filenames are relative to |
|
107 | that included files can include other files. Filenames are relative to | |
105 | the configuration file in which the ``%include`` directive is found. |
|
108 | the configuration file in which the ``%include`` directive is found. | |
106 |
|
109 | |||
107 | A line with ``%unset name`` will remove ``name`` from the current |
|
110 | A line with ``%unset name`` will remove ``name`` from the current | |
108 | section, if it has been set previously. |
|
111 | section, if it has been set previously. | |
109 |
|
112 | |||
110 |
|
113 | |||
111 | Sections |
|
114 | Sections | |
112 | -------- |
|
115 | -------- | |
113 |
|
116 | |||
114 | This section describes the different sections that may appear in a |
|
117 | This section describes the different sections that may appear in a | |
115 | Mercurial "hgrc" file, the purpose of each section, its possible keys, |
|
118 | Mercurial "hgrc" file, the purpose of each section, its possible keys, | |
116 | and their possible values. |
|
119 | and their possible values. | |
117 |
|
120 | |||
118 | ``alias`` |
|
121 | ``alias`` | |
119 | """"""""" |
|
122 | """"""""" | |
120 | Defines command aliases. |
|
123 | Defines command aliases. | |
121 | Aliases allow you to define your own commands in terms of other |
|
124 | Aliases allow you to define your own commands in terms of other | |
122 | commands (or aliases), optionally including arguments. |
|
125 | commands (or aliases), optionally including arguments. | |
123 |
|
126 | |||
124 | Alias definitions consist of lines of the form:: |
|
127 | Alias definitions consist of lines of the form:: | |
125 |
|
128 | |||
126 | <alias> = <command> [<argument]... |
|
129 | <alias> = <command> [<argument]... | |
127 |
|
130 | |||
128 | For example, this definition:: |
|
131 | For example, this definition:: | |
129 |
|
132 | |||
130 | latest = log --limit 5 |
|
133 | latest = log --limit 5 | |
131 |
|
134 | |||
132 | creates a new command ``latest`` that shows only the five most recent |
|
135 | creates a new command ``latest`` that shows only the five most recent | |
133 | changesets. You can define subsequent aliases using earlier ones:: |
|
136 | changesets. You can define subsequent aliases using earlier ones:: | |
134 |
|
137 | |||
135 | stable5 = latest -b stable |
|
138 | stable5 = latest -b stable | |
136 |
|
139 | |||
137 | .. note:: It is possible to create aliases with the same names as |
|
140 | .. note:: It is possible to create aliases with the same names as | |
138 | existing commands, which will then override the original |
|
141 | existing commands, which will then override the original | |
139 | definitions. This is almost always a bad idea! |
|
142 | definitions. This is almost always a bad idea! | |
140 |
|
143 | |||
141 |
|
144 | |||
142 | ``auth`` |
|
145 | ``auth`` | |
143 | """""""" |
|
146 | """""""" | |
144 | Authentication credentials for HTTP authentication. Each line has |
|
147 | Authentication credentials for HTTP authentication. Each line has | |
145 | the following format:: |
|
148 | the following format:: | |
146 |
|
149 | |||
147 | <name>.<argument> = <value> |
|
150 | <name>.<argument> = <value> | |
148 |
|
151 | |||
149 | where ``<name>`` is used to group arguments into authentication |
|
152 | where ``<name>`` is used to group arguments into authentication | |
150 | entries. Example:: |
|
153 | entries. Example:: | |
151 |
|
154 | |||
152 | foo.prefix = hg.intevation.org/mercurial |
|
155 | foo.prefix = hg.intevation.org/mercurial | |
153 | foo.username = foo |
|
156 | foo.username = foo | |
154 | foo.password = bar |
|
157 | foo.password = bar | |
155 | foo.schemes = http https |
|
158 | foo.schemes = http https | |
156 |
|
159 | |||
157 | bar.prefix = secure.example.org |
|
160 | bar.prefix = secure.example.org | |
158 | bar.key = path/to/file.key |
|
161 | bar.key = path/to/file.key | |
159 | bar.cert = path/to/file.cert |
|
162 | bar.cert = path/to/file.cert | |
160 | bar.schemes = https |
|
163 | bar.schemes = https | |
161 |
|
164 | |||
162 | Supported arguments: |
|
165 | Supported arguments: | |
163 |
|
166 | |||
164 | ``prefix`` |
|
167 | ``prefix`` | |
165 | Either ``*`` or a URI prefix with or without the scheme part. |
|
168 | Either ``*`` or a URI prefix with or without the scheme part. | |
166 | The authentication entry with the longest matching prefix is used |
|
169 | The authentication entry with the longest matching prefix is used | |
167 | (where ``*`` matches everything and counts as a match of length |
|
170 | (where ``*`` matches everything and counts as a match of length | |
168 | 1). If the prefix doesn't include a scheme, the match is performed |
|
171 | 1). If the prefix doesn't include a scheme, the match is performed | |
169 | against the URI with its scheme stripped as well, and the schemes |
|
172 | against the URI with its scheme stripped as well, and the schemes | |
170 | argument, q.v., is then subsequently consulted. |
|
173 | argument, q.v., is then subsequently consulted. | |
171 | ``username`` |
|
174 | ``username`` | |
172 | Optional. Username to authenticate with. If not given, and the |
|
175 | Optional. Username to authenticate with. If not given, and the | |
173 | remote site requires basic or digest authentication, the user |
|
176 | remote site requires basic or digest authentication, the user | |
174 | will be prompted for it. |
|
177 | will be prompted for it. | |
175 | ``password`` |
|
178 | ``password`` | |
176 | Optional. Password to authenticate with. If not given, and the |
|
179 | Optional. Password to authenticate with. If not given, and the | |
177 | remote site requires basic or digest authentication, the user |
|
180 | remote site requires basic or digest authentication, the user | |
178 | will be prompted for it. |
|
181 | will be prompted for it. | |
179 | ``key`` |
|
182 | ``key`` | |
180 | Optional. PEM encoded client certificate key file. |
|
183 | Optional. PEM encoded client certificate key file. | |
181 | ``cert`` |
|
184 | ``cert`` | |
182 | Optional. PEM encoded client certificate chain file. |
|
185 | Optional. PEM encoded client certificate chain file. | |
183 | ``schemes`` |
|
186 | ``schemes`` | |
184 | Optional. Space separated list of URI schemes to use this |
|
187 | Optional. Space separated list of URI schemes to use this | |
185 | authentication entry with. Only used if the prefix doesn't include |
|
188 | authentication entry with. Only used if the prefix doesn't include | |
186 | a scheme. Supported schemes are http and https. They will match |
|
189 | a scheme. Supported schemes are http and https. They will match | |
187 | static-http and static-https respectively, as well. |
|
190 | static-http and static-https respectively, as well. | |
188 | Default: https. |
|
191 | Default: https. | |
189 |
|
192 | |||
190 | If no suitable authentication entry is found, the user is prompted |
|
193 | If no suitable authentication entry is found, the user is prompted | |
191 | for credentials as usual if required by the remote. |
|
194 | for credentials as usual if required by the remote. | |
192 |
|
195 | |||
193 |
|
196 | |||
194 | ``decode/encode`` |
|
197 | ``decode/encode`` | |
195 | """"""""""""""""" |
|
198 | """"""""""""""""" | |
196 | Filters for transforming files on checkout/checkin. This would |
|
199 | Filters for transforming files on checkout/checkin. This would | |
197 | typically be used for newline processing or other |
|
200 | typically be used for newline processing or other | |
198 | localization/canonicalization of files. |
|
201 | localization/canonicalization of files. | |
199 |
|
202 | |||
200 | Filters consist of a filter pattern followed by a filter command. |
|
203 | Filters consist of a filter pattern followed by a filter command. | |
201 | Filter patterns are globs by default, rooted at the repository root. |
|
204 | Filter patterns are globs by default, rooted at the repository root. | |
202 | For example, to match any file ending in ``.txt`` in the root |
|
205 | For example, to match any file ending in ``.txt`` in the root | |
203 | directory only, use the pattern ``*.txt``. To match any file ending |
|
206 | directory only, use the pattern ``*.txt``. To match any file ending | |
204 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. |
|
207 | in ``.c`` anywhere in the repository, use the pattern ``**.c``. | |
205 | For each file only the first matching filter applies. |
|
208 | For each file only the first matching filter applies. | |
206 |
|
209 | |||
207 | The filter command can start with a specifier, either ``pipe:`` or |
|
210 | The filter command can start with a specifier, either ``pipe:`` or | |
208 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. |
|
211 | ``tempfile:``. If no specifier is given, ``pipe:`` is used by default. | |
209 |
|
212 | |||
210 | A ``pipe:`` command must accept data on stdin and return the transformed |
|
213 | A ``pipe:`` command must accept data on stdin and return the transformed | |
211 | data on stdout. |
|
214 | data on stdout. | |
212 |
|
215 | |||
213 | Pipe example:: |
|
216 | Pipe example:: | |
214 |
|
217 | |||
215 | [encode] |
|
218 | [encode] | |
216 | # uncompress gzip files on checkin to improve delta compression |
|
219 | # uncompress gzip files on checkin to improve delta compression | |
217 | # note: not necessarily a good idea, just an example |
|
220 | # note: not necessarily a good idea, just an example | |
218 | *.gz = pipe: gunzip |
|
221 | *.gz = pipe: gunzip | |
219 |
|
222 | |||
220 | [decode] |
|
223 | [decode] | |
221 | # recompress gzip files when writing them to the working dir (we |
|
224 | # recompress gzip files when writing them to the working dir (we | |
222 | # can safely omit "pipe:", because it's the default) |
|
225 | # can safely omit "pipe:", because it's the default) | |
223 | *.gz = gzip |
|
226 | *.gz = gzip | |
224 |
|
227 | |||
225 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced |
|
228 | A ``tempfile:`` command is a template. The string ``INFILE`` is replaced | |
226 | with the name of a temporary file that contains the data to be |
|
229 | with the name of a temporary file that contains the data to be | |
227 | filtered by the command. The string ``OUTFILE`` is replaced with the name |
|
230 | filtered by the command. The string ``OUTFILE`` is replaced with the name | |
228 | of an empty temporary file, where the filtered data must be written by |
|
231 | of an empty temporary file, where the filtered data must be written by | |
229 | the command. |
|
232 | the command. | |
230 |
|
233 | |||
231 | .. note:: The tempfile mechanism is recommended for Windows systems, |
|
234 | .. note:: The tempfile mechanism is recommended for Windows systems, | |
232 | where the standard shell I/O redirection operators often have |
|
235 | where the standard shell I/O redirection operators often have | |
233 | strange effects and may corrupt the contents of your files. |
|
236 | strange effects and may corrupt the contents of your files. | |
234 |
|
237 | |||
235 | The most common usage is for LF <-> CRLF translation on Windows. For |
|
238 | The most common usage is for LF <-> CRLF translation on Windows. For | |
236 | this, use the "smart" converters which check for binary files:: |
|
239 | this, use the "smart" converters which check for binary files:: | |
237 |
|
240 | |||
238 | [extensions] |
|
241 | [extensions] | |
239 | hgext.win32text = |
|
242 | hgext.win32text = | |
240 | [encode] |
|
243 | [encode] | |
241 | ** = cleverencode: |
|
244 | ** = cleverencode: | |
242 | [decode] |
|
245 | [decode] | |
243 | ** = cleverdecode: |
|
246 | ** = cleverdecode: | |
244 |
|
247 | |||
245 | or if you only want to translate certain files:: |
|
248 | or if you only want to translate certain files:: | |
246 |
|
249 | |||
247 | [extensions] |
|
250 | [extensions] | |
248 | hgext.win32text = |
|
251 | hgext.win32text = | |
249 | [encode] |
|
252 | [encode] | |
250 | **.txt = dumbencode: |
|
253 | **.txt = dumbencode: | |
251 | [decode] |
|
254 | [decode] | |
252 | **.txt = dumbdecode: |
|
255 | **.txt = dumbdecode: | |
253 |
|
256 | |||
254 |
|
257 | |||
255 | ``defaults`` |
|
258 | ``defaults`` | |
256 | """""""""""" |
|
259 | """""""""""" | |
257 |
|
260 | |||
258 | (defaults are deprecated. Don't use them. Use aliases instead) |
|
261 | (defaults are deprecated. Don't use them. Use aliases instead) | |
259 |
|
262 | |||
260 | Use the ``[defaults]`` section to define command defaults, i.e. the |
|
263 | Use the ``[defaults]`` section to define command defaults, i.e. the | |
261 | default options/arguments to pass to the specified commands. |
|
264 | default options/arguments to pass to the specified commands. | |
262 |
|
265 | |||
263 | The following example makes ``hg log`` run in verbose mode, and ``hg |
|
266 | The following example makes ``hg log`` run in verbose mode, and ``hg | |
264 | status`` show only the modified files, by default:: |
|
267 | status`` show only the modified files, by default:: | |
265 |
|
268 | |||
266 | [defaults] |
|
269 | [defaults] | |
267 | log = -v |
|
270 | log = -v | |
268 | status = -m |
|
271 | status = -m | |
269 |
|
272 | |||
270 | The actual commands, instead of their aliases, must be used when |
|
273 | The actual commands, instead of their aliases, must be used when | |
271 | defining command defaults. The command defaults will also be applied |
|
274 | defining command defaults. The command defaults will also be applied | |
272 | to the aliases of the commands defined. |
|
275 | to the aliases of the commands defined. | |
273 |
|
276 | |||
274 |
|
277 | |||
275 | ``diff`` |
|
278 | ``diff`` | |
276 | """""""" |
|
279 | """""""" | |
277 |
|
280 | |||
278 | Settings used when displaying diffs. They are all Boolean and |
|
281 | Settings used when displaying diffs. They are all Boolean and | |
279 | defaults to False. |
|
282 | defaults to False. | |
280 |
|
283 | |||
281 | ``git`` |
|
284 | ``git`` | |
282 | Use git extended diff format. |
|
285 | Use git extended diff format. | |
283 | ``nodates`` |
|
286 | ``nodates`` | |
284 | Don't include dates in diff headers. |
|
287 | Don't include dates in diff headers. | |
285 | ``showfunc`` |
|
288 | ``showfunc`` | |
286 | Show which function each change is in. |
|
289 | Show which function each change is in. | |
287 | ``ignorews`` |
|
290 | ``ignorews`` | |
288 | Ignore white space when comparing lines. |
|
291 | Ignore white space when comparing lines. | |
289 | ``ignorewsamount`` |
|
292 | ``ignorewsamount`` | |
290 | Ignore changes in the amount of white space. |
|
293 | Ignore changes in the amount of white space. | |
291 | ``ignoreblanklines`` |
|
294 | ``ignoreblanklines`` | |
292 | Ignore changes whose lines are all blank. |
|
295 | Ignore changes whose lines are all blank. | |
293 |
|
296 | |||
294 | ``email`` |
|
297 | ``email`` | |
295 | """"""""" |
|
298 | """"""""" | |
296 | Settings for extensions that send email messages. |
|
299 | Settings for extensions that send email messages. | |
297 |
|
300 | |||
298 | ``from`` |
|
301 | ``from`` | |
299 | Optional. Email address to use in "From" header and SMTP envelope |
|
302 | Optional. Email address to use in "From" header and SMTP envelope | |
300 | of outgoing messages. |
|
303 | of outgoing messages. | |
301 | ``to`` |
|
304 | ``to`` | |
302 | Optional. Comma-separated list of recipients' email addresses. |
|
305 | Optional. Comma-separated list of recipients' email addresses. | |
303 | ``cc`` |
|
306 | ``cc`` | |
304 | Optional. Comma-separated list of carbon copy recipients' |
|
307 | Optional. Comma-separated list of carbon copy recipients' | |
305 | email addresses. |
|
308 | email addresses. | |
306 | ``bcc`` |
|
309 | ``bcc`` | |
307 | Optional. Comma-separated list of blind carbon copy recipients' |
|
310 | Optional. Comma-separated list of blind carbon copy recipients' | |
308 | email addresses. |
|
311 | email addresses. | |
309 | ``method`` |
|
312 | ``method`` | |
310 | Optional. Method to use to send email messages. If value is ``smtp`` |
|
313 | Optional. Method to use to send email messages. If value is ``smtp`` | |
311 | (default), use SMTP (see the SMTP_ section for configuration). |
|
314 | (default), use SMTP (see the SMTP_ section for configuration). | |
312 | Otherwise, use as name of program to run that acts like sendmail |
|
315 | Otherwise, use as name of program to run that acts like sendmail | |
313 | (takes ``-f`` option for sender, list of recipients on command line, |
|
316 | (takes ``-f`` option for sender, list of recipients on command line, | |
314 | message on stdin). Normally, setting this to ``sendmail`` or |
|
317 | message on stdin). Normally, setting this to ``sendmail`` or | |
315 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. |
|
318 | ``/usr/sbin/sendmail`` is enough to use sendmail to send messages. | |
316 | ``charsets`` |
|
319 | ``charsets`` | |
317 | Optional. Comma-separated list of character sets considered |
|
320 | Optional. Comma-separated list of character sets considered | |
318 | convenient for recipients. Addresses, headers, and parts not |
|
321 | convenient for recipients. Addresses, headers, and parts not | |
319 | containing patches of outgoing messages will be encoded in the |
|
322 | containing patches of outgoing messages will be encoded in the | |
320 | first character set to which conversion from local encoding |
|
323 | first character set to which conversion from local encoding | |
321 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct |
|
324 | (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct | |
322 | conversion fails, the text in question is sent as is. Defaults to |
|
325 | conversion fails, the text in question is sent as is. Defaults to | |
323 | empty (explicit) list. |
|
326 | empty (explicit) list. | |
324 |
|
327 | |||
325 | Order of outgoing email character sets: |
|
328 | Order of outgoing email character sets: | |
326 |
|
329 | |||
327 | 1. ``us-ascii``: always first, regardless of settings |
|
330 | 1. ``us-ascii``: always first, regardless of settings | |
328 | 2. ``email.charsets``: in order given by user |
|
331 | 2. ``email.charsets``: in order given by user | |
329 | 3. ``ui.fallbackencoding``: if not in email.charsets |
|
332 | 3. ``ui.fallbackencoding``: if not in email.charsets | |
330 | 4. ``$HGENCODING``: if not in email.charsets |
|
333 | 4. ``$HGENCODING``: if not in email.charsets | |
331 | 5. ``utf-8``: always last, regardless of settings |
|
334 | 5. ``utf-8``: always last, regardless of settings | |
332 |
|
335 | |||
333 | Email example:: |
|
336 | Email example:: | |
334 |
|
337 | |||
335 | [email] |
|
338 | [email] | |
336 | from = Joseph User <joe.user@example.com> |
|
339 | from = Joseph User <joe.user@example.com> | |
337 | method = /usr/sbin/sendmail |
|
340 | method = /usr/sbin/sendmail | |
338 | # charsets for western Europeans |
|
341 | # charsets for western Europeans | |
339 | # us-ascii, utf-8 omitted, as they are tried first and last |
|
342 | # us-ascii, utf-8 omitted, as they are tried first and last | |
340 | charsets = iso-8859-1, iso-8859-15, windows-1252 |
|
343 | charsets = iso-8859-1, iso-8859-15, windows-1252 | |
341 |
|
344 | |||
342 |
|
345 | |||
343 | ``extensions`` |
|
346 | ``extensions`` | |
344 | """""""""""""" |
|
347 | """""""""""""" | |
345 |
|
348 | |||
346 | Mercurial has an extension mechanism for adding new features. To |
|
349 | Mercurial has an extension mechanism for adding new features. To | |
347 | enable an extension, create an entry for it in this section. |
|
350 | enable an extension, create an entry for it in this section. | |
348 |
|
351 | |||
349 | If you know that the extension is already in Python's search path, |
|
352 | If you know that the extension is already in Python's search path, | |
350 | you can give the name of the module, followed by ``=``, with nothing |
|
353 | you can give the name of the module, followed by ``=``, with nothing | |
351 | after the ``=``. |
|
354 | after the ``=``. | |
352 |
|
355 | |||
353 | Otherwise, give a name that you choose, followed by ``=``, followed by |
|
356 | Otherwise, give a name that you choose, followed by ``=``, followed by | |
354 | the path to the ``.py`` file (including the file name extension) that |
|
357 | the path to the ``.py`` file (including the file name extension) that | |
355 | defines the extension. |
|
358 | defines the extension. | |
356 |
|
359 | |||
357 | To explicitly disable an extension that is enabled in an hgrc of |
|
360 | To explicitly disable an extension that is enabled in an hgrc of | |
358 | broader scope, prepend its path with ``!``, as in |
|
361 | broader scope, prepend its path with ``!``, as in | |
359 | ``hgext.foo = !/ext/path`` or ``hgext.foo = !`` when path is not |
|
362 | ``hgext.foo = !/ext/path`` or ``hgext.foo = !`` when path is not | |
360 | supplied. |
|
363 | supplied. | |
361 |
|
364 | |||
362 | Example for ``~/.hgrc``:: |
|
365 | Example for ``~/.hgrc``:: | |
363 |
|
366 | |||
364 | [extensions] |
|
367 | [extensions] | |
365 | # (the mq extension will get loaded from Mercurial's path) |
|
368 | # (the mq extension will get loaded from Mercurial's path) | |
366 | hgext.mq = |
|
369 | hgext.mq = | |
367 | # (this extension will get loaded from the file specified) |
|
370 | # (this extension will get loaded from the file specified) | |
368 | myfeature = ~/.hgext/myfeature.py |
|
371 | myfeature = ~/.hgext/myfeature.py | |
369 |
|
372 | |||
370 |
|
373 | |||
371 | ``format`` |
|
374 | ``format`` | |
372 | """""""""" |
|
375 | """""""""" | |
373 |
|
376 | |||
374 | ``usestore`` |
|
377 | ``usestore`` | |
375 | Enable or disable the "store" repository format which improves |
|
378 | Enable or disable the "store" repository format which improves | |
376 | compatibility with systems that fold case or otherwise mangle |
|
379 | compatibility with systems that fold case or otherwise mangle | |
377 | filenames. Enabled by default. Disabling this option will allow |
|
380 | filenames. Enabled by default. Disabling this option will allow | |
378 | you to store longer filenames in some situations at the expense of |
|
381 | you to store longer filenames in some situations at the expense of | |
379 | compatibility and ensures that the on-disk format of newly created |
|
382 | compatibility and ensures that the on-disk format of newly created | |
380 | repositories will be compatible with Mercurial before version 0.9.4. |
|
383 | repositories will be compatible with Mercurial before version 0.9.4. | |
381 |
|
384 | |||
382 | ``usefncache`` |
|
385 | ``usefncache`` | |
383 | Enable or disable the "fncache" repository format which enhances |
|
386 | Enable or disable the "fncache" repository format which enhances | |
384 | the "store" repository format (which has to be enabled to use |
|
387 | the "store" repository format (which has to be enabled to use | |
385 | fncache) to allow longer filenames and avoids using Windows |
|
388 | fncache) to allow longer filenames and avoids using Windows | |
386 | reserved names, e.g. "nul". Enabled by default. Disabling this |
|
389 | reserved names, e.g. "nul". Enabled by default. Disabling this | |
387 | option ensures that the on-disk format of newly created |
|
390 | option ensures that the on-disk format of newly created | |
388 | repositories will be compatible with Mercurial before version 1.1. |
|
391 | repositories will be compatible with Mercurial before version 1.1. | |
389 |
|
392 | |||
390 | ``merge-patterns`` |
|
393 | ``merge-patterns`` | |
391 | """""""""""""""""" |
|
394 | """""""""""""""""" | |
392 |
|
395 | |||
393 | This section specifies merge tools to associate with particular file |
|
396 | This section specifies merge tools to associate with particular file | |
394 | patterns. Tools matched here will take precedence over the default |
|
397 | patterns. Tools matched here will take precedence over the default | |
395 | merge tool. Patterns are globs by default, rooted at the repository |
|
398 | merge tool. Patterns are globs by default, rooted at the repository | |
396 | root. |
|
399 | root. | |
397 |
|
400 | |||
398 | Example:: |
|
401 | Example:: | |
399 |
|
402 | |||
400 | [merge-patterns] |
|
403 | [merge-patterns] | |
401 | **.c = kdiff3 |
|
404 | **.c = kdiff3 | |
402 | **.jpg = myimgmerge |
|
405 | **.jpg = myimgmerge | |
403 |
|
406 | |||
404 | ``merge-tools`` |
|
407 | ``merge-tools`` | |
405 | """"""""""""""" |
|
408 | """"""""""""""" | |
406 |
|
409 | |||
407 | This section configures external merge tools to use for file-level |
|
410 | This section configures external merge tools to use for file-level | |
408 | merges. |
|
411 | merges. | |
409 |
|
412 | |||
410 | Example ``~/.hgrc``:: |
|
413 | Example ``~/.hgrc``:: | |
411 |
|
414 | |||
412 | [merge-tools] |
|
415 | [merge-tools] | |
413 | # Override stock tool location |
|
416 | # Override stock tool location | |
414 | kdiff3.executable = ~/bin/kdiff3 |
|
417 | kdiff3.executable = ~/bin/kdiff3 | |
415 | # Specify command line |
|
418 | # Specify command line | |
416 | kdiff3.args = $base $local $other -o $output |
|
419 | kdiff3.args = $base $local $other -o $output | |
417 | # Give higher priority |
|
420 | # Give higher priority | |
418 | kdiff3.priority = 1 |
|
421 | kdiff3.priority = 1 | |
419 |
|
422 | |||
420 | # Define new tool |
|
423 | # Define new tool | |
421 | myHtmlTool.args = -m $local $other $base $output |
|
424 | myHtmlTool.args = -m $local $other $base $output | |
422 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge |
|
425 | myHtmlTool.regkey = Software\FooSoftware\HtmlMerge | |
423 | myHtmlTool.priority = 1 |
|
426 | myHtmlTool.priority = 1 | |
424 |
|
427 | |||
425 | Supported arguments: |
|
428 | Supported arguments: | |
426 |
|
429 | |||
427 | ``priority`` |
|
430 | ``priority`` | |
428 | The priority in which to evaluate this tool. |
|
431 | The priority in which to evaluate this tool. | |
429 | Default: 0. |
|
432 | Default: 0. | |
430 | ``executable`` |
|
433 | ``executable`` | |
431 | Either just the name of the executable or its pathname. |
|
434 | Either just the name of the executable or its pathname. | |
432 | Default: the tool name. |
|
435 | Default: the tool name. | |
433 | ``args`` |
|
436 | ``args`` | |
434 | The arguments to pass to the tool executable. You can refer to the |
|
437 | The arguments to pass to the tool executable. You can refer to the | |
435 | files being merged as well as the output file through these |
|
438 | files being merged as well as the output file through these | |
436 | variables: ``$base``, ``$local``, ``$other``, ``$output``. |
|
439 | variables: ``$base``, ``$local``, ``$other``, ``$output``. | |
437 | Default: ``$local $base $other`` |
|
440 | Default: ``$local $base $other`` | |
438 | ``premerge`` |
|
441 | ``premerge`` | |
439 | Attempt to run internal non-interactive 3-way merge tool before |
|
442 | Attempt to run internal non-interactive 3-way merge tool before | |
440 | launching external tool. |
|
443 | launching external tool. | |
441 | Default: True |
|
444 | Default: True | |
442 | ``binary`` |
|
445 | ``binary`` | |
443 | This tool can merge binary files. Defaults to False, unless tool |
|
446 | This tool can merge binary files. Defaults to False, unless tool | |
444 | was selected by file pattern match. |
|
447 | was selected by file pattern match. | |
445 | ``symlink`` |
|
448 | ``symlink`` | |
446 | This tool can merge symlinks. Defaults to False, even if tool was |
|
449 | This tool can merge symlinks. Defaults to False, even if tool was | |
447 | selected by file pattern match. |
|
450 | selected by file pattern match. | |
448 | ``checkconflicts`` |
|
451 | ``checkconflicts`` | |
449 | Check whether there are conflicts even though the tool reported |
|
452 | Check whether there are conflicts even though the tool reported | |
450 | success. |
|
453 | success. | |
451 | Default: False |
|
454 | Default: False | |
452 | ``checkchanged`` |
|
455 | ``checkchanged`` | |
453 | Check whether outputs were written even though the tool reported |
|
456 | Check whether outputs were written even though the tool reported | |
454 | success. |
|
457 | success. | |
455 | Default: False |
|
458 | Default: False | |
456 | ``fixeol`` |
|
459 | ``fixeol`` | |
457 | Attempt to fix up EOL changes caused by the merge tool. |
|
460 | Attempt to fix up EOL changes caused by the merge tool. | |
458 | Default: False |
|
461 | Default: False | |
459 | ``gui`` |
|
462 | ``gui`` | |
460 | This tool requires a graphical interface to run. Default: False |
|
463 | This tool requires a graphical interface to run. Default: False | |
461 | ``regkey`` |
|
464 | ``regkey`` | |
462 | Windows registry key which describes install location of this |
|
465 | Windows registry key which describes install location of this | |
463 | tool. Mercurial will search for this key first under |
|
466 | tool. Mercurial will search for this key first under | |
464 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. |
|
467 | ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. | |
465 | Default: None |
|
468 | Default: None | |
466 | ``regname`` |
|
469 | ``regname`` | |
467 | Name of value to read from specified registry key. Defaults to the |
|
470 | Name of value to read from specified registry key. Defaults to the | |
468 | unnamed (default) value. |
|
471 | unnamed (default) value. | |
469 | ``regappend`` |
|
472 | ``regappend`` | |
470 | String to append to the value read from the registry, typically |
|
473 | String to append to the value read from the registry, typically | |
471 | the executable name of the tool. |
|
474 | the executable name of the tool. | |
472 | Default: None |
|
475 | Default: None | |
473 |
|
476 | |||
474 |
|
477 | |||
475 | ``hooks`` |
|
478 | ``hooks`` | |
476 | """"""""" |
|
479 | """"""""" | |
477 | Commands or Python functions that get automatically executed by |
|
480 | Commands or Python functions that get automatically executed by | |
478 | various actions such as starting or finishing a commit. Multiple |
|
481 | various actions such as starting or finishing a commit. Multiple | |
479 | hooks can be run for the same action by appending a suffix to the |
|
482 | hooks can be run for the same action by appending a suffix to the | |
480 | action. Overriding a site-wide hook can be done by changing its |
|
483 | action. Overriding a site-wide hook can be done by changing its | |
481 | value or setting it to an empty string. |
|
484 | value or setting it to an empty string. | |
482 |
|
485 | |||
483 | Example ``.hg/hgrc``:: |
|
486 | Example ``.hg/hgrc``:: | |
484 |
|
487 | |||
485 | [hooks] |
|
488 | [hooks] | |
486 | # update working directory after adding changesets |
|
489 | # update working directory after adding changesets | |
487 | changegroup.update = hg update |
|
490 | changegroup.update = hg update | |
488 | # do not use the site-wide hook |
|
491 | # do not use the site-wide hook | |
489 | incoming = |
|
492 | incoming = | |
490 | incoming.email = /my/email/hook |
|
493 | incoming.email = /my/email/hook | |
491 | incoming.autobuild = /my/build/hook |
|
494 | incoming.autobuild = /my/build/hook | |
492 |
|
495 | |||
493 | Most hooks are run with environment variables set that give useful |
|
496 | Most hooks are run with environment variables set that give useful | |
494 | additional information. For each hook below, the environment |
|
497 | additional information. For each hook below, the environment | |
495 | variables it is passed are listed with names of the form ``$HG_foo``. |
|
498 | variables it is passed are listed with names of the form ``$HG_foo``. | |
496 |
|
499 | |||
497 | ``changegroup`` |
|
500 | ``changegroup`` | |
498 | Run after a changegroup has been added via push, pull or unbundle. |
|
501 | Run after a changegroup has been added via push, pull or unbundle. | |
499 | ID of the first new changeset is in ``$HG_NODE``. URL from which |
|
502 | ID of the first new changeset is in ``$HG_NODE``. URL from which | |
500 | changes came is in ``$HG_URL``. |
|
503 | changes came is in ``$HG_URL``. | |
501 | ``commit`` |
|
504 | ``commit`` | |
502 | Run after a changeset has been created in the local repository. ID |
|
505 | Run after a changeset has been created in the local repository. ID | |
503 | of the newly created changeset is in ``$HG_NODE``. Parent changeset |
|
506 | of the newly created changeset is in ``$HG_NODE``. Parent changeset | |
504 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
507 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
505 | ``incoming`` |
|
508 | ``incoming`` | |
506 | Run after a changeset has been pulled, pushed, or unbundled into |
|
509 | Run after a changeset has been pulled, pushed, or unbundled into | |
507 | the local repository. The ID of the newly arrived changeset is in |
|
510 | the local repository. The ID of the newly arrived changeset is in | |
508 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. |
|
511 | ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. | |
509 | ``outgoing`` |
|
512 | ``outgoing`` | |
510 | Run after sending changes from local repository to another. ID of |
|
513 | Run after sending changes from local repository to another. ID of | |
511 | first changeset sent is in ``$HG_NODE``. Source of operation is in |
|
514 | first changeset sent is in ``$HG_NODE``. Source of operation is in | |
512 | ``$HG_SOURCE``; see "preoutgoing" hook for description. |
|
515 | ``$HG_SOURCE``; see "preoutgoing" hook for description. | |
513 | ``post-<command>`` |
|
516 | ``post-<command>`` | |
514 | Run after successful invocations of the associated command. The |
|
517 | Run after successful invocations of the associated command. The | |
515 | contents of the command line are passed as ``$HG_ARGS`` and the result |
|
518 | contents of the command line are passed as ``$HG_ARGS`` and the result | |
516 | code in ``$HG_RESULT``. Hook failure is ignored. |
|
519 | code in ``$HG_RESULT``. Hook failure is ignored. | |
517 | ``pre-<command>`` |
|
520 | ``pre-<command>`` | |
518 | Run before executing the associated command. The contents of the |
|
521 | Run before executing the associated command. The contents of the | |
519 | command line are passed as ``$HG_ARGS``. If the hook returns failure, |
|
522 | command line are passed as ``$HG_ARGS``. If the hook returns failure, | |
520 | the command doesn't execute and Mercurial returns the failure |
|
523 | the command doesn't execute and Mercurial returns the failure | |
521 | code. |
|
524 | code. | |
522 | ``prechangegroup`` |
|
525 | ``prechangegroup`` | |
523 | Run before a changegroup is added via push, pull or unbundle. Exit |
|
526 | Run before a changegroup is added via push, pull or unbundle. Exit | |
524 | status 0 allows the changegroup to proceed. Non-zero status will |
|
527 | status 0 allows the changegroup to proceed. Non-zero status will | |
525 | cause the push, pull or unbundle to fail. URL from which changes |
|
528 | cause the push, pull or unbundle to fail. URL from which changes | |
526 | will come is in ``$HG_URL``. |
|
529 | will come is in ``$HG_URL``. | |
527 | ``precommit`` |
|
530 | ``precommit`` | |
528 | Run before starting a local commit. Exit status 0 allows the |
|
531 | Run before starting a local commit. Exit status 0 allows the | |
529 | commit to proceed. Non-zero status will cause the commit to fail. |
|
532 | commit to proceed. Non-zero status will cause the commit to fail. | |
530 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
533 | Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
531 | ``preoutgoing`` |
|
534 | ``preoutgoing`` | |
532 | Run before collecting changes to send from the local repository to |
|
535 | Run before collecting changes to send from the local repository to | |
533 | another. Non-zero status will cause failure. This lets you prevent |
|
536 | another. Non-zero status will cause failure. This lets you prevent | |
534 | pull over HTTP or SSH. Also prevents against local pull, push |
|
537 | pull over HTTP or SSH. Also prevents against local pull, push | |
535 | (outbound) or bundle commands, but not effective, since you can |
|
538 | (outbound) or bundle commands, but not effective, since you can | |
536 | just copy files instead then. Source of operation is in |
|
539 | just copy files instead then. Source of operation is in | |
537 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote |
|
540 | ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote | |
538 | SSH or HTTP repository. If "push", "pull" or "bundle", operation |
|
541 | SSH or HTTP repository. If "push", "pull" or "bundle", operation | |
539 | is happening on behalf of repository on same system. |
|
542 | is happening on behalf of repository on same system. | |
540 | ``pretag`` |
|
543 | ``pretag`` | |
541 | Run before creating a tag. Exit status 0 allows the tag to be |
|
544 | Run before creating a tag. Exit status 0 allows the tag to be | |
542 | created. Non-zero status will cause the tag to fail. ID of |
|
545 | created. Non-zero status will cause the tag to fail. ID of | |
543 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is |
|
546 | changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is | |
544 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. |
|
547 | local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. | |
545 | ``pretxnchangegroup`` |
|
548 | ``pretxnchangegroup`` | |
546 | Run after a changegroup has been added via push, pull or unbundle, |
|
549 | Run after a changegroup has been added via push, pull or unbundle, | |
547 | but before the transaction has been committed. Changegroup is |
|
550 | but before the transaction has been committed. Changegroup is | |
548 | visible to hook program. This lets you validate incoming changes |
|
551 | visible to hook program. This lets you validate incoming changes | |
549 | before accepting them. Passed the ID of the first new changeset in |
|
552 | before accepting them. Passed the ID of the first new changeset in | |
550 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero |
|
553 | ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero | |
551 | status will cause the transaction to be rolled back and the push, |
|
554 | status will cause the transaction to be rolled back and the push, | |
552 | pull or unbundle will fail. URL that was source of changes is in |
|
555 | pull or unbundle will fail. URL that was source of changes is in | |
553 | ``$HG_URL``. |
|
556 | ``$HG_URL``. | |
554 | ``pretxncommit`` |
|
557 | ``pretxncommit`` | |
555 | Run after a changeset has been created but the transaction not yet |
|
558 | Run after a changeset has been created but the transaction not yet | |
556 | committed. Changeset is visible to hook program. This lets you |
|
559 | committed. Changeset is visible to hook program. This lets you | |
557 | validate commit message and changes. Exit status 0 allows the |
|
560 | validate commit message and changes. Exit status 0 allows the | |
558 | commit to proceed. Non-zero status will cause the transaction to |
|
561 | commit to proceed. Non-zero status will cause the transaction to | |
559 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset |
|
562 | be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset | |
560 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. |
|
563 | IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. | |
561 | ``preupdate`` |
|
564 | ``preupdate`` | |
562 | Run before updating the working directory. Exit status 0 allows |
|
565 | Run before updating the working directory. Exit status 0 allows | |
563 | the update to proceed. Non-zero status will prevent the update. |
|
566 | the update to proceed. Non-zero status will prevent the update. | |
564 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID |
|
567 | Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID | |
565 | of second new parent is in ``$HG_PARENT2``. |
|
568 | of second new parent is in ``$HG_PARENT2``. | |
566 | ``tag`` |
|
569 | ``tag`` | |
567 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. |
|
570 | Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. | |
568 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in |
|
571 | Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in | |
569 | repository if ``$HG_LOCAL=0``. |
|
572 | repository if ``$HG_LOCAL=0``. | |
570 | ``update`` |
|
573 | ``update`` | |
571 | Run after updating the working directory. Changeset ID of first |
|
574 | Run after updating the working directory. Changeset ID of first | |
572 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is |
|
575 | new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is | |
573 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the |
|
576 | in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the | |
574 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. |
|
577 | update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. | |
575 |
|
578 | |||
576 | .. note:: It is generally better to use standard hooks rather than the |
|
579 | .. note:: It is generally better to use standard hooks rather than the | |
577 | generic pre- and post- command hooks as they are guaranteed to be |
|
580 | generic pre- and post- command hooks as they are guaranteed to be | |
578 | called in the appropriate contexts for influencing transactions. |
|
581 | called in the appropriate contexts for influencing transactions. | |
579 | Also, hooks like "commit" will be called in all contexts that |
|
582 | Also, hooks like "commit" will be called in all contexts that | |
580 | generate a commit (e.g. tag) and not just the commit command. |
|
583 | generate a commit (e.g. tag) and not just the commit command. | |
581 |
|
584 | |||
582 | .. note:: Environment variables with empty values may not be passed to |
|
585 | .. note:: Environment variables with empty values may not be passed to | |
583 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` |
|
586 | hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` | |
584 | will have an empty value under Unix-like platforms for non-merge |
|
587 | will have an empty value under Unix-like platforms for non-merge | |
585 | changesets, while it will not be available at all under Windows. |
|
588 | changesets, while it will not be available at all under Windows. | |
586 |
|
589 | |||
587 | The syntax for Python hooks is as follows:: |
|
590 | The syntax for Python hooks is as follows:: | |
588 |
|
591 | |||
589 | hookname = python:modulename.submodule.callable |
|
592 | hookname = python:modulename.submodule.callable | |
590 | hookname = python:/path/to/python/module.py:callable |
|
593 | hookname = python:/path/to/python/module.py:callable | |
591 |
|
594 | |||
592 | Python hooks are run within the Mercurial process. Each hook is |
|
595 | Python hooks are run within the Mercurial process. Each hook is | |
593 | called with at least three keyword arguments: a ui object (keyword |
|
596 | called with at least three keyword arguments: a ui object (keyword | |
594 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` |
|
597 | ``ui``), a repository object (keyword ``repo``), and a ``hooktype`` | |
595 | keyword that tells what kind of hook is used. Arguments listed as |
|
598 | keyword that tells what kind of hook is used. Arguments listed as | |
596 | environment variables above are passed as keyword arguments, with no |
|
599 | environment variables above are passed as keyword arguments, with no | |
597 | ``HG_`` prefix, and names in lower case. |
|
600 | ``HG_`` prefix, and names in lower case. | |
598 |
|
601 | |||
599 | If a Python hook returns a "true" value or raises an exception, this |
|
602 | If a Python hook returns a "true" value or raises an exception, this | |
600 | is treated as a failure. |
|
603 | is treated as a failure. | |
601 |
|
604 | |||
602 |
|
605 | |||
603 | ``http_proxy`` |
|
606 | ``http_proxy`` | |
604 | """""""""""""" |
|
607 | """""""""""""" | |
605 | Used to access web-based Mercurial repositories through a HTTP |
|
608 | Used to access web-based Mercurial repositories through a HTTP | |
606 | proxy. |
|
609 | proxy. | |
607 |
|
610 | |||
608 | ``host`` |
|
611 | ``host`` | |
609 | Host name and (optional) port of the proxy server, for example |
|
612 | Host name and (optional) port of the proxy server, for example | |
610 | "myproxy:8000". |
|
613 | "myproxy:8000". | |
611 | ``no`` |
|
614 | ``no`` | |
612 | Optional. Comma-separated list of host names that should bypass |
|
615 | Optional. Comma-separated list of host names that should bypass | |
613 | the proxy. |
|
616 | the proxy. | |
614 | ``passwd`` |
|
617 | ``passwd`` | |
615 | Optional. Password to authenticate with at the proxy server. |
|
618 | Optional. Password to authenticate with at the proxy server. | |
616 | ``user`` |
|
619 | ``user`` | |
617 | Optional. User name to authenticate with at the proxy server. |
|
620 | Optional. User name to authenticate with at the proxy server. | |
618 |
|
621 | |||
619 | ``smtp`` |
|
622 | ``smtp`` | |
620 | """""""" |
|
623 | """""""" | |
621 | Configuration for extensions that need to send email messages. |
|
624 | Configuration for extensions that need to send email messages. | |
622 |
|
625 | |||
623 | ``host`` |
|
626 | ``host`` | |
624 | Host name of mail server, e.g. "mail.example.com". |
|
627 | Host name of mail server, e.g. "mail.example.com". | |
625 | ``port`` |
|
628 | ``port`` | |
626 | Optional. Port to connect to on mail server. Default: 25. |
|
629 | Optional. Port to connect to on mail server. Default: 25. | |
627 | ``tls`` |
|
630 | ``tls`` | |
628 | Optional. Whether to connect to mail server using TLS. True or |
|
631 | Optional. Whether to connect to mail server using TLS. True or | |
629 | False. Default: False. |
|
632 | False. Default: False. | |
630 | ``username`` |
|
633 | ``username`` | |
631 | Optional. User name to authenticate to SMTP server with. If |
|
634 | Optional. User name to authenticate to SMTP server with. If | |
632 | username is specified, password must also be specified. |
|
635 | username is specified, password must also be specified. | |
633 | Default: none. |
|
636 | Default: none. | |
634 | ``password`` |
|
637 | ``password`` | |
635 | Optional. Password to authenticate to SMTP server with. If |
|
638 | Optional. Password to authenticate to SMTP server with. If | |
636 | username is specified, password must also be specified. |
|
639 | username is specified, password must also be specified. | |
637 | Default: none. |
|
640 | Default: none. | |
638 | ``local_hostname`` |
|
641 | ``local_hostname`` | |
639 | Optional. It's the hostname that the sender can use to identify |
|
642 | Optional. It's the hostname that the sender can use to identify | |
640 | itself to the MTA. |
|
643 | itself to the MTA. | |
641 |
|
644 | |||
642 |
|
645 | |||
643 | ``patch`` |
|
646 | ``patch`` | |
644 | """"""""" |
|
647 | """"""""" | |
645 | Settings used when applying patches, for instance through the 'import' |
|
648 | Settings used when applying patches, for instance through the 'import' | |
646 | command or with Mercurial Queues extension. |
|
649 | command or with Mercurial Queues extension. | |
647 |
|
650 | |||
648 | ``eol`` |
|
651 | ``eol`` | |
649 | When set to 'strict' patch content and patched files end of lines |
|
652 | When set to 'strict' patch content and patched files end of lines | |
650 | are preserved. When set to ``lf`` or ``crlf``, both files end of |
|
653 | are preserved. When set to ``lf`` or ``crlf``, both files end of | |
651 | lines are ignored when patching and the result line endings are |
|
654 | lines are ignored when patching and the result line endings are | |
652 | normalized to either LF (Unix) or CRLF (Windows). When set to |
|
655 | normalized to either LF (Unix) or CRLF (Windows). When set to | |
653 | ``auto``, end of lines are again ignored while patching but line |
|
656 | ``auto``, end of lines are again ignored while patching but line | |
654 | endings in patched files are normalized to their original setting |
|
657 | endings in patched files are normalized to their original setting | |
655 | on a per-file basis. If target file does not exist or has no end |
|
658 | on a per-file basis. If target file does not exist or has no end | |
656 | of line, patch line endings are preserved. |
|
659 | of line, patch line endings are preserved. | |
657 | Default: strict. |
|
660 | Default: strict. | |
658 |
|
661 | |||
659 |
|
662 | |||
660 | ``paths`` |
|
663 | ``paths`` | |
661 | """"""""" |
|
664 | """"""""" | |
662 | Assigns symbolic names to repositories. The left side is the |
|
665 | Assigns symbolic names to repositories. The left side is the | |
663 | symbolic name, and the right gives the directory or URL that is the |
|
666 | symbolic name, and the right gives the directory or URL that is the | |
664 | location of the repository. Default paths can be declared by setting |
|
667 | location of the repository. Default paths can be declared by setting | |
665 | the following entries. |
|
668 | the following entries. | |
666 |
|
669 | |||
667 | ``default`` |
|
670 | ``default`` | |
668 | Directory or URL to use when pulling if no source is specified. |
|
671 | Directory or URL to use when pulling if no source is specified. | |
669 | Default is set to repository from which the current repository was |
|
672 | Default is set to repository from which the current repository was | |
670 | cloned. |
|
673 | cloned. | |
671 | ``default-push`` |
|
674 | ``default-push`` | |
672 | Optional. Directory or URL to use when pushing if no destination |
|
675 | Optional. Directory or URL to use when pushing if no destination | |
673 | is specified. |
|
676 | is specified. | |
674 |
|
677 | |||
675 |
|
678 | |||
676 | ``profiling`` |
|
679 | ``profiling`` | |
677 | """"""""""""" |
|
680 | """"""""""""" | |
678 | Specifies profiling format and file output. In this section |
|
681 | Specifies profiling format and file output. In this section | |
679 | description, 'profiling data' stands for the raw data collected |
|
682 | description, 'profiling data' stands for the raw data collected | |
680 | during profiling, while 'profiling report' stands for a statistical |
|
683 | during profiling, while 'profiling report' stands for a statistical | |
681 | text report generated from the profiling data. The profiling is done |
|
684 | text report generated from the profiling data. The profiling is done | |
682 | using lsprof. |
|
685 | using lsprof. | |
683 |
|
686 | |||
684 | ``format`` |
|
687 | ``format`` | |
685 | Profiling format. |
|
688 | Profiling format. | |
686 | Default: text. |
|
689 | Default: text. | |
687 |
|
690 | |||
688 | ``text`` |
|
691 | ``text`` | |
689 | Generate a profiling report. When saving to a file, it should be |
|
692 | Generate a profiling report. When saving to a file, it should be | |
690 | noted that only the report is saved, and the profiling data is |
|
693 | noted that only the report is saved, and the profiling data is | |
691 | not kept. |
|
694 | not kept. | |
692 | ``kcachegrind`` |
|
695 | ``kcachegrind`` | |
693 | Format profiling data for kcachegrind use: when saving to a |
|
696 | Format profiling data for kcachegrind use: when saving to a | |
694 | file, the generated file can directly be loaded into |
|
697 | file, the generated file can directly be loaded into | |
695 | kcachegrind. |
|
698 | kcachegrind. | |
696 | ``output`` |
|
699 | ``output`` | |
697 | File path where profiling data or report should be saved. If the |
|
700 | File path where profiling data or report should be saved. If the | |
698 | file exists, it is replaced. Default: None, data is printed on |
|
701 | file exists, it is replaced. Default: None, data is printed on | |
699 | stderr |
|
702 | stderr | |
700 |
|
703 | |||
701 | ``server`` |
|
704 | ``server`` | |
702 | """""""""" |
|
705 | """""""""" | |
703 | Controls generic server settings. |
|
706 | Controls generic server settings. | |
704 |
|
707 | |||
705 | ``uncompressed`` |
|
708 | ``uncompressed`` | |
706 | Whether to allow clients to clone a repository using the |
|
709 | Whether to allow clients to clone a repository using the | |
707 | uncompressed streaming protocol. This transfers about 40% more |
|
710 | uncompressed streaming protocol. This transfers about 40% more | |
708 | data than a regular clone, but uses less memory and CPU on both |
|
711 | data than a regular clone, but uses less memory and CPU on both | |
709 | server and client. Over a LAN (100 Mbps or better) or a very fast |
|
712 | server and client. Over a LAN (100 Mbps or better) or a very fast | |
710 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a |
|
713 | WAN, an uncompressed streaming clone is a lot faster (~10x) than a | |
711 | regular clone. Over most WAN connections (anything slower than |
|
714 | regular clone. Over most WAN connections (anything slower than | |
712 | about 6 Mbps), uncompressed streaming is slower, because of the |
|
715 | about 6 Mbps), uncompressed streaming is slower, because of the | |
713 | extra data transfer overhead. Default is False. |
|
716 | extra data transfer overhead. Default is False. | |
714 |
|
717 | |||
715 |
|
718 | |||
716 | ``trusted`` |
|
719 | ``trusted`` | |
717 | """"""""""" |
|
720 | """"""""""" | |
718 | For security reasons, Mercurial will not use the settings in the |
|
721 | For security reasons, Mercurial will not use the settings in the | |
719 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted |
|
722 | ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted | |
720 | user or to a trusted group. The main exception is the web interface, |
|
723 | user or to a trusted group. The main exception is the web interface, | |
721 | which automatically uses some safe settings, since it's common to |
|
724 | which automatically uses some safe settings, since it's common to | |
722 | serve repositories from different users. |
|
725 | serve repositories from different users. | |
723 |
|
726 | |||
724 | This section specifies what users and groups are trusted. The |
|
727 | This section specifies what users and groups are trusted. The | |
725 | current user is always trusted. To trust everybody, list a user or a |
|
728 | current user is always trusted. To trust everybody, list a user or a | |
726 | group with name ``*``. |
|
729 | group with name ``*``. | |
727 |
|
730 | |||
728 | ``users`` |
|
731 | ``users`` | |
729 | Comma-separated list of trusted users. |
|
732 | Comma-separated list of trusted users. | |
730 | ``groups`` |
|
733 | ``groups`` | |
731 | Comma-separated list of trusted groups. |
|
734 | Comma-separated list of trusted groups. | |
732 |
|
735 | |||
733 |
|
736 | |||
734 | ``ui`` |
|
737 | ``ui`` | |
735 | """""" |
|
738 | """""" | |
736 |
|
739 | |||
737 | User interface controls. |
|
740 | User interface controls. | |
738 |
|
741 | |||
739 | ``archivemeta`` |
|
742 | ``archivemeta`` | |
740 | Whether to include the .hg_archival.txt file containing meta data |
|
743 | Whether to include the .hg_archival.txt file containing meta data | |
741 | (hashes for the repository base and for tip) in archives created |
|
744 | (hashes for the repository base and for tip) in archives created | |
742 | by the hg archive command or downloaded via hgweb. |
|
745 | by the hg archive command or downloaded via hgweb. | |
743 | Default is True. |
|
746 | Default is True. | |
744 | ``askusername`` |
|
747 | ``askusername`` | |
745 | Whether to prompt for a username when committing. If True, and |
|
748 | Whether to prompt for a username when committing. If True, and | |
746 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will |
|
749 | neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will | |
747 | be prompted to enter a username. If no username is entered, the |
|
750 | be prompted to enter a username. If no username is entered, the | |
748 | default ``USER@HOST`` is used instead. |
|
751 | default ``USER@HOST`` is used instead. | |
749 | Default is False. |
|
752 | Default is False. | |
750 | ``debug`` |
|
753 | ``debug`` | |
751 | Print debugging information. True or False. Default is False. |
|
754 | Print debugging information. True or False. Default is False. | |
752 | ``editor`` |
|
755 | ``editor`` | |
753 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. |
|
756 | The editor to use during a commit. Default is ``$EDITOR`` or ``vi``. | |
754 | ``fallbackencoding`` |
|
757 | ``fallbackencoding`` | |
755 | Encoding to try if it's not possible to decode the changelog using |
|
758 | Encoding to try if it's not possible to decode the changelog using | |
756 | UTF-8. Default is ISO-8859-1. |
|
759 | UTF-8. Default is ISO-8859-1. | |
757 | ``ignore`` |
|
760 | ``ignore`` | |
758 | A file to read per-user ignore patterns from. This file should be |
|
761 | A file to read per-user ignore patterns from. This file should be | |
759 | in the same format as a repository-wide .hgignore file. This |
|
762 | in the same format as a repository-wide .hgignore file. This | |
760 | option supports hook syntax, so if you want to specify multiple |
|
763 | option supports hook syntax, so if you want to specify multiple | |
761 | ignore files, you can do so by setting something like |
|
764 | ignore files, you can do so by setting something like | |
762 | ``ignore.other = ~/.hgignore2``. For details of the ignore file |
|
765 | ``ignore.other = ~/.hgignore2``. For details of the ignore file | |
763 | format, see the |hgignore(5)|_ man page. |
|
766 | format, see the |hgignore(5)|_ man page. | |
764 | ``interactive`` |
|
767 | ``interactive`` | |
765 | Allow to prompt the user. True or False. Default is True. |
|
768 | Allow to prompt the user. True or False. Default is True. | |
766 | ``logtemplate`` |
|
769 | ``logtemplate`` | |
767 | Template string for commands that print changesets. |
|
770 | Template string for commands that print changesets. | |
768 | ``merge`` |
|
771 | ``merge`` | |
769 | The conflict resolution program to use during a manual merge. |
|
772 | The conflict resolution program to use during a manual merge. | |
770 | There are some internal tools available: |
|
773 | There are some internal tools available: | |
771 |
|
774 | |||
772 | ``internal:local`` |
|
775 | ``internal:local`` | |
773 | keep the local version |
|
776 | keep the local version | |
774 | ``internal:other`` |
|
777 | ``internal:other`` | |
775 | use the other version |
|
778 | use the other version | |
776 | ``internal:merge`` |
|
779 | ``internal:merge`` | |
777 | use the internal non-interactive merge tool |
|
780 | use the internal non-interactive merge tool | |
778 | ``internal:fail`` |
|
781 | ``internal:fail`` | |
779 | fail to merge |
|
782 | fail to merge | |
780 |
|
783 | |||
781 | For more information on configuring merge tools see the |
|
784 | For more information on configuring merge tools see the | |
782 | merge-tools_ section. |
|
785 | merge-tools_ section. | |
783 |
|
786 | |||
784 | ``patch`` |
|
787 | ``patch`` | |
785 | command to use to apply patches. Look for ``gpatch`` or ``patch`` in |
|
788 | command to use to apply patches. Look for ``gpatch`` or ``patch`` in | |
786 | PATH if unset. |
|
789 | PATH if unset. | |
787 | ``quiet`` |
|
790 | ``quiet`` | |
788 | Reduce the amount of output printed. True or False. Default is False. |
|
791 | Reduce the amount of output printed. True or False. Default is False. | |
789 | ``remotecmd`` |
|
792 | ``remotecmd`` | |
790 | remote command to use for clone/push/pull operations. Default is ``hg``. |
|
793 | remote command to use for clone/push/pull operations. Default is ``hg``. | |
791 | ``report_untrusted`` |
|
794 | ``report_untrusted`` | |
792 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a |
|
795 | Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a | |
793 | trusted user or group. True or False. Default is True. |
|
796 | trusted user or group. True or False. Default is True. | |
794 | ``slash`` |
|
797 | ``slash`` | |
795 | Display paths using a slash (``/``) as the path separator. This |
|
798 | Display paths using a slash (``/``) as the path separator. This | |
796 | only makes a difference on systems where the default path |
|
799 | only makes a difference on systems where the default path | |
797 | separator is not the slash character (e.g. Windows uses the |
|
800 | separator is not the slash character (e.g. Windows uses the | |
798 | backslash character (``\``)). |
|
801 | backslash character (``\``)). | |
799 | Default is False. |
|
802 | Default is False. | |
800 | ``ssh`` |
|
803 | ``ssh`` | |
801 | command to use for SSH connections. Default is ``ssh``. |
|
804 | command to use for SSH connections. Default is ``ssh``. | |
802 | ``strict`` |
|
805 | ``strict`` | |
803 | Require exact command names, instead of allowing unambiguous |
|
806 | Require exact command names, instead of allowing unambiguous | |
804 | abbreviations. True or False. Default is False. |
|
807 | abbreviations. True or False. Default is False. | |
805 | ``style`` |
|
808 | ``style`` | |
806 | Name of style to use for command output. |
|
809 | Name of style to use for command output. | |
807 | ``timeout`` |
|
810 | ``timeout`` | |
808 | The timeout used when a lock is held (in seconds), a negative value |
|
811 | The timeout used when a lock is held (in seconds), a negative value | |
809 | means no timeout. Default is 600. |
|
812 | means no timeout. Default is 600. | |
810 | ``traceback`` |
|
813 | ``traceback`` | |
811 | Mercurial always prints a traceback when an unknown exception |
|
814 | Mercurial always prints a traceback when an unknown exception | |
812 | occurs. Setting this to True will make Mercurial print a traceback |
|
815 | occurs. Setting this to True will make Mercurial print a traceback | |
813 | on all exceptions, even those recognized by Mercurial (such as |
|
816 | on all exceptions, even those recognized by Mercurial (such as | |
814 | IOError or MemoryError). Default is False. |
|
817 | IOError or MemoryError). Default is False. | |
815 | ``username`` |
|
818 | ``username`` | |
816 | The committer of a changeset created when running "commit". |
|
819 | The committer of a changeset created when running "commit". | |
817 | Typically a person's name and email address, e.g. ``Fred Widget |
|
820 | Typically a person's name and email address, e.g. ``Fred Widget | |
818 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If |
|
821 | <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If | |
819 | the username in hgrc is empty, it has to be specified manually or |
|
822 | the username in hgrc is empty, it has to be specified manually or | |
820 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set |
|
823 | in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set | |
821 | ``username =`` in the system hgrc). |
|
824 | ``username =`` in the system hgrc). | |
822 | ``verbose`` |
|
825 | ``verbose`` | |
823 | Increase the amount of output printed. True or False. Default is False. |
|
826 | Increase the amount of output printed. True or False. Default is False. | |
824 |
|
827 | |||
825 |
|
828 | |||
826 | ``web`` |
|
829 | ``web`` | |
827 | """"""" |
|
830 | """"""" | |
828 | Web interface configuration. |
|
831 | Web interface configuration. | |
829 |
|
832 | |||
830 | ``accesslog`` |
|
833 | ``accesslog`` | |
831 | Where to output the access log. Default is stdout. |
|
834 | Where to output the access log. Default is stdout. | |
832 | ``address`` |
|
835 | ``address`` | |
833 | Interface address to bind to. Default is all. |
|
836 | Interface address to bind to. Default is all. | |
834 | ``allow_archive`` |
|
837 | ``allow_archive`` | |
835 | List of archive format (bz2, gz, zip) allowed for downloading. |
|
838 | List of archive format (bz2, gz, zip) allowed for downloading. | |
836 | Default is empty. |
|
839 | Default is empty. | |
837 | ``allowbz2`` |
|
840 | ``allowbz2`` | |
838 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository |
|
841 | (DEPRECATED) Whether to allow .tar.bz2 downloading of repository | |
839 | revisions. |
|
842 | revisions. | |
840 | Default is False. |
|
843 | Default is False. | |
841 | ``allowgz`` |
|
844 | ``allowgz`` | |
842 | (DEPRECATED) Whether to allow .tar.gz downloading of repository |
|
845 | (DEPRECATED) Whether to allow .tar.gz downloading of repository | |
843 | revisions. |
|
846 | revisions. | |
844 | Default is False. |
|
847 | Default is False. | |
845 | ``allowpull`` |
|
848 | ``allowpull`` | |
846 | Whether to allow pulling from the repository. Default is True. |
|
849 | Whether to allow pulling from the repository. Default is True. | |
847 | ``allow_push`` |
|
850 | ``allow_push`` | |
848 | Whether to allow pushing to the repository. If empty or not set, |
|
851 | Whether to allow pushing to the repository. If empty or not set, | |
849 | push is not allowed. If the special value ``*``, any remote user can |
|
852 | push is not allowed. If the special value ``*``, any remote user can | |
850 | push, including unauthenticated users. Otherwise, the remote user |
|
853 | push, including unauthenticated users. Otherwise, the remote user | |
851 | must have been authenticated, and the authenticated user name must |
|
854 | must have been authenticated, and the authenticated user name must | |
852 | be present in this list (separated by whitespace or ``,``). The |
|
855 | be present in this list (separated by whitespace or ``,``). The | |
853 | contents of the allow_push list are examined after the deny_push |
|
856 | contents of the allow_push list are examined after the deny_push | |
854 | list. |
|
857 | list. | |
855 | ``allow_read`` |
|
858 | ``allow_read`` | |
856 | If the user has not already been denied repository access due to |
|
859 | If the user has not already been denied repository access due to | |
857 | the contents of deny_read, this list determines whether to grant |
|
860 | the contents of deny_read, this list determines whether to grant | |
858 | repository access to the user. If this list is not empty, and the |
|
861 | repository access to the user. If this list is not empty, and the | |
859 | user is unauthenticated or not present in the list (separated by |
|
862 | user is unauthenticated or not present in the list (separated by | |
860 | whitespace or ``,``), then access is denied for the user. If the |
|
863 | whitespace or ``,``), then access is denied for the user. If the | |
861 | list is empty or not set, then access is permitted to all users by |
|
864 | list is empty or not set, then access is permitted to all users by | |
862 | default. Setting allow_read to the special value ``*`` is equivalent |
|
865 | default. Setting allow_read to the special value ``*`` is equivalent | |
863 | to it not being set (i.e. access is permitted to all users). The |
|
866 | to it not being set (i.e. access is permitted to all users). The | |
864 | contents of the allow_read list are examined after the deny_read |
|
867 | contents of the allow_read list are examined after the deny_read | |
865 | list. |
|
868 | list. | |
866 | ``allowzip`` |
|
869 | ``allowzip`` | |
867 | (DEPRECATED) Whether to allow .zip downloading of repository |
|
870 | (DEPRECATED) Whether to allow .zip downloading of repository | |
868 | revisions. Default is False. This feature creates temporary files. |
|
871 | revisions. Default is False. This feature creates temporary files. | |
869 | ``baseurl`` |
|
872 | ``baseurl`` | |
870 | Base URL to use when publishing URLs in other locations, so |
|
873 | Base URL to use when publishing URLs in other locations, so | |
871 | third-party tools like email notification hooks can construct |
|
874 | third-party tools like email notification hooks can construct | |
872 | URLs. Example: ``http://hgserver/repos/``. |
|
875 | URLs. Example: ``http://hgserver/repos/``. | |
873 | ``contact`` |
|
876 | ``contact`` | |
874 | Name or email address of the person in charge of the repository. |
|
877 | Name or email address of the person in charge of the repository. | |
875 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. |
|
878 | Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. | |
876 | ``deny_push`` |
|
879 | ``deny_push`` | |
877 | Whether to deny pushing to the repository. If empty or not set, |
|
880 | Whether to deny pushing to the repository. If empty or not set, | |
878 | push is not denied. If the special value ``*``, all remote users are |
|
881 | push is not denied. If the special value ``*``, all remote users are | |
879 | denied push. Otherwise, unauthenticated users are all denied, and |
|
882 | denied push. Otherwise, unauthenticated users are all denied, and | |
880 | any authenticated user name present in this list (separated by |
|
883 | any authenticated user name present in this list (separated by | |
881 | whitespace or ``,``) is also denied. The contents of the deny_push |
|
884 | whitespace or ``,``) is also denied. The contents of the deny_push | |
882 | list are examined before the allow_push list. |
|
885 | list are examined before the allow_push list. | |
883 | ``deny_read`` |
|
886 | ``deny_read`` | |
884 | Whether to deny reading/viewing of the repository. If this list is |
|
887 | Whether to deny reading/viewing of the repository. If this list is | |
885 | not empty, unauthenticated users are all denied, and any |
|
888 | not empty, unauthenticated users are all denied, and any | |
886 | authenticated user name present in this list (separated by |
|
889 | authenticated user name present in this list (separated by | |
887 | whitespace or ``,``) is also denied access to the repository. If set |
|
890 | whitespace or ``,``) is also denied access to the repository. If set | |
888 | to the special value ``*``, all remote users are denied access |
|
891 | to the special value ``*``, all remote users are denied access | |
889 | (rarely needed ;). If deny_read is empty or not set, the |
|
892 | (rarely needed ;). If deny_read is empty or not set, the | |
890 | determination of repository access depends on the presence and |
|
893 | determination of repository access depends on the presence and | |
891 | content of the allow_read list (see description). If both |
|
894 | content of the allow_read list (see description). If both | |
892 | deny_read and allow_read are empty or not set, then access is |
|
895 | deny_read and allow_read are empty or not set, then access is | |
893 | permitted to all users by default. If the repository is being |
|
896 | permitted to all users by default. If the repository is being | |
894 | served via hgwebdir, denied users will not be able to see it in |
|
897 | served via hgwebdir, denied users will not be able to see it in | |
895 | the list of repositories. The contents of the deny_read list have |
|
898 | the list of repositories. The contents of the deny_read list have | |
896 | priority over (are examined before) the contents of the allow_read |
|
899 | priority over (are examined before) the contents of the allow_read | |
897 | list. |
|
900 | list. | |
898 | ``descend`` |
|
901 | ``descend`` | |
899 | hgwebdir indexes will not descend into subdirectories. Only repositories |
|
902 | hgwebdir indexes will not descend into subdirectories. Only repositories | |
900 | directly in the current path will be shown (other repositories are still |
|
903 | directly in the current path will be shown (other repositories are still | |
901 | available from the index corresponding to their containing path). |
|
904 | available from the index corresponding to their containing path). | |
902 | ``description`` |
|
905 | ``description`` | |
903 | Textual description of the repository's purpose or contents. |
|
906 | Textual description of the repository's purpose or contents. | |
904 | Default is "unknown". |
|
907 | Default is "unknown". | |
905 | ``encoding`` |
|
908 | ``encoding`` | |
906 | Character encoding name. |
|
909 | Character encoding name. | |
907 | Example: "UTF-8" |
|
910 | Example: "UTF-8" | |
908 | ``errorlog`` |
|
911 | ``errorlog`` | |
909 | Where to output the error log. Default is stderr. |
|
912 | Where to output the error log. Default is stderr. | |
910 | ``hidden`` |
|
913 | ``hidden`` | |
911 | Whether to hide the repository in the hgwebdir index. |
|
914 | Whether to hide the repository in the hgwebdir index. | |
912 | Default is False. |
|
915 | Default is False. | |
913 | ``ipv6`` |
|
916 | ``ipv6`` | |
914 | Whether to use IPv6. Default is False. |
|
917 | Whether to use IPv6. Default is False. | |
915 | ``name`` |
|
918 | ``name`` | |
916 | Repository name to use in the web interface. Default is current |
|
919 | Repository name to use in the web interface. Default is current | |
917 | working directory. |
|
920 | working directory. | |
918 | ``maxchanges`` |
|
921 | ``maxchanges`` | |
919 | Maximum number of changes to list on the changelog. Default is 10. |
|
922 | Maximum number of changes to list on the changelog. Default is 10. | |
920 | ``maxfiles`` |
|
923 | ``maxfiles`` | |
921 | Maximum number of files to list per changeset. Default is 10. |
|
924 | Maximum number of files to list per changeset. Default is 10. | |
922 | ``port`` |
|
925 | ``port`` | |
923 | Port to listen on. Default is 8000. |
|
926 | Port to listen on. Default is 8000. | |
924 | ``prefix`` |
|
927 | ``prefix`` | |
925 | Prefix path to serve from. Default is '' (server root). |
|
928 | Prefix path to serve from. Default is '' (server root). | |
926 | ``push_ssl`` |
|
929 | ``push_ssl`` | |
927 | Whether to require that inbound pushes be transported over SSL to |
|
930 | Whether to require that inbound pushes be transported over SSL to | |
928 | prevent password sniffing. Default is True. |
|
931 | prevent password sniffing. Default is True. | |
929 | ``staticurl`` |
|
932 | ``staticurl`` | |
930 | Base URL to use for static files. If unset, static files (e.g. the |
|
933 | Base URL to use for static files. If unset, static files (e.g. the | |
931 | hgicon.png favicon) will be served by the CGI script itself. Use |
|
934 | hgicon.png favicon) will be served by the CGI script itself. Use | |
932 | this setting to serve them directly with the HTTP server. |
|
935 | this setting to serve them directly with the HTTP server. | |
933 | Example: ``http://hgserver/static/``. |
|
936 | Example: ``http://hgserver/static/``. | |
934 | ``stripes`` |
|
937 | ``stripes`` | |
935 | How many lines a "zebra stripe" should span in multiline output. |
|
938 | How many lines a "zebra stripe" should span in multiline output. | |
936 | Default is 1; set to 0 to disable. |
|
939 | Default is 1; set to 0 to disable. | |
937 | ``style`` |
|
940 | ``style`` | |
938 | Which template map style to use. |
|
941 | Which template map style to use. | |
939 | ``templates`` |
|
942 | ``templates`` | |
940 | Where to find the HTML templates. Default is install path. |
|
943 | Where to find the HTML templates. Default is install path. | |
941 |
|
944 | |||
942 |
|
945 | |||
943 | Author |
|
946 | Author | |
944 | ------ |
|
947 | ------ | |
945 | Bryan O'Sullivan <bos@serpentine.com>. |
|
948 | Bryan O'Sullivan <bos@serpentine.com>. | |
946 |
|
949 | |||
947 | Mercurial was written by Matt Mackall <mpm@selenic.com>. |
|
950 | Mercurial was written by Matt Mackall <mpm@selenic.com>. | |
948 |
|
951 | |||
949 | See Also |
|
952 | See Also | |
950 | -------- |
|
953 | -------- | |
951 | |hg(1)|_, |hgignore(5)|_ |
|
954 | |hg(1)|_, |hgignore(5)|_ | |
952 |
|
955 | |||
953 | Copying |
|
956 | Copying | |
954 | ------- |
|
957 | ------- | |
955 | This manual page is copyright 2005 Bryan O'Sullivan. |
|
958 | This manual page is copyright 2005 Bryan O'Sullivan. | |
956 | Mercurial is copyright 2005-2010 Matt Mackall. |
|
959 | Mercurial is copyright 2005-2010 Matt Mackall. | |
957 | Free use of this software is granted under the terms of the GNU General |
|
960 | Free use of this software is granted under the terms of the GNU General | |
958 | Public License version 2 or any later version. |
|
961 | Public License version 2 or any later version. | |
959 |
|
962 | |||
960 | .. include:: common.txt |
|
963 | .. include:: common.txt |
@@ -1,183 +1,191 b'' | |||||
1 | # win32.py - utility functions that use win32 API |
|
1 | # win32.py - utility functions that use win32 API | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others |
|
3 | # Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others | |
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 | """Utility functions that use win32 API. |
|
8 | """Utility functions that use win32 API. | |
9 |
|
9 | |||
10 | Mark Hammond's win32all package allows better functionality on |
|
10 | Mark Hammond's win32all package allows better functionality on | |
11 | Windows. This module overrides definitions in util.py. If not |
|
11 | Windows. This module overrides definitions in util.py. If not | |
12 | available, import of this module will fail, and generic code will be |
|
12 | available, import of this module will fail, and generic code will be | |
13 | used. |
|
13 | used. | |
14 | """ |
|
14 | """ | |
15 |
|
15 | |||
16 | import win32api |
|
16 | import win32api | |
17 |
|
17 | |||
18 | import errno, os, sys, pywintypes, win32con, win32file, win32process |
|
18 | import errno, os, sys, pywintypes, win32con, win32file, win32process | |
19 | import winerror, win32gui |
|
19 | import winerror, win32gui | |
20 | import osutil, encoding |
|
20 | import osutil, encoding | |
21 | from win32com.shell import shell, shellcon |
|
21 | from win32com.shell import shell, shellcon | |
22 |
|
22 | |||
23 | def os_link(src, dst): |
|
23 | def os_link(src, dst): | |
24 | try: |
|
24 | try: | |
25 | win32file.CreateHardLink(dst, src) |
|
25 | win32file.CreateHardLink(dst, src) | |
26 | # CreateHardLink sometimes succeeds on mapped drives but |
|
26 | # CreateHardLink sometimes succeeds on mapped drives but | |
27 | # following nlinks() returns 1. Check it now and bail out. |
|
27 | # following nlinks() returns 1. Check it now and bail out. | |
28 | if nlinks(src) < 2: |
|
28 | if nlinks(src) < 2: | |
29 | try: |
|
29 | try: | |
30 | win32file.DeleteFile(dst) |
|
30 | win32file.DeleteFile(dst) | |
31 | except: |
|
31 | except: | |
32 | pass |
|
32 | pass | |
33 | # Fake hardlinking error |
|
33 | # Fake hardlinking error | |
34 | raise OSError(errno.EINVAL, 'Hardlinking not supported') |
|
34 | raise OSError(errno.EINVAL, 'Hardlinking not supported') | |
35 | except pywintypes.error, details: |
|
35 | except pywintypes.error, details: | |
36 | raise OSError(errno.EINVAL, 'target implements hardlinks improperly') |
|
36 | raise OSError(errno.EINVAL, 'target implements hardlinks improperly') | |
37 | except NotImplementedError: # Another fake error win Win98 |
|
37 | except NotImplementedError: # Another fake error win Win98 | |
38 | raise OSError(errno.EINVAL, 'Hardlinking not supported') |
|
38 | raise OSError(errno.EINVAL, 'Hardlinking not supported') | |
39 |
|
39 | |||
40 | def _getfileinfo(pathname): |
|
40 | def _getfileinfo(pathname): | |
41 | """Return number of hardlinks for the given file.""" |
|
41 | """Return number of hardlinks for the given file.""" | |
42 | try: |
|
42 | try: | |
43 | fh = win32file.CreateFile(pathname, |
|
43 | fh = win32file.CreateFile(pathname, | |
44 | win32file.GENERIC_READ, win32file.FILE_SHARE_READ, |
|
44 | win32file.GENERIC_READ, win32file.FILE_SHARE_READ, | |
45 | None, win32file.OPEN_EXISTING, 0, None) |
|
45 | None, win32file.OPEN_EXISTING, 0, None) | |
46 | try: |
|
46 | try: | |
47 | return win32file.GetFileInformationByHandle(fh) |
|
47 | return win32file.GetFileInformationByHandle(fh) | |
48 | finally: |
|
48 | finally: | |
49 | fh.Close() |
|
49 | fh.Close() | |
50 | except pywintypes.error: |
|
50 | except pywintypes.error: | |
51 | return None |
|
51 | return None | |
52 |
|
52 | |||
53 | def nlinks(pathname): |
|
53 | def nlinks(pathname): | |
54 | """Return number of hardlinks for the given file.""" |
|
54 | """Return number of hardlinks for the given file.""" | |
55 | res = _getfileinfo(pathname) |
|
55 | res = _getfileinfo(pathname) | |
56 | if res is not None: |
|
56 | if res is not None: | |
57 | return res[7] |
|
57 | return res[7] | |
58 | else: |
|
58 | else: | |
59 | return os.lstat(pathname).st_nlink |
|
59 | return os.lstat(pathname).st_nlink | |
60 |
|
60 | |||
61 | def samefile(fpath1, fpath2): |
|
61 | def samefile(fpath1, fpath2): | |
62 | """Returns whether fpath1 and fpath2 refer to the same file. This is only |
|
62 | """Returns whether fpath1 and fpath2 refer to the same file. This is only | |
63 | guaranteed to work for files, not directories.""" |
|
63 | guaranteed to work for files, not directories.""" | |
64 | res1 = _getfileinfo(fpath1) |
|
64 | res1 = _getfileinfo(fpath1) | |
65 | res2 = _getfileinfo(fpath2) |
|
65 | res2 = _getfileinfo(fpath2) | |
66 | if res1 is not None and res2 is not None: |
|
66 | if res1 is not None and res2 is not None: | |
67 | # Index 4 is the volume serial number, and 8 and 9 contain the file ID |
|
67 | # Index 4 is the volume serial number, and 8 and 9 contain the file ID | |
68 | return res1[4] == res2[4] and res1[8] == res2[8] and res1[9] == res2[9] |
|
68 | return res1[4] == res2[4] and res1[8] == res2[8] and res1[9] == res2[9] | |
69 | else: |
|
69 | else: | |
70 | return False |
|
70 | return False | |
71 |
|
71 | |||
72 | def samedevice(fpath1, fpath2): |
|
72 | def samedevice(fpath1, fpath2): | |
73 | """Returns whether fpath1 and fpath2 are on the same device. This is only |
|
73 | """Returns whether fpath1 and fpath2 are on the same device. This is only | |
74 | guaranteed to work for files, not directories.""" |
|
74 | guaranteed to work for files, not directories.""" | |
75 | res1 = _getfileinfo(fpath1) |
|
75 | res1 = _getfileinfo(fpath1) | |
76 | res2 = _getfileinfo(fpath2) |
|
76 | res2 = _getfileinfo(fpath2) | |
77 | if res1 is not None and res2 is not None: |
|
77 | if res1 is not None and res2 is not None: | |
78 | return res1[4] == res2[4] |
|
78 | return res1[4] == res2[4] | |
79 | else: |
|
79 | else: | |
80 | return False |
|
80 | return False | |
81 |
|
81 | |||
82 | def testpid(pid): |
|
82 | def testpid(pid): | |
83 | '''return True if pid is still running or unable to |
|
83 | '''return True if pid is still running or unable to | |
84 | determine, False otherwise''' |
|
84 | determine, False otherwise''' | |
85 | try: |
|
85 | try: | |
86 | handle = win32api.OpenProcess( |
|
86 | handle = win32api.OpenProcess( | |
87 | win32con.PROCESS_QUERY_INFORMATION, False, pid) |
|
87 | win32con.PROCESS_QUERY_INFORMATION, False, pid) | |
88 | if handle: |
|
88 | if handle: | |
89 | status = win32process.GetExitCodeProcess(handle) |
|
89 | status = win32process.GetExitCodeProcess(handle) | |
90 | return status == win32con.STILL_ACTIVE |
|
90 | return status == win32con.STILL_ACTIVE | |
91 | except pywintypes.error, details: |
|
91 | except pywintypes.error, details: | |
92 | return details[0] != winerror.ERROR_INVALID_PARAMETER |
|
92 | return details[0] != winerror.ERROR_INVALID_PARAMETER | |
93 | return True |
|
93 | return True | |
94 |
|
94 | |||
95 | def lookup_reg(key, valname=None, scope=None): |
|
95 | def lookup_reg(key, valname=None, scope=None): | |
96 | ''' Look up a key/value name in the Windows registry. |
|
96 | ''' Look up a key/value name in the Windows registry. | |
97 |
|
97 | |||
98 | valname: value name. If unspecified, the default value for the key |
|
98 | valname: value name. If unspecified, the default value for the key | |
99 | is used. |
|
99 | is used. | |
100 | scope: optionally specify scope for registry lookup, this can be |
|
100 | scope: optionally specify scope for registry lookup, this can be | |
101 | a sequence of scopes to look up in order. Default (CURRENT_USER, |
|
101 | a sequence of scopes to look up in order. Default (CURRENT_USER, | |
102 | LOCAL_MACHINE). |
|
102 | LOCAL_MACHINE). | |
103 | ''' |
|
103 | ''' | |
104 | try: |
|
104 | try: | |
105 | from _winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, \ |
|
105 | from _winreg import HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, \ | |
106 | QueryValueEx, OpenKey |
|
106 | QueryValueEx, OpenKey | |
107 | except ImportError: |
|
107 | except ImportError: | |
108 | return None |
|
108 | return None | |
109 |
|
109 | |||
110 | if scope is None: |
|
110 | if scope is None: | |
111 | scope = (HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE) |
|
111 | scope = (HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE) | |
112 | elif not isinstance(scope, (list, tuple)): |
|
112 | elif not isinstance(scope, (list, tuple)): | |
113 | scope = (scope,) |
|
113 | scope = (scope,) | |
114 | for s in scope: |
|
114 | for s in scope: | |
115 | try: |
|
115 | try: | |
116 | val = QueryValueEx(OpenKey(s, key), valname)[0] |
|
116 | val = QueryValueEx(OpenKey(s, key), valname)[0] | |
117 | # never let a Unicode string escape into the wild |
|
117 | # never let a Unicode string escape into the wild | |
118 | return encoding.tolocal(val.encode('UTF-8')) |
|
118 | return encoding.tolocal(val.encode('UTF-8')) | |
119 | except EnvironmentError: |
|
119 | except EnvironmentError: | |
120 | pass |
|
120 | pass | |
121 |
|
121 | |||
122 | def system_rcpath_win32(): |
|
122 | def system_rcpath_win32(): | |
123 | '''return default os-specific hgrc search path''' |
|
123 | '''return default os-specific hgrc search path''' | |
124 | proc = win32api.GetCurrentProcess() |
|
124 | proc = win32api.GetCurrentProcess() | |
125 | try: |
|
125 | try: | |
126 | # This will fail on windows < NT |
|
126 | # This will fail on windows < NT | |
127 | filename = win32process.GetModuleFileNameEx(proc, 0) |
|
127 | filename = win32process.GetModuleFileNameEx(proc, 0) | |
128 | except: |
|
128 | except: | |
129 | filename = win32api.GetModuleFileName(0) |
|
129 | filename = win32api.GetModuleFileName(0) | |
130 | # Use mercurial.ini found in directory with hg.exe |
|
130 | # Use mercurial.ini found in directory with hg.exe | |
131 | progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini') |
|
131 | progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini') | |
132 | if os.path.isfile(progrc): |
|
132 | if os.path.isfile(progrc): | |
133 | return [progrc] |
|
133 | return [progrc] | |
|
134 | # Use hgrc.d found in directory with hg.exe | |||
|
135 | progrcd = os.path.join(os.path.dirname(filename), 'hgrc.d') | |||
|
136 | if os.path.isdir(progrcd): | |||
|
137 | rcpath = [] | |||
|
138 | for f, kind in osutil.listdir(progrcd): | |||
|
139 | if f.endswith('.rc'): | |||
|
140 | rcpath.append(os.path.join(progrcd, f)) | |||
|
141 | return rcpath | |||
134 | # else look for a system rcpath in the registry |
|
142 | # else look for a system rcpath in the registry | |
135 | try: |
|
143 | try: | |
136 | value = win32api.RegQueryValue( |
|
144 | value = win32api.RegQueryValue( | |
137 | win32con.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Mercurial') |
|
145 | win32con.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Mercurial') | |
138 | rcpath = [] |
|
146 | rcpath = [] | |
139 | for p in value.split(os.pathsep): |
|
147 | for p in value.split(os.pathsep): | |
140 | if p.lower().endswith('mercurial.ini'): |
|
148 | if p.lower().endswith('mercurial.ini'): | |
141 | rcpath.append(p) |
|
149 | rcpath.append(p) | |
142 | elif os.path.isdir(p): |
|
150 | elif os.path.isdir(p): | |
143 | for f, kind in osutil.listdir(p): |
|
151 | for f, kind in osutil.listdir(p): | |
144 | if f.endswith('.rc'): |
|
152 | if f.endswith('.rc'): | |
145 | rcpath.append(os.path.join(p, f)) |
|
153 | rcpath.append(os.path.join(p, f)) | |
146 | return rcpath |
|
154 | return rcpath | |
147 | except pywintypes.error: |
|
155 | except pywintypes.error: | |
148 | return [] |
|
156 | return [] | |
149 |
|
157 | |||
150 | def user_rcpath_win32(): |
|
158 | def user_rcpath_win32(): | |
151 | '''return os-specific hgrc search path to the user dir''' |
|
159 | '''return os-specific hgrc search path to the user dir''' | |
152 | userdir = os.path.expanduser('~') |
|
160 | userdir = os.path.expanduser('~') | |
153 | if sys.getwindowsversion()[3] != 2 and userdir == '~': |
|
161 | if sys.getwindowsversion()[3] != 2 and userdir == '~': | |
154 | # We are on win < nt: fetch the APPDATA directory location and use |
|
162 | # We are on win < nt: fetch the APPDATA directory location and use | |
155 | # the parent directory as the user home dir. |
|
163 | # the parent directory as the user home dir. | |
156 | appdir = shell.SHGetPathFromIDList( |
|
164 | appdir = shell.SHGetPathFromIDList( | |
157 | shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_APPDATA)) |
|
165 | shell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_APPDATA)) | |
158 | userdir = os.path.dirname(appdir) |
|
166 | userdir = os.path.dirname(appdir) | |
159 | return [os.path.join(userdir, 'mercurial.ini'), |
|
167 | return [os.path.join(userdir, 'mercurial.ini'), | |
160 | os.path.join(userdir, '.hgrc')] |
|
168 | os.path.join(userdir, '.hgrc')] | |
161 |
|
169 | |||
162 | def getuser(): |
|
170 | def getuser(): | |
163 | '''return name of current user''' |
|
171 | '''return name of current user''' | |
164 | return win32api.GetUserName() |
|
172 | return win32api.GetUserName() | |
165 |
|
173 | |||
166 | def set_signal_handler_win32(): |
|
174 | def set_signal_handler_win32(): | |
167 | """Register a termination handler for console events including |
|
175 | """Register a termination handler for console events including | |
168 | CTRL+C. python signal handlers do not work well with socket |
|
176 | CTRL+C. python signal handlers do not work well with socket | |
169 | operations. |
|
177 | operations. | |
170 | """ |
|
178 | """ | |
171 | def handler(event): |
|
179 | def handler(event): | |
172 | win32process.ExitProcess(1) |
|
180 | win32process.ExitProcess(1) | |
173 | win32api.SetConsoleCtrlHandler(handler) |
|
181 | win32api.SetConsoleCtrlHandler(handler) | |
174 |
|
182 | |||
175 | def hidewindow(): |
|
183 | def hidewindow(): | |
176 | def callback(*args, **kwargs): |
|
184 | def callback(*args, **kwargs): | |
177 | hwnd, pid = args |
|
185 | hwnd, pid = args | |
178 | wpid = win32process.GetWindowThreadProcessId(hwnd)[1] |
|
186 | wpid = win32process.GetWindowThreadProcessId(hwnd)[1] | |
179 | if pid == wpid: |
|
187 | if pid == wpid: | |
180 | win32gui.ShowWindow(hwnd, win32con.SW_HIDE) |
|
188 | win32gui.ShowWindow(hwnd, win32con.SW_HIDE) | |
181 |
|
189 | |||
182 | pid = win32process.GetCurrentProcessId() |
|
190 | pid = win32process.GetCurrentProcessId() | |
183 | win32gui.EnumWindows(callback, pid) |
|
191 | win32gui.EnumWindows(callback, pid) |
General Comments 0
You need to be logged in to leave comments.
Login now