comparison mercurial/helptext/merge-tools.txt @ 43632:2e017696181f

help: create packages for the help text These files need to be loaded as resources with PyOxidizer, instead of using filesystem representations. AFAICT, the resource loading mechanisms only work for the named package given to it, and can't reach into a subdirectory. While here, the `help` directory is renamed to `helptext`. Without this, trying to load external help text crashed in mercurial/help.py when importing `.i18n`, saying there's no `mercurial.help.i18n` module. Differential Revision: https://phab.mercurial-scm.org/D7376
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 13 Nov 2019 21:52:25 -0500
parents mercurial/help/merge-tools.txt@0dfcc348d383
children
comparison
equal deleted inserted replaced
43631:d3c4368099ed 43632:2e017696181f
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 Merge tools are used both for :hg:`resolve`, :hg:`merge`, :hg:`update`,
9 :hg:`backout` and in several extensions.
10
11 Usually, the merge tool tries to automatically reconcile the files by
12 combining all non-overlapping changes that occurred separately in
13 the two different evolutions of the same initial base file. Furthermore, some
14 interactive merge programs make it easier to manually resolve
15 conflicting merges, either in a graphical way, or by inserting some
16 conflict markers. Mercurial does not include any interactive merge
17 programs but relies on external tools for that.
18
19 Available merge tools
20 =====================
21
22 External merge tools and their properties are configured in the
23 merge-tools configuration section - see hgrc(5) - but they can often just
24 be named by their executable.
25
26 A merge tool is generally usable if its executable can be found on the
27 system and if it can handle the merge. The executable is found if it
28 is an absolute or relative executable path or the name of an
29 application in the executable search path. The tool is assumed to be
30 able to handle the merge if it can handle symlinks if the file is a
31 symlink, if it can handle binary files if the file is binary, and if a
32 GUI is available if the tool requires a GUI.
33
34 There are some internal merge tools which can be used. The internal
35 merge tools are:
36
37 .. internaltoolsmarker
38
39 Internal tools are always available and do not require a GUI but will
40 by default not handle symlinks or binary files. See next section for
41 detail about "actual capabilities" described above.
42
43 Choosing a merge tool
44 =====================
45
46 Mercurial uses these rules when deciding which merge tool to use:
47
48 1. If a tool has been specified with the --tool option to merge or resolve, it
49 is used. If it is the name of a tool in the merge-tools configuration, its
50 configuration is used. Otherwise the specified tool must be executable by
51 the shell.
52
53 2. If the ``HGMERGE`` environment variable is present, its value is used and
54 must be executable by the shell.
55
56 3. If the filename of the file to be merged matches any of the patterns in the
57 merge-patterns configuration section, the first usable merge tool
58 corresponding to a matching pattern is used.
59
60 4. If ui.merge is set it will be considered next. If the value is not the name
61 of a configured tool, the specified value is used and must be executable by
62 the shell. Otherwise the named tool is used if it is usable.
63
64 5. If any usable merge tools are present in the merge-tools configuration
65 section, the one with the highest priority is used.
66
67 6. If a program named ``hgmerge`` can be found on the system, it is used - but
68 it will by default not be used for symlinks and binary files.
69
70 7. If the file to be merged is not binary and is not a symlink, then
71 internal ``:merge`` is used.
72
73 8. Otherwise, ``:prompt`` is used.
74
75 For historical reason, Mercurial treats merge tools as below while
76 examining rules above.
77
78 ==== =============== ====== =======
79 step specified via binary symlink
80 ==== =============== ====== =======
81 1. --tool o/o o/o
82 2. HGMERGE o/o o/o
83 3. merge-patterns o/o(*) x/?(*)
84 4. ui.merge x/?(*) x/?(*)
85 ==== =============== ====== =======
86
87 Each capability column indicates Mercurial behavior for
88 internal/external merge tools at examining each rule.
89
90 - "o": "assume that a tool has capability"
91 - "x": "assume that a tool does not have capability"
92 - "?": "check actual capability of a tool"
93
94 If ``merge.strict-capability-check`` configuration is true, Mercurial
95 checks capabilities of merge tools strictly in (*) cases above (= each
96 capability column becomes "?/?"). It is false by default for backward
97 compatibility.
98
99 .. note::
100
101 After selecting a merge program, Mercurial will by default attempt
102 to merge the files using a simple merge algorithm first. Only if it doesn't
103 succeed because of conflicting changes will Mercurial actually execute the
104 merge program. Whether to use the simple merge algorithm first can be
105 controlled by the premerge setting of the merge tool. Premerge is enabled by
106 default unless the file is binary or a symlink.
107
108 See the merge-tools and ui sections of hgrc(5) for details on the
109 configuration of merge tools.