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