|
Size: 7078
Comment:
|
← Revision 92 as of 2012-11-11 12:52:17 ⇥
Size: 0
Comment: executing proposed deletion
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| #pragma section-numbers 3 <<Include(A:delete)>> == Merge Program == A '''[[Merge|merge]] program''' combines two different versions of a file into a ''merged'' file. Usually, the program tries to do so 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 [[ResolveConflict|resolve]] [[Conflict|conflicting]] merges, either in a graphical way, or by inserting some conflict markers. By default, Mercurial will attempt to do a classic 3-way merge on text files internally before trying to use an external tool. <<TableOfContents>> === How Mercurial decides which merge program to use === * If the `HGMERGE` environment variable is present, it is used. * Otherwise, 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. (See MergeToolConfiguration for details.) * Otherwise, if the `ui.merge` config setting is set, that is used. (The next section explains how to configure this.) * Otherwise, 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. (MergeToolConfiguration explains how to configure this.) * Otherwise, if a program named `hgmerge` exists on the system, that is used. * Otherwise, if the file to be merged is not binary and is not a symlink, then `internal:merge` is used. * Otherwise, the merge fails. However: after selecting a merge program, Mercurial will usually 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. (If the file to be merged is binary or a symlink, then `hg` doesn't bother with the simple merge algorithm. If the selected merge tool is `internal:fail`, `internal:local`, or `internal:other`, then `hg` skips the simple merge algorithm, as the user has specifically requested that no merging take place.) Before Mercurial 1.0, a script named `hgmerge` was installed by default. As of Mercurial 1.0, `hgmerge` is no longer installed (and it should not be distributed with Mercurial), but `hg` still uses it, if it's present on the system and no other merge tools are configured (see [[hgmerge]]) === Choosing a merge program === Some merge programs include: ==== Linux merging and diffing tools ==== * [[KDiff3]] - feature-rich merge tool, uses Qt and is thus cross-platform. * [[Meld]] - 3-way editor, uses GTK / Gnome and thus Unix only. * [[gPyFm]] - merge tool from !OpenSolaris, cross-platform. * [[http://www.gnu.org/software/diffutils/|diff3]] - non-interactive merge tool, standard on most Unix/Linux installs. See MergingManuallyInEditor for a wrapper script that uses it with your favorite editor. * [[http://tkdiff.sf.net/|tkdiff]] - known to work under Windows. * [[http://furius.ca/xxdiff/|xxdiff]] * DiffMerge - Cross platform feature-rich diffing and merging tool. (free) * [[MergingWithVim|"vim -d"]] - can be used wherever the popular "vim" editor can be found. * [[MergingWithEmacs|Emacs]] - using either Ediff or Emerge. * P4Merge - Cross platform feature-rich diffing and merging tool. (free) ==== Windows merging and diffing tools ==== * [[http://tortoisesvn.tigris.org/TortoiseMerge.html|TortoiseMerge]] - for Windows, part of TortoiseSVN. (open source) * WinMerge - Windows only, as the name suggests. (open source) [[http://winmerge.org/about/screenshots/|screenshots]] * DiffMerge - Cross platform feature-rich diffing and merging tool. (free) * [[KDiff3]] - feature-rich merge tool, uses Qt and is thus cross-platform. (open source) * [[http://gnuwin32.sourceforge.net/|GnuWin32]] - non-interactive merge tool. See MergingManuallyInEditor for a wrapper script that uses it with your favorite editor. (open source) * [[http://tkdiff.sf.net/|tkdiff]] - known to work under Windows. (open source) [[http://sourceforge.net/dbimage.php?id=60321|screenshot]] * [[http://furius.ca/xxdiff/|xxdiff]] - (open source) [[http://furius.ca/xxdiff/doc/screenshots/dirindex.html|screenshots]] * [[http://www.araxis.com/merge/|Araxis Merge]] - A very nice client but expensive (proprietary) * P4Merge - Cross platform feature-rich diffing and merging tool. (free) * [[http://www.scootersoftware.com/|Beyond Compare]] - Extremly good and productive compare tool. (costs some money) ==== OS X merging and diffing tools ==== * [[http://en.wikipedia.org/wiki/Apple_Developer_Tools|FileMerge]] - Apple's standard gui diffing and merging tool. Part of the standard developer tools (XCode, etc.). (free) * P4Merge - Cross platform feature-rich diffing and merging tool. (free) * DiffMerge - Cross platform feature-rich diffing and merging tool. (free) * [[http://www.araxis.com/merge/|Araxis Merge]] - A very nice very feature rich client but expensive (proprietary) * [[http://www.deltopia.com/|DeltaWalker]] - Cross platform fully featured merging and diffing tool (proprietary) * [[http://www.changesapp.com|Changes]] - Native Mac OS X. Mainly for diffing but it can perform simple merges. (proprietary) * [[http://www.barebones.com/products/bbedit/|BBEdit]] - Native Mac OS X text editor with diffing and merging capabilities. (proprietary) * [[http://www.barebones.com/products/textwrangler/|TextWrangler]] - Native Mac OS X text editor with diffing and merging capabilities. (free) * [[http://www.kaleidoscopeapp.com/|Kaleidoscope]] - Native Mac OS X gorgeous diffing tool only (proprietary) * [[http://www.dotfork.com/difffork/|DiffFork]] - Native Mac OS X diffing tool only (also pretty) (proprietary) * [[KDiff3]] - Cross platform and feature-rich, but very un-mac like. (open source) * [[http://furius.ca/xxdiff/|xxdiff]] - Cross platform and capable but un-mac like. (open source) ==== Custom merging tools ==== * [[MergeGettext]] - A script to merge GNU gettext catalogs === Configuring a merge program === If you have a preferred merge program, you can set the {{{merge}}} entry in the {{{ui}}} section of your hgrc file. ==== Kdiff3 ==== {{{ [ui] merge = your-merge-program }}} In Mercurial 1.0 and later you can also specify the merge program's arguments in {{{.hgrc}}}. For example, to specify the arguments to kdiff3, add the following: {{{ [merge-tools] kdiff3.args = $base $local $other -o $output }}} (see the [[ExtdiffExtension|external diff]] extension to configure the diffing aspect of the tool.) ==== Meld ==== {{{ [ui] merge = meld }}} In Mercurial 1.0 and later you can also specify the merge program's arguments in {{{.hgrc}}}. For example, to specify the arguments to meld, add the following: {{{ [merge-tools] meld.args = $local $base $other $output }}} ---- CategoryGlossary |
