Mercurial > hg
comparison mercurial/help/merge-tools.txt @ 12771:c77f6276c9e7
help: help topic for merge tools
I have made a help topic for merge tools. The text in the topic is
based on the http://mercurial.selenic.com/wiki/MergeProgram page from
the wiki, along with some extra information on the internal merge tools.
author | Erik Zielke <ez@aragost.com> |
---|---|
date | Wed, 20 Oct 2010 16:54:34 +0200 |
parents | |
children | e0e8b123b75e |
comparison
equal
deleted
inserted
replaced
12770:614f0d8724ab | 12771:c77f6276c9e7 |
---|---|
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. |