Merging Conflicting Changes
Most merges are simple affairs, but sometimes you’ll find yourself merging changes where each side modifies the same portions of the same files. Unless both modifications are identical, this results in a conflict, where you have to decide how to reconcile the different changes into something coherent.
Figure 3-4. Conflicting changes to a document
Figure 3-4 illustrates an instance of two conflicting changes to a document. We started with a single version of the file; then we made some changes, while someone else made different changes to the same text. Our task in resolving the conflicting changes is to decide what the file should look like.
Mercurial doesn’t have a built-in facility for handling conflicts. Instead, it runs an external program, usually one that displays some kind of graphical conflict resolution interface. By default, Mercurial tries to find one of several different merging tools that are likely to be installed on your system. It first tries a few fully automatic merging tools; if these don’t succeed (because the resolution process requires human guidance) or aren’t present, it tries a few different graphical merging tools.
It’s also possible to get Mercurial to run a specific
program or script by setting the HGMERGE
environment
variable to the name of your preferred program.
Using a Graphical Merge Tool
My preferred graphical merge tool is ...
Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.