Differences between revisions 3 and 8 (spanning 5 versions)
Revision 3 as of 2008-07-28 19:01:04
Size: 2565
Editor: wireless
Comment:
Revision 8 as of 2011-08-09 20:52:49
Size: 3701
Editor: echidna
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
== What is Mercurial ==
[[http://www.selenic.com/mercurial/wiki/|Mercurial]] is a Source Control Management system (or Version Control System, or several other names) written in Python and C. Unlike older SCMs like CVS or Subversion, and like Git and Bazaar, Mercurial is distributed; meaning that there is no central privileged repository. All users have a full copy of the source and the history. Current major projects that use it include [[http://developer.mozilla.org/en/docs/Mercurial|Mozilla]] and [[http://openjdk.java.net/|Java]].

== Getting started ==
See below for some suggestions about configuration. Read the docs on the Mercurial and Mozilla Developer Center pages linked to above, and try
{{{
hg help
}}}
for decently full help about Mercurial commands.
Line 13: Line 23:
{{{ {{{#!highlight cfg numbers=disable
Line 31: Line 41:
{{{ {{{#!highlight sh numbers=disable
Line 40: Line 50:
{{{ {{{#!highlight cfg numbers=disable
Line 47: Line 57:
This sets [http://meld.sourceforge.net/ Meld] as the merge program. Add into the existing `[ui]` section.
{{{
This sets [[http://meld.sourceforge.net/|Meld]] as the merge program. Add into the existing `[ui]` section.
{{{#!highlight cfg numbers=disable
Line 54: Line 64:
Installing [http://colordiff.sourceforge.net/ ColorDiff] and adding this (into the existing sections where appropriate) gives you color diffs on the command line:
{{{
Installing [[http://colordiff.sourceforge.net/|ColorDiff]] and adding this (into the existing sections where appropriate) gives you color diffs on the command line:
{{{#!highlight cfg numbers=disable
Line 68: Line 78:
To use Mercurial effectively on Windows you'll need to also install [http://tortoisesvn.tigris.org/ TortoiseSVN] (for Tortise``Merge) 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. To use Mercurial effectively on Windows you'll need to also install [[http://tortoisesvn.tigris.org/|TortoiseSVN]] (for Tortise``Merge) 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. Starting with version 0.4.1, Tortoise``Hg also includes the current version of Mercurial in its installer.
Line 71: Line 81:
{{{ {{{#!highlight cfg numbers=disable
Line 73: Line 83:
merge = TortiseMerge
editor = gvim
merge = TortoiseMerge
editor = vim
Line 78: Line 88:
TortiseMerge.executable = C:\Program Files\TortoiseSVN\bin\TortiseMerge.exe
TortiseMerge.args = /mine:$local /theirs:$other /base:$base -o /merged:$output
TortoiseMerge.executable = C:\Program Files\TortoiseSVN\bin\TortiseMerge.exe
TortoiseMerge.args = /mine:$local /theirs:$other /base:$base -o /merged:$output
Line 82: Line 92:
CategorySourceManagement == Serving your repo on the web ==
[[MercurialHgWeb|HgWeb configuration]]

Mercurial

1. What is Mercurial

Mercurial is a Source Control Management system (or Version Control System, or several other names) written in Python and C. Unlike older SCMs like CVS or Subversion, and like Git and Bazaar, Mercurial is distributed; meaning that there is no central privileged repository. All users have a full copy of the source and the history. Current major projects that use it include Mozilla and Java.

2. Getting started

See below for some suggestions about configuration. Read the docs on the Mercurial and Mozilla Developer Center pages linked to above, and try

hg help

for decently full help about Mercurial commands.

3. 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.

3.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 =

3.2. Mac extra config

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

#!/bin/sh
# 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

3.3. Unix extra config

This sets Meld as the merge program. Add into the existing [ui] section.

[ui]
merge = meld

3.4. Mac/Unix common extra config

Installing ColorDiff and 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

3.5. Windows extra config

To use Mercurial effectively on Windows you'll need to also install TortoiseSVN (for TortiseMerge) and Cygwin (for command line ssh). It's also nice to install TortoiseHg for Windows Explorer integration with Mercurial. Starting with version 0.4.1, TortoiseHg also includes the current version of Mercurial in its installer.

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

[ui]
merge = TortoiseMerge
editor = vim
ssh = C:\cygwin\bin\ssh.exe

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

4. Serving your repo on the web

HgWeb configuration

Mercurial (last edited 2011-08-09 20:52:49 by echidna)

MoinMoin Appliance - Powered by TurnKey Linux