How do I change the Diffing and Merging tool MacHg uses?
MacHg's default tool for diffing and merging is FileMerge. Arranging to use a different Diffing & Merging tool with MacHg is very easy. If the tool is not directly supported, then you need to do a tiny bit of setup beforehand.
Using Directly Supported Tools
Here is a list of the Diffing & Merging tools that MacHg directly supports:
- FileMerge (free)
- Araxis Merge
- P4Merge (free)
- DiffMerge (free)
- kdiff3 (free)
- TextWrangler (free)
I have tested and confirmed that all of the above tools correctly function with [MacHg 0.9.17] and above. To be able to use one of these listed tools with MacHg, simply download it from the vendor’s website, install it somewhere on your hard drive, run it once and quit it to ensure that OSX knows where the tool is.
Using a directly supported tool for Diffing
Simply open MacHg's preferences, and on the Mercurial tab of the preferences change the popup "For Diffs Use:" to the tool you want to use. If any popups for particular tools come up, follow the instructions. (For instance the p4merge tool must be located in the Applications folder, which is a restriction particular to p4merge. Or for a second instance, the Kaleidoscope command line tools must be installed if you are trying to use Kaleidoscope as a diffing tool. MacHg will tell you to install them if they are not already installed.)
Using a directly supported tool for Merging
Simply open MacHg's preferences, and on the Mercurial tab of the preferences, change the popup "For Merges Use:" to the tool you want to use. (Note: not all tools allow merging. This is a restriction of the tool itself and has nothing to do with MacHg or Mercurial.)
Configuring “other” Diffing & Merging Tools
To configure Mercurial to use a not directly-supported Diffing & Merging tool, you need to first download the tool and then make the necessary configuration changes to your settings in your ~/.hgrc file so that Mercurial can use the new tool. (Alternatively you could make the changes to your ~/Application Support/MacHg/hgrc file to restrict the configuration changes to just MacHg.) Normally you just look on Google for the particular instructions for installing and configuring the tool. For instance for illustration, here are the instructions for AraxisMerge, Changes, DiffMerge, and kdiff3.
(It is assumed you have also installed the command line version of Mercurial for OSX. MacHg, of course, doesn't need the command line version since it includes its own internal complete copy of Mercurial. But it's convenient to have the command line version installed to do testing every so often, for example for testing in this case.)
Once you have configured your Diffing & Merging tool, you should test it on the command line. Test the tool by going to some repository and making a change in some of the files and then executing hg difftoolname. Here in a terminal screen shot you can see a normal diff using 'hg diff' and then the command to launch the external diff tool arxdiff, which launches AraxisMerge:
Mercurial should open the differences in the given diff tool. All of this is independent of MacHg. (For this section, I needed to illustrate how to set up a diffing & merging tool. I chose to show how to set up Araxis, even though direct support is built in for it.)
Configuring MacHg to use “other” tools for Diffing
Simply open MacHg's preferences, and on the Mercurial tab of the preferences change the popup "For Diffs Use:" to Other, and then enter the name of your diff tool. (Note: you also need to check the include ~/.hgrc in your HGRCPATH.) Then in the input field which appears, simply enter the difftoolname as you would use it on the command line. As you can see in the following screen shot, I have entered the tool name 'arxdiff', which is the tool used for AraxisMerge:
Configuring MacHg to use “other” tools for Merging
Simply open MacHg's preferences, and on the Mercurial tab of the preferences change the popup "For Diffs Use:" to Other, and then enter the name of your merge tool. For instance if you had set up your confguration files for arxmerge, you could enter that here.