What is hg (mercurial) ?
There has been a recent trend towards so called Distributed Version Control Systems (DVCS), and hg (mercurial) is one of them (see also BzrMirror?). This page explains a bit why DVCS could be useful for numpy/scipy development, and how to use hg with a mirror of the numpy svn trunk I have set-up.
Mercurial is already available on many linux distributions (including ubuntu and debian). Binary packages for windows and mac os X are available on this mercurial webpage.
For windows, you want to get the "battery included" package (which include the merge tool).
Mercurial is essentially a command line tool, but some GUI are available.
To get the numpy trunk import in hg, you can use the checkout command of hg:
hg clone static-http://www.ar.media.kyoto-u.ac.jp/members/david/archives/numpy.trunk.hg
This will get the sources in the hg repository, as well as the whole history. Since the above mirror is http only, the first checkout may be slow, but I don't have the possibility to set up a hg server (this is also why you should use static-http, and not http), unfortunately. You can then start hacking the sources of numpy. Many commands are similar to svn:
Will show which files are changed.
Will show the difference(s) with the last commit. Getting log and annotation is also similar to svn:
hg log -r tip
To get the log of the last commit (see revision section for more information on revision with mercurial).
hg annotate setup.py
To get annotation of setup.py
Creating a new mercurial repository is extremely easy:
Will create a repository in the current directory. You can then add files using the command hg add.
Revision in mercurial
Because mercurial is distributed, the concept of revision is somewhat more blurry than with centralized ones. Internally, all DVCS use some kind of unique ID based on hash, md5, sha, etc... As bzr, hg keep the concept of a simple revision number by default, but this is only a UI detail. You should not be fooled: if two different people start from the same branch at revision 60, then for each commit, the revision will increases, but those revision numbers are only meaningful for the *repository*. In particular, if those two people merge their work together, or commit their changes to the branch they were starting from, the revisions will be changed (e.g. the revision 62 of the first person may become something else once merged with another repository).
A really trivial example to show how this works in practice. Let's start a simple project hello (this assume a unix-like environment, but adapting it to windows should not be difficult). The python module hello.py is a simple function:
def hello(): return "hello"
Put this file into a new directory, for example hello, and then create a mercurial project in this directory:
hg init hg add hello.py hg ci -m "initial commit"
Now, create another branch from this repository:
hg clone hello hello2
In both hello and hello2, if you look at the log with "hg log", you will see:
changeset: 0:504693d0b996 user: david@donau date: Fri Jan 18 15:58:39 2008 +0900 summary: initial commit
The changeset number will be different in your case, but they will be the same in both projects, hello and hello2. Now, make a change in each project, and commit the changes. Now, in each directory, you will get something like:
changeset: 1:6a584d29a656 tag: tip user: david@donau date: Fri Jan 18 16:00:09 2008 +0900 summary: Super hello changeset: 0:504693d0b996 user: david@donau date: Fri Jan 18 15:58:39 2008 +0900 summary: initial commit
changeset: 1:1b3627606a56 tag: tip user: david@donau date: Fri Jan 18 15:59:53 2008 +0900 summary: Docstring changeset: 0:504693d0b996 user: david@donau date: Fri Jan 18 15:58:39 2008 +0900 summary: initial commit
Note on how both have revision 1, but the hexadecimal number is different.