Code/UsingMercurial
From N4C
Contents |
Using Mercurial With the N4C Source Code
The N4C source code is now maintained in Mercurial.
This page briefly describes how to access the N4C code source and related source trees. For more information on how to use Mercurial, there are several external sources with documentation: Understanding Mercurial Tutorial hgbook
Mercurial is a distributed version control system, which means that source code revisions can be shared between developers without necessarily accessing a central repository. The N4C maintain an "official" repository for the latest version and releases of N4C code.
Accessing the repository
HTTP access
You can both browse the repository and clone it (i.e. get a local repository and working directory) at http://basil.dsg.cs.tcd.ie
Specifically, to clone the LTPlib repository:
hg clone http://basil.dsg.cs.tcd.ie/LTPlib
Cloning using SSH
Contributing directly to the repository requires users to be a registered developer for the 'N4C' project. Please contact one of the project administrators listed on the N4c project wiki to be added to the project.
You will also need to register an SSH key for shell access.
Once that is set up, to clone the LTPlib repository, use:
hg clone ssh://<username>@basil.dsg.cs.tcd.ie/LTPlib
Make sure to replace [username@] with your appropriate username.
Updating to the current version
To update to the current set of changes requires two steps, first to pull changes into your local repository, then update your local snapshot to those changes:
hg pull hg update
You can do both these steps in one by using:
hg pull -u
For more information, see the mercurial documentation.
Committing a change
In mercurial, commits are all first made to a local repository, and can then be shared with another repository (e.g. the master repository) using a variety of methods.
Thus anyone can commit local changes to their locally cloned repository using:
hg commit
It's useful to first set up a ~/.hgrc file in your home directory containing your name and email address, for example:
[ui] username = Developer bloggs <n4c@nowhere.eu>
Once you've made local commits, you can still update to incorporate changes from the main tree, but you'll need to manage multiple local branches. See the mercurial documentation for more explanation.
Contributing patches
If you have read/write access over ssh and have cloned the repository using the above-mentioned commands, then any changes you have made locally can be shared with the master repository using:
hg push
If instead you have cloned the repository using http, but still have patches that you want to contribute back to the main source tree, then first do a local commit as described above. Then export this changeset using:
hg export REV
Where REV is the revision number of your commit. Capture the output from the command into a file and email it as an attachment to n4c@n4c.eu
Using the exported changeset (as opposed to a simple patch) is preferable because the changeset will include your name, email, and checkin comment which will be put into the mercurial change log.
You can do this in bulk for multiple commits using:
hg export -o mypatch-%n REV1 [REV2] [REV3]
This will create N files, one for each revision, named "mypatch-1", "mypatch-2", etc. Run 'hg help export' for more information.
