Mercurial

1. Configuration

The configuration file for Mercurial is .hgrc in your home directory on Unix/Mac OS X, and Mercurial.ini in your profile directory (e.g. C:\Documents and Settings\username\) on Windows.

1.1. Base configuration

The following sets the username and email address associated with your commits, tells Mercurial to use Git-style diffs, sets 4 lines of context around a change when showing a diff, and turns on support for patch queues and colorized output:

[ui]
username = Firstname Lastname <username@yourdepartment.rochester.edu>

[diff]
git = 1

[defaults]
diff=-p -U 4
qdiff = -U 4

[extensions]
hgext.mq =
color =

1.2. Mac extra config

Create a file called /usr/local/bin/opendiff-w (if it doesn't exist already) with the contents

# opendiff returns immediately, without waiting for FileMerge to exit.
# Piping the output makes opendiff wait for FileMerge.
opendiff "$@" | cat

and add the following to your .hgrc, which allows you to use opendiff from the Apple Developer Tools to do merges:

[merge-tools]
filemerge.executable = opendiff-w
filemerge.args = $local $other -ancestor $base -merge $output

1.3. Unix extra config

This sets [http://meld.sourceforge.net/ Meld] as the merge program. Add into the existing [ui] section.

[ui]
merge = meld

1.4. Mac/Unix common extra config

Adding this (into the existing sections where appropriate) gives you color diffs on the command line:

[defaults]
cdiff = -q

[extensions]
hgext.extdiff =

[extdiff]
cmd.cdiff = colordiff
opts.cdiff = -uprN

1.5. Windows extra config

To use Mercurial effectively on Windows you'll need to also install [http://tortoisesvn.tigris.org/ TortoiseSVN] (for TortiseMerge) and [http://www.cygwin.com/ Cygwin] (for command line ssh). It's also nice to install [http://tortoisehg.sourceforge.net/ TortoiseHg] for Windows Explorer integration with Mercurial.

As always, add these to the existing sections, but this time to your Mercurial.ini:

[ui]
merge = TortiseMerge
editor = gvim
ssh = C:\cygwin\bin\ssh.exe

[merge-tools]
TortiseMerge.executable = C:\Program Files\TortoiseSVN\bin\TortiseMerge.exe
TortiseMerge.args = /mine:$local /theirs:$other /base:$base -o /merged:$output

CategorySourceManagement

MoinMoin Appliance - Powered by TurnKey Linux