[PATCH] help: help topic for merge tools

Erik Zielke ez at aragost.com
Tue Oct 19 07:25:30 CDT 2010


# HG changeset patch
# User Erik Zielke <ez at aragost.com>
# Date 1287491066 -7200
# Node ID 53045391d477b4a78ff7a2f3e77067905488c117
# Parent  62c8f7691bc3bb8c907831d40da1e22c0769d8da
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.

diff -r 62c8f7691bc3 -r 53045391d477 doc/hgrc.5.txt
--- a/doc/hgrc.5.txt	Sun Oct 10 09:50:25 2010 -0500
+++ b/doc/hgrc.5.txt	Tue Oct 19 14:24:26 2010 +0200
@@ -856,20 +856,8 @@
     Template string for commands that print changesets.
 ``merge``
     The conflict resolution program to use during a manual merge.
-    There are some internal tools available:
-
-    ``internal:local``
-        keep the local version
-    ``internal:other``
-        use the other version
-    ``internal:merge``
-        use the internal non-interactive merge tool
-    ``internal:fail``
-        fail to merge
-
-For more information on configuring merge tools see the
-merge-tools_ section.
-
+    For more information on merge tools see :hg:`help merge-tools`.
+    For configuring merge tools see the merge-tools_ section.
 ``patch``
     command to use to apply patches. Look for ``gpatch`` or ``patch`` in
     PATH if unset.
diff -r 62c8f7691bc3 -r 53045391d477 mercurial/help.py
--- a/mercurial/help.py	Sun Oct 10 09:50:25 2010 -0500
+++ b/mercurial/help.py	Tue Oct 19 14:24:26 2010 +0200
@@ -94,6 +94,7 @@
      loaddoc('multirevs')),
     (['revsets'], _("Specifying Revision Sets"), loaddoc('revsets')),
     (['diffs'], _('Diff Formats'), loaddoc('diffs')),
+    (['merge-tools'], _('Merge Tools'), loaddoc('merge-tools')),
     (['templating', 'templates'], _('Template Usage'),
      loaddoc('templates')),
     (['urls'], _('URL Paths'), loaddoc('urls')),
diff -r 62c8f7691bc3 -r 53045391d477 mercurial/help/merge-tools.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/help/merge-tools.txt	Tue Oct 19 14:24:26 2010 +0200
@@ -0,0 +1,86 @@
+To merge files Mercurial uses merge tools.
+
+A merge tool combines two different versions of a file into a merged
+file. Merge tools are given the two files and the greatest common
+ancestor of the two file versions, so they can determine the changes
+made on both branches.
+
+The merge tools are used both for :hg:`resolve` and :hg:`merge`.
+
+Usually, the merge tool tries to automatically, by combining all
+the non-overlapping changes that occurred separately in the two
+different evolutions of the same initial base file. Furthermore, some
+interactive merge programs make it easier to manually resolve
+conflicting merges, either in a graphical way, or by inserting some
+conflict markers. Mercurial does not include any interactive merge
+programs but relies on external tools for that. External merge tools
+and their properties and usage is configured in merge-tools section -
+see hgrc(1).
+
+There are a some internal merge tools which can be used. The internal
+merge tools are:
+
+``internal:merge``
+   Uses the internal non-interactive merge tool for merging files.
+
+``internal:fail``
+   Rather than attempting to merge files that were modified on both
+   branches, it marks these files as unresolved. Then the resolve command
+   must be used to mark files resolved.
+
+``internal:local``
+   Uses the local version of files as the merged version.
+
+``internal:other``
+   Uses the remote version of files as the merged version.
+
+``internal:prompt``
+   Asks the user which of the local or the other version
+   to keep as the merged version.
+
+``internal:dump``
+   Creates three versions of the files to merge, containing the contents
+   of local, other and base. These files can then be used to perform a merge manually.
+   If the file merged is name a.txt, these files will accordingly
+   be named a.txt.local, a.txt.other and a.txt.base and they will be
+   placed in the same directory as the file to merge.
+
+How Mercurial decides which merge program to use
+
+1. If the HGMERGE environment variable is present, it is used. If
+   specified it must be either an executable path or the name of an
+   application in your executable search path.
+
+2. If the filename of the file to be merged matches any of
+   the patterns in the merge-patterns configuration section, then the
+   corresponding merge tool is used, unless the file to be merged is a
+   symlink. Here binary capabilities of the merge tool are not considered.
+
+3. If ui.merge is set, it is used.
+
+4. If any merge tools are present in the merge-tools
+   configuration section, and any of the tools can be found on the
+   system, the priority settings are used to determine which one to
+   use. Binary, symlink and GUI capabilities do also have to match.
+
+5. If a program named hgmerge exists on the system, it is
+   used.
+
+6. If the file to be merged is not binary and is not a
+   symlink, then internal:merge is used.
+
+7. The merge fails.
+
+Note: after selecting a merge program, hg will by default attempt
+to merge the files using a simple merge algorithm first, to see if
+they can be merged without conflicts. Only if there are conflicting
+changes will hg actually execute the merge program. Whether to use the
+simple merge algorithm first can be controlled be the premerge
+setting of the merge tool, which is enabled by default unless the
+file is binary or symlink.
+
+See merge tools and ui section of configuration help on setting the
+merge tools.
+
+See the merge-tools and ui sections of |hgrc(5)|_ for details
+on configuration of merge tools.


More information about the Mercurial-devel mailing list