##// END OF EJS Templates
help: help topic for merge tools...
Erik Zielke -
r12771:c77f6276 default
parent child Browse files
Show More
@@ -0,0 +1,85 b''
1 To merge files Mercurial uses merge tools.
2
3 A merge tool combines two different versions of a file into a merged
4 file. Merge tools are given the two files and the greatest common
5 ancestor of the two file versions, so they can determine the changes
6 made on both branches.
7
8 The merge tools are used both for :hg:`resolve` and :hg:`merge`.
9
10 Usually, the merge tool tries to automatically, by combining all the
11 non-overlapping changes that occurred separately in the two different
12 evolutions of the same initial base file. Furthermore, some
13 interactive merge programs make it easier to manually resolve
14 conflicting merges, either in a graphical way, or by inserting some
15 conflict markers. Mercurial does not include any interactive merge
16 programs but relies on external tools for that. External merge tools
17 and their properties and usage is configured in merge-tools section -
18 see hgrc(5).
19
20 There are a some internal merge tools which can be used. The internal
21 merge tools are:
22
23 ``internal:merge``
24 Uses the internal non-interactive merge tool for merging files.
25
26 ``internal:fail``
27 Rather than attempting to merge files that were modified on both
28 branches, it marks these files as unresolved. Then the resolve
29 command must be used to mark files resolved.
30
31 ``internal:local``
32 Uses the local version of files as the merged version.
33
34 ``internal:other``
35 Uses the remote version of files as the merged version.
36
37 ``internal:prompt``
38 Asks the user which of the local or the other version to keep as
39 the merged version.
40
41 ``internal:dump``
42 Creates three versions of the files to merge, containing the
43 contents of local, other and base. These files can then be used to
44 perform a merge manually. If the file merged is name ``a.txt``,
45 these files will accordingly be named ``a.txt.local``,
46 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
47 same directory as the file to merge.
48
49 How Mercurial decides which merge program to use
50
51 1. If the ``HGMERGE`` environment variable is present, it is used. If
52 specified it must be either an executable path or the name of an
53 application in your executable search path.
54
55 2. If the filename of the file to be merged matches any of the
56 patterns in the merge-patterns configuration section, then the
57 corresponding merge tool is used, unless the file to be merged is a
58 symlink. Here binary capabilities of the merge tool are not
59 considered.
60
61 3. If ui.merge is set, it is used.
62
63 4. If any merge tools are present in the merge-tools configuration
64 section, and any of the tools can be found on the system, the
65 priority settings are used to determine which one to use. Binary,
66 symlink and GUI capabilities do also have to match.
67
68 5. If a program named ``hgmerge`` exists on the system, it is used.
69
70 6. If the file to be merged is not binary and is not a symlink, then
71 ``internal:merge`` is used.
72
73 7. The merge fails.
74
75 .. note::
76 After selecting a merge program, Mercurial will by default attempt
77 to merge the files using a simple merge algorithm first, to see if
78 they can be merged without conflicts. Only if there are conflicting
79 changes Mercurial will actually execute the merge program. Whether
80 to use the simple merge algorithm first can be controlled be the
81 premerge setting of the merge tool, which is enabled by default
82 unless the file is binary or symlink.
83
84 See the merge-tools and ui sections of hgrc(5) for details on
85 configuration of merge tools.
@@ -1,1067 +1,1055 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 Authentication credentials for HTTP authentication. Each line has
207 207 the following format::
208 208
209 209 <name>.<argument> = <value>
210 210
211 211 where ``<name>`` is used to group arguments into authentication
212 212 entries. Example::
213 213
214 214 foo.prefix = hg.intevation.org/mercurial
215 215 foo.username = foo
216 216 foo.password = bar
217 217 foo.schemes = http https
218 218
219 219 bar.prefix = secure.example.org
220 220 bar.key = path/to/file.key
221 221 bar.cert = path/to/file.cert
222 222 bar.schemes = https
223 223
224 224 Supported arguments:
225 225
226 226 ``prefix``
227 227 Either ``*`` or a URI prefix with or without the scheme part.
228 228 The authentication entry with the longest matching prefix is used
229 229 (where ``*`` matches everything and counts as a match of length
230 230 1). If the prefix doesn't include a scheme, the match is performed
231 231 against the URI with its scheme stripped as well, and the schemes
232 232 argument, q.v., is then subsequently consulted.
233 233 ``username``
234 234 Optional. Username to authenticate with. If not given, and the
235 235 remote site requires basic or digest authentication, the user will
236 236 be prompted for it. Environment variables are expanded in the
237 237 username letting you do ``foo.username = $USER``.
238 238 ``password``
239 239 Optional. Password to authenticate with. If not given, and the
240 240 remote site requires basic or digest authentication, the user
241 241 will be prompted for it.
242 242 ``key``
243 243 Optional. PEM encoded client certificate key file. Environment
244 244 variables are expanded in the filename.
245 245 ``cert``
246 246 Optional. PEM encoded client certificate chain file. Environment
247 247 variables are expanded in the filename.
248 248 ``schemes``
249 249 Optional. Space separated list of URI schemes to use this
250 250 authentication entry with. Only used if the prefix doesn't include
251 251 a scheme. Supported schemes are http and https. They will match
252 252 static-http and static-https respectively, as well.
253 253 Default: https.
254 254
255 255 If no suitable authentication entry is found, the user is prompted
256 256 for credentials as usual if required by the remote.
257 257
258 258
259 259 ``decode/encode``
260 260 """""""""""""""""
261 261 Filters for transforming files on checkout/checkin. This would
262 262 typically be used for newline processing or other
263 263 localization/canonicalization of files.
264 264
265 265 Filters consist of a filter pattern followed by a filter command.
266 266 Filter patterns are globs by default, rooted at the repository root.
267 267 For example, to match any file ending in ``.txt`` in the root
268 268 directory only, use the pattern ``*.txt``. To match any file ending
269 269 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
270 270 For each file only the first matching filter applies.
271 271
272 272 The filter command can start with a specifier, either ``pipe:`` or
273 273 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
274 274
275 275 A ``pipe:`` command must accept data on stdin and return the transformed
276 276 data on stdout.
277 277
278 278 Pipe example::
279 279
280 280 [encode]
281 281 # uncompress gzip files on checkin to improve delta compression
282 282 # note: not necessarily a good idea, just an example
283 283 *.gz = pipe: gunzip
284 284
285 285 [decode]
286 286 # recompress gzip files when writing them to the working dir (we
287 287 # can safely omit "pipe:", because it's the default)
288 288 *.gz = gzip
289 289
290 290 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
291 291 with the name of a temporary file that contains the data to be
292 292 filtered by the command. The string ``OUTFILE`` is replaced with the name
293 293 of an empty temporary file, where the filtered data must be written by
294 294 the command.
295 295
296 296 .. note:: The tempfile mechanism is recommended for Windows systems,
297 297 where the standard shell I/O redirection operators often have
298 298 strange effects and may corrupt the contents of your files.
299 299
300 300 This filter mechanism is used internally by the ``eol`` extension to
301 301 translate line ending characters between Windows (CRLF) and Unix (LF)
302 302 format. We suggest you use the ``eol`` extension for convenience.
303 303
304 304
305 305 ``defaults``
306 306 """"""""""""
307 307
308 308 (defaults are deprecated. Don't use them. Use aliases instead)
309 309
310 310 Use the ``[defaults]`` section to define command defaults, i.e. the
311 311 default options/arguments to pass to the specified commands.
312 312
313 313 The following example makes :hg:`log` run in verbose mode, and
314 314 :hg:`status` show only the modified files, by default::
315 315
316 316 [defaults]
317 317 log = -v
318 318 status = -m
319 319
320 320 The actual commands, instead of their aliases, must be used when
321 321 defining command defaults. The command defaults will also be applied
322 322 to the aliases of the commands defined.
323 323
324 324
325 325 ``diff``
326 326 """"""""
327 327
328 328 Settings used when displaying diffs. They are all Boolean and
329 329 defaults to False.
330 330
331 331 ``git``
332 332 Use git extended diff format.
333 333 ``nodates``
334 334 Don't include dates in diff headers.
335 335 ``showfunc``
336 336 Show which function each change is in.
337 337 ``ignorews``
338 338 Ignore white space when comparing lines.
339 339 ``ignorewsamount``
340 340 Ignore changes in the amount of white space.
341 341 ``ignoreblanklines``
342 342 Ignore changes whose lines are all blank.
343 343
344 344 ``email``
345 345 """""""""
346 346 Settings for extensions that send email messages.
347 347
348 348 ``from``
349 349 Optional. Email address to use in "From" header and SMTP envelope
350 350 of outgoing messages.
351 351 ``to``
352 352 Optional. Comma-separated list of recipients' email addresses.
353 353 ``cc``
354 354 Optional. Comma-separated list of carbon copy recipients'
355 355 email addresses.
356 356 ``bcc``
357 357 Optional. Comma-separated list of blind carbon copy recipients'
358 358 email addresses.
359 359 ``method``
360 360 Optional. Method to use to send email messages. If value is ``smtp``
361 361 (default), use SMTP (see the SMTP_ section for configuration).
362 362 Otherwise, use as name of program to run that acts like sendmail
363 363 (takes ``-f`` option for sender, list of recipients on command line,
364 364 message on stdin). Normally, setting this to ``sendmail`` or
365 365 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
366 366 ``charsets``
367 367 Optional. Comma-separated list of character sets considered
368 368 convenient for recipients. Addresses, headers, and parts not
369 369 containing patches of outgoing messages will be encoded in the
370 370 first character set to which conversion from local encoding
371 371 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
372 372 conversion fails, the text in question is sent as is. Defaults to
373 373 empty (explicit) list.
374 374
375 375 Order of outgoing email character sets:
376 376
377 377 1. ``us-ascii``: always first, regardless of settings
378 378 2. ``email.charsets``: in order given by user
379 379 3. ``ui.fallbackencoding``: if not in email.charsets
380 380 4. ``$HGENCODING``: if not in email.charsets
381 381 5. ``utf-8``: always last, regardless of settings
382 382
383 383 Email example::
384 384
385 385 [email]
386 386 from = Joseph User <joe.user@example.com>
387 387 method = /usr/sbin/sendmail
388 388 # charsets for western Europeans
389 389 # us-ascii, utf-8 omitted, as they are tried first and last
390 390 charsets = iso-8859-1, iso-8859-15, windows-1252
391 391
392 392
393 393 ``extensions``
394 394 """"""""""""""
395 395
396 396 Mercurial has an extension mechanism for adding new features. To
397 397 enable an extension, create an entry for it in this section.
398 398
399 399 If you know that the extension is already in Python's search path,
400 400 you can give the name of the module, followed by ``=``, with nothing
401 401 after the ``=``.
402 402
403 403 Otherwise, give a name that you choose, followed by ``=``, followed by
404 404 the path to the ``.py`` file (including the file name extension) that
405 405 defines the extension.
406 406
407 407 To explicitly disable an extension that is enabled in an hgrc of
408 408 broader scope, prepend its path with ``!``, as in
409 409 ``hgext.foo = !/ext/path`` or ``hgext.foo = !`` when path is not
410 410 supplied.
411 411
412 412 Example for ``~/.hgrc``::
413 413
414 414 [extensions]
415 415 # (the mq extension will get loaded from Mercurial's path)
416 416 hgext.mq =
417 417 # (this extension will get loaded from the file specified)
418 418 myfeature = ~/.hgext/myfeature.py
419 419
420 420
421 421 ``format``
422 422 """"""""""
423 423
424 424 ``usestore``
425 425 Enable or disable the "store" repository format which improves
426 426 compatibility with systems that fold case or otherwise mangle
427 427 filenames. Enabled by default. Disabling this option will allow
428 428 you to store longer filenames in some situations at the expense of
429 429 compatibility and ensures that the on-disk format of newly created
430 430 repositories will be compatible with Mercurial before version 0.9.4.
431 431
432 432 ``usefncache``
433 433 Enable or disable the "fncache" repository format which enhances
434 434 the "store" repository format (which has to be enabled to use
435 435 fncache) to allow longer filenames and avoids using Windows
436 436 reserved names, e.g. "nul". Enabled by default. Disabling this
437 437 option ensures that the on-disk format of newly created
438 438 repositories will be compatible with Mercurial before version 1.1.
439 439
440 440 ``dotencode``
441 441 Enable or disable the "dotencode" repository format which enhances
442 442 the "fncache" repository format (which has to be enabled to use
443 443 dotencode) to avoid issues with filenames starting with ._ on
444 444 Mac OS X and spaces on Windows. Enabled by default. Disabling this
445 445 option ensures that the on-disk format of newly created
446 446 repositories will be compatible with Mercurial before version 1.7.
447 447
448 448 ``merge-patterns``
449 449 """"""""""""""""""
450 450
451 451 This section specifies merge tools to associate with particular file
452 452 patterns. Tools matched here will take precedence over the default
453 453 merge tool. Patterns are globs by default, rooted at the repository
454 454 root.
455 455
456 456 Example::
457 457
458 458 [merge-patterns]
459 459 **.c = kdiff3
460 460 **.jpg = myimgmerge
461 461
462 462 ``merge-tools``
463 463 """""""""""""""
464 464
465 465 This section configures external merge tools to use for file-level
466 466 merges.
467 467
468 468 Example ``~/.hgrc``::
469 469
470 470 [merge-tools]
471 471 # Override stock tool location
472 472 kdiff3.executable = ~/bin/kdiff3
473 473 # Specify command line
474 474 kdiff3.args = $base $local $other -o $output
475 475 # Give higher priority
476 476 kdiff3.priority = 1
477 477
478 478 # Define new tool
479 479 myHtmlTool.args = -m $local $other $base $output
480 480 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
481 481 myHtmlTool.priority = 1
482 482
483 483 Supported arguments:
484 484
485 485 ``priority``
486 486 The priority in which to evaluate this tool.
487 487 Default: 0.
488 488 ``executable``
489 489 Either just the name of the executable or its pathname. On Windows,
490 490 the path can use environment variables with ${ProgramFiles} syntax.
491 491 Default: the tool name.
492 492 ``args``
493 493 The arguments to pass to the tool executable. You can refer to the
494 494 files being merged as well as the output file through these
495 495 variables: ``$base``, ``$local``, ``$other``, ``$output``.
496 496 Default: ``$local $base $other``
497 497 ``premerge``
498 498 Attempt to run internal non-interactive 3-way merge tool before
499 499 launching external tool. Options are ``true``, ``false``, or ``keep``
500 500 to leave markers in the file if the premerge fails.
501 501 Default: True
502 502 ``binary``
503 503 This tool can merge binary files. Defaults to False, unless tool
504 504 was selected by file pattern match.
505 505 ``symlink``
506 506 This tool can merge symlinks. Defaults to False, even if tool was
507 507 selected by file pattern match.
508 508 ``check``
509 509 A list of merge success-checking options:
510 510
511 511 ``changed``
512 512 Ask whether merge was successful when the merged file shows no changes.
513 513 ``conflicts``
514 514 Check whether there are conflicts even though the tool reported success.
515 515 ``prompt``
516 516 Always prompt for merge success, regardless of success reported by tool.
517 517
518 518 ``checkchanged``
519 519 True is equivalent to ``check = changed``.
520 520 Default: False
521 521 ``checkconflicts``
522 522 True is equivalent to ``check = conflicts``.
523 523 Default: False
524 524 ``fixeol``
525 525 Attempt to fix up EOL changes caused by the merge tool.
526 526 Default: False
527 527 ``gui``
528 528 This tool requires a graphical interface to run. Default: False
529 529 ``regkey``
530 530 Windows registry key which describes install location of this
531 531 tool. Mercurial will search for this key first under
532 532 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
533 533 Default: None
534 534 ``regname``
535 535 Name of value to read from specified registry key. Defaults to the
536 536 unnamed (default) value.
537 537 ``regappend``
538 538 String to append to the value read from the registry, typically
539 539 the executable name of the tool.
540 540 Default: None
541 541
542 542
543 543 ``hooks``
544 544 """""""""
545 545 Commands or Python functions that get automatically executed by
546 546 various actions such as starting or finishing a commit. Multiple
547 547 hooks can be run for the same action by appending a suffix to the
548 548 action. Overriding a site-wide hook can be done by changing its
549 549 value or setting it to an empty string.
550 550
551 551 Example ``.hg/hgrc``::
552 552
553 553 [hooks]
554 554 # update working directory after adding changesets
555 555 changegroup.update = hg update
556 556 # do not use the site-wide hook
557 557 incoming =
558 558 incoming.email = /my/email/hook
559 559 incoming.autobuild = /my/build/hook
560 560
561 561 Most hooks are run with environment variables set that give useful
562 562 additional information. For each hook below, the environment
563 563 variables it is passed are listed with names of the form ``$HG_foo``.
564 564
565 565 ``changegroup``
566 566 Run after a changegroup has been added via push, pull or unbundle.
567 567 ID of the first new changeset is in ``$HG_NODE``. URL from which
568 568 changes came is in ``$HG_URL``.
569 569 ``commit``
570 570 Run after a changeset has been created in the local repository. ID
571 571 of the newly created changeset is in ``$HG_NODE``. Parent changeset
572 572 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
573 573 ``incoming``
574 574 Run after a changeset has been pulled, pushed, or unbundled into
575 575 the local repository. The ID of the newly arrived changeset is in
576 576 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
577 577 ``outgoing``
578 578 Run after sending changes from local repository to another. ID of
579 579 first changeset sent is in ``$HG_NODE``. Source of operation is in
580 580 ``$HG_SOURCE``; see "preoutgoing" hook for description.
581 581 ``post-<command>``
582 582 Run after successful invocations of the associated command. The
583 583 contents of the command line are passed as ``$HG_ARGS`` and the result
584 584 code in ``$HG_RESULT``. Parsed command line arguments are passed as
585 585 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
586 586 the python data internally passed to <command>. ``$HG_OPTS`` is a
587 587 dictionary of options (with unspecified options set to their defaults).
588 588 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
589 589 ``pre-<command>``
590 590 Run before executing the associated command. The contents of the
591 591 command line are passed as ``$HG_ARGS``. Parsed command line arguments
592 592 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
593 593 representations of the data internally passed to <command>. ``$HG_OPTS``
594 594 is a dictionary of options (with unspecified options set to their
595 595 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
596 596 failure, the command doesn't execute and Mercurial returns the failure
597 597 code.
598 598 ``prechangegroup``
599 599 Run before a changegroup is added via push, pull or unbundle. Exit
600 600 status 0 allows the changegroup to proceed. Non-zero status will
601 601 cause the push, pull or unbundle to fail. URL from which changes
602 602 will come is in ``$HG_URL``.
603 603 ``precommit``
604 604 Run before starting a local commit. Exit status 0 allows the
605 605 commit to proceed. Non-zero status will cause the commit to fail.
606 606 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
607 607 ``preoutgoing``
608 608 Run before collecting changes to send from the local repository to
609 609 another. Non-zero status will cause failure. This lets you prevent
610 610 pull over HTTP or SSH. Also prevents against local pull, push
611 611 (outbound) or bundle commands, but not effective, since you can
612 612 just copy files instead then. Source of operation is in
613 613 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
614 614 SSH or HTTP repository. If "push", "pull" or "bundle", operation
615 615 is happening on behalf of repository on same system.
616 616 ``pretag``
617 617 Run before creating a tag. Exit status 0 allows the tag to be
618 618 created. Non-zero status will cause the tag to fail. ID of
619 619 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
620 620 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
621 621 ``pretxnchangegroup``
622 622 Run after a changegroup has been added via push, pull or unbundle,
623 623 but before the transaction has been committed. Changegroup is
624 624 visible to hook program. This lets you validate incoming changes
625 625 before accepting them. Passed the ID of the first new changeset in
626 626 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
627 627 status will cause the transaction to be rolled back and the push,
628 628 pull or unbundle will fail. URL that was source of changes is in
629 629 ``$HG_URL``.
630 630 ``pretxncommit``
631 631 Run after a changeset has been created but the transaction not yet
632 632 committed. Changeset is visible to hook program. This lets you
633 633 validate commit message and changes. Exit status 0 allows the
634 634 commit to proceed. Non-zero status will cause the transaction to
635 635 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
636 636 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
637 637 ``preupdate``
638 638 Run before updating the working directory. Exit status 0 allows
639 639 the update to proceed. Non-zero status will prevent the update.
640 640 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
641 641 of second new parent is in ``$HG_PARENT2``.
642 642 ``tag``
643 643 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
644 644 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
645 645 repository if ``$HG_LOCAL=0``.
646 646 ``update``
647 647 Run after updating the working directory. Changeset ID of first
648 648 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
649 649 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
650 650 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
651 651
652 652 .. note:: It is generally better to use standard hooks rather than the
653 653 generic pre- and post- command hooks as they are guaranteed to be
654 654 called in the appropriate contexts for influencing transactions.
655 655 Also, hooks like "commit" will be called in all contexts that
656 656 generate a commit (e.g. tag) and not just the commit command.
657 657
658 658 .. note:: Environment variables with empty values may not be passed to
659 659 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
660 660 will have an empty value under Unix-like platforms for non-merge
661 661 changesets, while it will not be available at all under Windows.
662 662
663 663 The syntax for Python hooks is as follows::
664 664
665 665 hookname = python:modulename.submodule.callable
666 666 hookname = python:/path/to/python/module.py:callable
667 667
668 668 Python hooks are run within the Mercurial process. Each hook is
669 669 called with at least three keyword arguments: a ui object (keyword
670 670 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
671 671 keyword that tells what kind of hook is used. Arguments listed as
672 672 environment variables above are passed as keyword arguments, with no
673 673 ``HG_`` prefix, and names in lower case.
674 674
675 675 If a Python hook returns a "true" value or raises an exception, this
676 676 is treated as a failure.
677 677
678 678
679 679 ``http_proxy``
680 680 """"""""""""""
681 681 Used to access web-based Mercurial repositories through a HTTP
682 682 proxy.
683 683
684 684 ``host``
685 685 Host name and (optional) port of the proxy server, for example
686 686 "myproxy:8000".
687 687 ``no``
688 688 Optional. Comma-separated list of host names that should bypass
689 689 the proxy.
690 690 ``passwd``
691 691 Optional. Password to authenticate with at the proxy server.
692 692 ``user``
693 693 Optional. User name to authenticate with at the proxy server.
694 694 ``always``
695 695 Optional. Always use the proxy, even for localhost and any entries
696 696 in ``http_proxy.no``. True or False. Default: False.
697 697
698 698 ``smtp``
699 699 """"""""
700 700 Configuration for extensions that need to send email messages.
701 701
702 702 ``host``
703 703 Host name of mail server, e.g. "mail.example.com".
704 704 ``port``
705 705 Optional. Port to connect to on mail server. Default: 25.
706 706 ``tls``
707 707 Optional. Whether to connect to mail server using TLS. True or
708 708 False. Default: False.
709 709 ``username``
710 710 Optional. User name for authenticating with the SMTP server.
711 711 Default: none.
712 712 ``password``
713 713 Optional. Password for authenticating with the SMTP server. If not
714 714 specified, interactive sessions will prompt the user for a
715 715 password; non-interactive sessions will fail. Default: none.
716 716 ``local_hostname``
717 717 Optional. It's the hostname that the sender can use to identify
718 718 itself to the MTA.
719 719
720 720
721 721 ``patch``
722 722 """""""""
723 723 Settings used when applying patches, for instance through the 'import'
724 724 command or with Mercurial Queues extension.
725 725
726 726 ``eol``
727 727 When set to 'strict' patch content and patched files end of lines
728 728 are preserved. When set to ``lf`` or ``crlf``, both files end of
729 729 lines are ignored when patching and the result line endings are
730 730 normalized to either LF (Unix) or CRLF (Windows). When set to
731 731 ``auto``, end of lines are again ignored while patching but line
732 732 endings in patched files are normalized to their original setting
733 733 on a per-file basis. If target file does not exist or has no end
734 734 of line, patch line endings are preserved.
735 735 Default: strict.
736 736
737 737
738 738 ``paths``
739 739 """""""""
740 740 Assigns symbolic names to repositories. The left side is the
741 741 symbolic name, and the right gives the directory or URL that is the
742 742 location of the repository. Default paths can be declared by setting
743 743 the following entries.
744 744
745 745 ``default``
746 746 Directory or URL to use when pulling if no source is specified.
747 747 Default is set to repository from which the current repository was
748 748 cloned.
749 749 ``default-push``
750 750 Optional. Directory or URL to use when pushing if no destination
751 751 is specified.
752 752
753 753
754 754 ``profiling``
755 755 """""""""""""
756 756 Specifies profiling format and file output. In this section
757 757 description, 'profiling data' stands for the raw data collected
758 758 during profiling, while 'profiling report' stands for a statistical
759 759 text report generated from the profiling data. The profiling is done
760 760 using lsprof.
761 761
762 762 ``format``
763 763 Profiling format.
764 764 Default: text.
765 765
766 766 ``text``
767 767 Generate a profiling report. When saving to a file, it should be
768 768 noted that only the report is saved, and the profiling data is
769 769 not kept.
770 770 ``kcachegrind``
771 771 Format profiling data for kcachegrind use: when saving to a
772 772 file, the generated file can directly be loaded into
773 773 kcachegrind.
774 774 ``output``
775 775 File path where profiling data or report should be saved. If the
776 776 file exists, it is replaced. Default: None, data is printed on
777 777 stderr
778 778
779 779 ``server``
780 780 """"""""""
781 781 Controls generic server settings.
782 782
783 783 ``uncompressed``
784 784 Whether to allow clients to clone a repository using the
785 785 uncompressed streaming protocol. This transfers about 40% more
786 786 data than a regular clone, but uses less memory and CPU on both
787 787 server and client. Over a LAN (100 Mbps or better) or a very fast
788 788 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
789 789 regular clone. Over most WAN connections (anything slower than
790 790 about 6 Mbps), uncompressed streaming is slower, because of the
791 791 extra data transfer overhead. This mode will also temporarily hold
792 792 the write lock while determining what data to transfer.
793 793 Default is True.
794 794
795 795 ``validate``
796 796 Whether to validate the completeness of pushed changesets by
797 797 checking that all new file revisions specified in manifests are
798 798 present. Default is False.
799 799
800 800 ``trusted``
801 801 """""""""""
802 802
803 803 Mercurial will not use the settings in the
804 804 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
805 805 user or to a trusted group, as various hgrc features allow arbitrary
806 806 commands to be run. This issue is often encountered when configuring
807 807 hooks or extensions for shared repositories or servers. However,
808 808 the web interface will use some safe settings from the ``[web]``
809 809 section.
810 810
811 811 This section specifies what users and groups are trusted. The
812 812 current user is always trusted. To trust everybody, list a user or a
813 813 group with name ``*``. These settings must be placed in an
814 814 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
815 815 user or service running Mercurial.
816 816
817 817 ``users``
818 818 Comma-separated list of trusted users.
819 819 ``groups``
820 820 Comma-separated list of trusted groups.
821 821
822 822
823 823 ``ui``
824 824 """"""
825 825
826 826 User interface controls.
827 827
828 828 ``archivemeta``
829 829 Whether to include the .hg_archival.txt file containing meta data
830 830 (hashes for the repository base and for tip) in archives created
831 831 by the :hg:`archive` command or downloaded via hgweb.
832 832 Default is True.
833 833 ``askusername``
834 834 Whether to prompt for a username when committing. If True, and
835 835 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
836 836 be prompted to enter a username. If no username is entered, the
837 837 default ``USER@HOST`` is used instead.
838 838 Default is False.
839 839 ``debug``
840 840 Print debugging information. True or False. Default is False.
841 841 ``editor``
842 842 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
843 843 ``fallbackencoding``
844 844 Encoding to try if it's not possible to decode the changelog using
845 845 UTF-8. Default is ISO-8859-1.
846 846 ``ignore``
847 847 A file to read per-user ignore patterns from. This file should be
848 848 in the same format as a repository-wide .hgignore file. This
849 849 option supports hook syntax, so if you want to specify multiple
850 850 ignore files, you can do so by setting something like
851 851 ``ignore.other = ~/.hgignore2``. For details of the ignore file
852 852 format, see the |hgignore(5)|_ man page.
853 853 ``interactive``
854 854 Allow to prompt the user. True or False. Default is True.
855 855 ``logtemplate``
856 856 Template string for commands that print changesets.
857 857 ``merge``
858 858 The conflict resolution program to use during a manual merge.
859 There are some internal tools available:
860
861 ``internal:local``
862 keep the local version
863 ``internal:other``
864 use the other version
865 ``internal:merge``
866 use the internal non-interactive merge tool
867 ``internal:fail``
868 fail to merge
869
870 For more information on configuring merge tools see the
871 merge-tools_ section.
872
859 For more information on merge tools see :hg:`help merge-tools`.
860 For configuring merge tools see the merge-tools_ section.
873 861 ``patch``
874 862 command to use to apply patches. Look for ``gpatch`` or ``patch`` in
875 863 PATH if unset.
876 864 ``quiet``
877 865 Reduce the amount of output printed. True or False. Default is False.
878 866 ``remotecmd``
879 867 remote command to use for clone/push/pull operations. Default is ``hg``.
880 868 ``report_untrusted``
881 869 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
882 870 trusted user or group. True or False. Default is True.
883 871 ``slash``
884 872 Display paths using a slash (``/``) as the path separator. This
885 873 only makes a difference on systems where the default path
886 874 separator is not the slash character (e.g. Windows uses the
887 875 backslash character (``\``)).
888 876 Default is False.
889 877 ``ssh``
890 878 command to use for SSH connections. Default is ``ssh``.
891 879 ``strict``
892 880 Require exact command names, instead of allowing unambiguous
893 881 abbreviations. True or False. Default is False.
894 882 ``style``
895 883 Name of style to use for command output.
896 884 ``timeout``
897 885 The timeout used when a lock is held (in seconds), a negative value
898 886 means no timeout. Default is 600.
899 887 ``traceback``
900 888 Mercurial always prints a traceback when an unknown exception
901 889 occurs. Setting this to True will make Mercurial print a traceback
902 890 on all exceptions, even those recognized by Mercurial (such as
903 891 IOError or MemoryError). Default is False.
904 892 ``username``
905 893 The committer of a changeset created when running "commit".
906 894 Typically a person's name and email address, e.g. ``Fred Widget
907 895 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
908 896 the username in hgrc is empty, it has to be specified manually or
909 897 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
910 898 ``username =`` in the system hgrc). Environment variables in the
911 899 username are expanded.
912 900 ``verbose``
913 901 Increase the amount of output printed. True or False. Default is False.
914 902
915 903
916 904 ``web``
917 905 """""""
918 906 Web interface configuration.
919 907
920 908 ``accesslog``
921 909 Where to output the access log. Default is stdout.
922 910 ``address``
923 911 Interface address to bind to. Default is all.
924 912 ``allow_archive``
925 913 List of archive format (bz2, gz, zip) allowed for downloading.
926 914 Default is empty.
927 915 ``allowbz2``
928 916 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
929 917 revisions.
930 918 Default is False.
931 919 ``allowgz``
932 920 (DEPRECATED) Whether to allow .tar.gz downloading of repository
933 921 revisions.
934 922 Default is False.
935 923 ``allowpull``
936 924 Whether to allow pulling from the repository. Default is True.
937 925 ``allow_push``
938 926 Whether to allow pushing to the repository. If empty or not set,
939 927 push is not allowed. If the special value ``*``, any remote user can
940 928 push, including unauthenticated users. Otherwise, the remote user
941 929 must have been authenticated, and the authenticated user name must
942 930 be present in this list. The contents of the allow_push list are
943 931 examined after the deny_push list.
944 932 ``allow_read``
945 933 If the user has not already been denied repository access due to
946 934 the contents of deny_read, this list determines whether to grant
947 935 repository access to the user. If this list is not empty, and the
948 936 user is unauthenticated or not present in the list, then access is
949 937 denied for the user. If the list is empty or not set, then access
950 938 is permitted to all users by default. Setting allow_read to the
951 939 special value ``*`` is equivalent to it not being set (i.e. access
952 940 is permitted to all users). The contents of the allow_read list are
953 941 examined after the deny_read list.
954 942 ``allowzip``
955 943 (DEPRECATED) Whether to allow .zip downloading of repository
956 944 revisions. Default is False. This feature creates temporary files.
957 945 ``baseurl``
958 946 Base URL to use when publishing URLs in other locations, so
959 947 third-party tools like email notification hooks can construct
960 948 URLs. Example: ``http://hgserver/repos/``.
961 949 ``cacerts``
962 950 Path to file containing a list of PEM encoded certificate authority
963 951 certificates. If specified on the client, then it will verify the identity
964 952 of remote HTTPS servers with these certificates. The form must be
965 953 as follows::
966 954
967 955 -----BEGIN CERTIFICATE-----
968 956 ... (certificate in base64 PEM encoding) ...
969 957 -----END CERTIFICATE-----
970 958 -----BEGIN CERTIFICATE-----
971 959 ... (certificate in base64 PEM encoding) ...
972 960 -----END CERTIFICATE-----
973 961
974 962 This feature is only supported when using Python 2.6 or later. If you wish
975 963 to use it with earlier versions of Python, install the backported
976 964 version of the ssl library that is available from
977 965 ``http://pypi.python.org``.
978 966
979 967 You can use OpenSSL's CA certificate file if your platform has one.
980 968 On most Linux systems this will be ``/etc/ssl/certs/ca-certificates.crt``.
981 969 Otherwise you will have to generate this file manually.
982 970 ``contact``
983 971 Name or email address of the person in charge of the repository.
984 972 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
985 973 ``deny_push``
986 974 Whether to deny pushing to the repository. If empty or not set,
987 975 push is not denied. If the special value ``*``, all remote users are
988 976 denied push. Otherwise, unauthenticated users are all denied, and
989 977 any authenticated user name present in this list is also denied. The
990 978 contents of the deny_push list are examined before the allow_push list.
991 979 ``deny_read``
992 980 Whether to deny reading/viewing of the repository. If this list is
993 981 not empty, unauthenticated users are all denied, and any
994 982 authenticated user name present in this list is also denied access to
995 983 the repository. If set to the special value ``*``, all remote users
996 984 are denied access (rarely needed ;). If deny_read is empty or not set,
997 985 the determination of repository access depends on the presence and
998 986 content of the allow_read list (see description). If both
999 987 deny_read and allow_read are empty or not set, then access is
1000 988 permitted to all users by default. If the repository is being
1001 989 served via hgwebdir, denied users will not be able to see it in
1002 990 the list of repositories. The contents of the deny_read list have
1003 991 priority over (are examined before) the contents of the allow_read
1004 992 list.
1005 993 ``descend``
1006 994 hgwebdir indexes will not descend into subdirectories. Only repositories
1007 995 directly in the current path will be shown (other repositories are still
1008 996 available from the index corresponding to their containing path).
1009 997 ``description``
1010 998 Textual description of the repository's purpose or contents.
1011 999 Default is "unknown".
1012 1000 ``encoding``
1013 1001 Character encoding name. Default is the current locale charset.
1014 1002 Example: "UTF-8"
1015 1003 ``errorlog``
1016 1004 Where to output the error log. Default is stderr.
1017 1005 ``hidden``
1018 1006 Whether to hide the repository in the hgwebdir index.
1019 1007 Default is False.
1020 1008 ``ipv6``
1021 1009 Whether to use IPv6. Default is False.
1022 1010 ``name``
1023 1011 Repository name to use in the web interface. Default is current
1024 1012 working directory.
1025 1013 ``maxchanges``
1026 1014 Maximum number of changes to list on the changelog. Default is 10.
1027 1015 ``maxfiles``
1028 1016 Maximum number of files to list per changeset. Default is 10.
1029 1017 ``port``
1030 1018 Port to listen on. Default is 8000.
1031 1019 ``prefix``
1032 1020 Prefix path to serve from. Default is '' (server root).
1033 1021 ``push_ssl``
1034 1022 Whether to require that inbound pushes be transported over SSL to
1035 1023 prevent password sniffing. Default is True.
1036 1024 ``staticurl``
1037 1025 Base URL to use for static files. If unset, static files (e.g. the
1038 1026 hgicon.png favicon) will be served by the CGI script itself. Use
1039 1027 this setting to serve them directly with the HTTP server.
1040 1028 Example: ``http://hgserver/static/``.
1041 1029 ``stripes``
1042 1030 How many lines a "zebra stripe" should span in multiline output.
1043 1031 Default is 1; set to 0 to disable.
1044 1032 ``style``
1045 1033 Which template map style to use.
1046 1034 ``templates``
1047 1035 Where to find the HTML templates. Default is install path.
1048 1036
1049 1037
1050 1038 Author
1051 1039 ------
1052 1040 Bryan O'Sullivan <bos@serpentine.com>.
1053 1041
1054 1042 Mercurial was written by Matt Mackall <mpm@selenic.com>.
1055 1043
1056 1044 See Also
1057 1045 --------
1058 1046 |hg(1)|_, |hgignore(5)|_
1059 1047
1060 1048 Copying
1061 1049 -------
1062 1050 This manual page is copyright 2005 Bryan O'Sullivan.
1063 1051 Mercurial is copyright 2005-2010 Matt Mackall.
1064 1052 Free use of this software is granted under the terms of the GNU General
1065 1053 Public License version 2 or any later version.
1066 1054
1067 1055 .. include:: common.txt
@@ -1,103 +1,104 b''
1 1 # help.py - help data for mercurial
2 2 #
3 3 # Copyright 2006 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 i18n import gettext, _
9 9 import sys, os
10 10 import extensions
11 11
12 12
13 13 def moduledoc(file):
14 14 '''return the top-level python documentation for the given file
15 15
16 16 Loosely inspired by pydoc.source_synopsis(), but rewritten to
17 17 handle triple quotes and to return the whole text instead of just
18 18 the synopsis'''
19 19 result = []
20 20
21 21 line = file.readline()
22 22 while line[:1] == '#' or not line.strip():
23 23 line = file.readline()
24 24 if not line:
25 25 break
26 26
27 27 start = line[:3]
28 28 if start == '"""' or start == "'''":
29 29 line = line[3:]
30 30 while line:
31 31 if line.rstrip().endswith(start):
32 32 line = line.split(start)[0]
33 33 if line:
34 34 result.append(line)
35 35 break
36 36 elif not line:
37 37 return None # unmatched delimiter
38 38 result.append(line)
39 39 line = file.readline()
40 40 else:
41 41 return None
42 42
43 43 return ''.join(result)
44 44
45 45 def listexts(header, exts, maxlength, indent=1):
46 46 '''return a text listing of the given extensions'''
47 47 if not exts:
48 48 return ''
49 49 result = '\n%s\n\n' % header
50 50 for name, desc in sorted(exts.iteritems()):
51 51 result += '%s%-*s %s\n' % (' ' * indent, maxlength + 2,
52 52 ':%s:' % name, desc)
53 53 return result
54 54
55 55 def extshelp():
56 56 doc = loaddoc('extensions')()
57 57
58 58 exts, maxlength = extensions.enabled()
59 59 doc += listexts(_('enabled extensions:'), exts, maxlength)
60 60
61 61 exts, maxlength = extensions.disabled()
62 62 doc += listexts(_('disabled extensions:'), exts, maxlength)
63 63
64 64 return doc
65 65
66 66 def loaddoc(topic):
67 67 """Return a delayed loader for help/topic.txt."""
68 68
69 69 def loader():
70 70 if hasattr(sys, 'frozen'):
71 71 module = sys.executable
72 72 else:
73 73 module = __file__
74 74 base = os.path.dirname(module)
75 75
76 76 for dir in ('.', '..'):
77 77 docdir = os.path.join(base, dir, 'help')
78 78 if os.path.isdir(docdir):
79 79 break
80 80
81 81 path = os.path.join(docdir, topic + ".txt")
82 82 return gettext(open(path).read())
83 83 return loader
84 84
85 85 helptable = [
86 86 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
87 87 (["dates"], _("Date Formats"), loaddoc('dates')),
88 88 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
89 89 (['environment', 'env'], _('Environment Variables'),
90 90 loaddoc('environment')),
91 91 (['revs', 'revisions'], _('Specifying Single Revisions'),
92 92 loaddoc('revisions')),
93 93 (['mrevs', 'multirevs'], _('Specifying Multiple Revisions'),
94 94 loaddoc('multirevs')),
95 95 (['revsets'], _("Specifying Revision Sets"), loaddoc('revsets')),
96 96 (['diffs'], _('Diff Formats'), loaddoc('diffs')),
97 (['merge-tools'], _('Merge Tools'), loaddoc('merge-tools')),
97 98 (['templating', 'templates'], _('Template Usage'),
98 99 loaddoc('templates')),
99 100 (['urls'], _('URL Paths'), loaddoc('urls')),
100 101 (["extensions"], _("Using additional features"), extshelp),
101 102 (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
102 103 (["glossary"], _("Glossary"), loaddoc('glossary')),
103 104 ]
General Comments 0
You need to be logged in to leave comments. Login now