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