Posts Tagged ‘mercurial’

mercurial

Wednesday, October 7th, 2009

I’m taking compilers this semester, and we’re storing our code on google code with mercurial as our version control system. I like mercurial a lot, it it easy to use, fast, flexible, and sort of fun. We’re branching and merging way more than is reasonable, considering that there are only two developers and 3 files.

But I did find one thing frustrating, and that was the merging process. If I merged two files, I sometimes had to go in and edit those conflicts by hand, rather than using a convenient tool like the FileMerge application that comes in the Mac Developers kit.

After some searching, I found out how. All of the information is on selenic, but this is the brief version.

  1. Find out what folder stores the binary. Open a terminal and enter “which hg”. If this is the /usr/local/bin/, you will need to create (unless you already have one), a file in /usr/local/etc/mercurial/ called ‘hgrc’.
  2. In some folder on your path put the following shell script, named opendiff-w
    #opendiff returns immediately, without waiting for FileMerge to exit.
    # Piping the output makes opendiff wait for FileMerge.
    opendiff "$@" | cat
  3. make sure that opendiff-w is executable. Try chmod 744 opendiff-wNow, in your ‘hgrc’ file, write this: [merge-tools]
    filemerge.executable = /path/to/file/opendiff-w
    filemerge.args = $local $other -ancestor $base -merge $output

That’s it. The next merge that requires your attention should call FileMerge!