mercurial/help/merge-tools.txt
author Martin Geisler <mg@lazybytes.net>
Thu, 21 Oct 2010 21:34:30 +0200
branchstable
changeset 12804 e0e8b123b75e
parent 12771 c77f6276c9e7
child 12809 e5922564ab01
permissions -rw-r--r--
merge-tools: fixed typos Spotted by Patrick Mézard.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     1
To merge files Mercurial uses merge tools.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     2
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     3
A merge tool combines two different versions of a file into a merged
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     4
file. Merge tools are given the two files and the greatest common
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     5
ancestor of the two file versions, so they can determine the changes
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     6
made on both branches.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     7
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     8
The merge tools are used both for :hg:`resolve` and :hg:`merge`.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
     9
12804
e0e8b123b75e merge-tools: fixed typos
Martin Geisler <mg@lazybytes.net>
parents: 12771
diff changeset
    10
Usually, the merge tool tries to automatically reconcile the files by
e0e8b123b75e merge-tools: fixed typos
Martin Geisler <mg@lazybytes.net>
parents: 12771
diff changeset
    11
combining all the non-overlapping changes that occurred separately in
e0e8b123b75e merge-tools: fixed typos
Martin Geisler <mg@lazybytes.net>
parents: 12771
diff changeset
    12
the two different
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    13
evolutions of the same initial base file. Furthermore, some
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    14
interactive merge programs make it easier to manually resolve
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    15
conflicting merges, either in a graphical way, or by inserting some
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    16
conflict markers. Mercurial does not include any interactive merge
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    17
programs but relies on external tools for that. External merge tools
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    18
and their properties and usage is configured in merge-tools section -
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    19
see hgrc(5).
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    20
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    21
There are a some internal merge tools which can be used. The internal
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    22
merge tools are:
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    23
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    24
``internal:merge``
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    25
   Uses the internal non-interactive merge tool for merging files.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    26
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    27
``internal:fail``
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    28
   Rather than attempting to merge files that were modified on both
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    29
   branches, it marks these files as unresolved. Then the resolve
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    30
   command must be used to mark files resolved.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    31
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    32
``internal:local``
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    33
   Uses the local version of files as the merged version.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    34
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    35
``internal:other``
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    36
   Uses the remote version of files as the merged version.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    37
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    38
``internal:prompt``
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    39
   Asks the user which of the local or the other version to keep as
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    40
   the merged version.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    41
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    42
``internal:dump``
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    43
   Creates three versions of the files to merge, containing the
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    44
   contents of local, other and base. These files can then be used to
12804
e0e8b123b75e merge-tools: fixed typos
Martin Geisler <mg@lazybytes.net>
parents: 12771
diff changeset
    45
   perform a merge manually. If the file to be merged is named
e0e8b123b75e merge-tools: fixed typos
Martin Geisler <mg@lazybytes.net>
parents: 12771
diff changeset
    46
   ``a.txt``, these files will accordingly be named ``a.txt.local``,
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    47
   ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
12804
e0e8b123b75e merge-tools: fixed typos
Martin Geisler <mg@lazybytes.net>
parents: 12771
diff changeset
    48
   same directory as ``a.txt``.
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    49
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    50
How Mercurial decides which merge program to use
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    51
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    52
1. If the ``HGMERGE`` environment variable is present, it is used. If
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    53
   specified it must be either an executable path or the name of an
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    54
   application in your executable search path.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    55
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    56
2. If the filename of the file to be merged matches any of the
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    57
   patterns in the merge-patterns configuration section, then the
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    58
   corresponding merge tool is used, unless the file to be merged is a
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    59
   symlink. Here binary capabilities of the merge tool are not
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    60
   considered.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    61
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    62
3. If ui.merge is set, it is used.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    63
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    64
4. If any merge tools are present in the merge-tools configuration
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    65
   section, and any of the tools can be found on the system, the
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    66
   priority settings are used to determine which one to use. Binary,
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    67
   symlink and GUI capabilities do also have to match.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    68
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    69
5. If a program named ``hgmerge`` exists on the system, it is used.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    70
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    71
6. If the file to be merged is not binary and is not a symlink, then
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    72
   ``internal:merge`` is used.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    73
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    74
7. The merge fails.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    75
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    76
.. note::
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    77
   After selecting a merge program, Mercurial will by default attempt
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    78
   to merge the files using a simple merge algorithm first, to see if
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    79
   they can be merged without conflicts. Only if there are conflicting
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    80
   changes Mercurial will actually execute the merge program. Whether
12804
e0e8b123b75e merge-tools: fixed typos
Martin Geisler <mg@lazybytes.net>
parents: 12771
diff changeset
    81
   to use the simple merge algorithm first can be controlled by the
e0e8b123b75e merge-tools: fixed typos
Martin Geisler <mg@lazybytes.net>
parents: 12771
diff changeset
    82
   premerge setting of the merge tool. Premerge is enabled by default
12771
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    83
   unless the file is binary or symlink.
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    84
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    85
See the merge-tools and ui sections of hgrc(5) for details on
c77f6276c9e7 help: help topic for merge tools
Erik Zielke <ez@aragost.com>
parents:
diff changeset
    86
configuration of merge tools.