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. |
@@ -856,20 +856,8 b' User interface controls.' | |||
|
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. |
@@ -94,6 +94,7 b' helptable = [' | |||
|
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')), |
General Comments 0
You need to be logged in to leave comments.
Login now