Using Mercurial on Oh! No! Publishing

Mercurial is a distributed version control system (DVCS). This primarily means that every time you ``checkout (in SVN/CVS terminology)'' the repository, you get a complete local copy of the repository. This is called cloning for this reason: your clone of the repository is a full-featured duplicate of the publicly-accessible repository. This feature is useful to me because it means I don't have to backup any of the well-used repositories hosted locally. For you, this means that you do not need access to the central repository (i.e., my server) to make commits to a repository.

Cloning a Repository from Oh! No! Publishing

Before cloning a repository, you'll likely want to browse the hgweb interface to our repositories. Because Mercurial's symbol on the Periodic Table of Elements is Hg, most hosters of Mercurial repositories use a URL of the form http://ohnopublishing.net/hg/ or http://hg.ohnopublishing.net/. We use the former form here (but have the latter redirect to the former).

Once a repository is chosen, you may clone it. Using the shell interface, you run hg clone https://ohnopublising.net/hg/reponame. If you are using TortoiseHg, you are to right-click on a folder to clone the repository into, find Tortoise's context menu, and then click ``Clone Remote Repo'' (or similar)?. You must specify the clone method as HTTP, the hostname as ohnopublishing.net, and the path as hg/reponame. (TODO: Test TortoiseHG directions).

Changesets

When you commit, you are generating a changeset which describes any modifications you made to the working set of files. A working set is the files that you have ``checked out''. With Mecurial, ``checkouts'' are performed using the update command. If you made modifications you want to destroy, you can get rid of them by ``checking out'' the last changeset by running hg update -C (be careful, the -C will cause your changes to be removed).

Transfer of Changesets

When someone commits a changeset and pushes it to the public repository, he has uploaded his changes so that other may see them. Next time you clone the repository (and run update to get the latest working set—Mercurial automatically does this for you when cloning), you will see the changes he has made in your working set. However, there is a way to transfer the changesets to a local repository that has fallen behind the main repository. This is done by pulling.

Changeset Transfer with Oh! No! Publishing

Once you have cloned a repository, your local copy is automatically set up to pull from the clone URL. This means that you only have to run hg pull -u to pull changesets from Oh! No! Publishing's repo and update your working set. You may also pull changesets from other repositories into the repository from Oh! No! Publishing. You'll likely only do this if you are working with another developer on code that has not been pushed to us (you may be in this situation if you were denied access to the repository. You may still make commits locally and ask us to include your commits in the main repo. However, we want to be able to review them (and probably improve them) first).

Pushing is somewhat more difficult on Oh! No! Publishing. To maintain security, I only support pushing over SSH. You must first get an account on Oh! No! Publishing before being able to push. Pushing is very similar to pulling, except that the new changesets will come from your local repository and be posted remotely. That remote URL will look like ssh://ohnopublishing.net//home/hg/repos/reponame. Please note the double forward-slashes after the URL's hostname. If you are logged in to your own computer as a different user than you have registered on Oh! No! Publishing, you must specify the username as is normal with SSH (this makes your URL ssh://username@ohnopublishing.net//home/hg/repos/reponame).

CIA Support

During changeset transfer, CIA can be notified of your commit. It is preferable that all CIA stuff is managed at the central repository (which is, in this case, Oh! No! Publishing). All projects I set up on Oh! No! Publishing probably have CIA configured for use. All you have to do is trust my hgrc file. You must first determine which group the repo's hgrc file is owned by. First, SSH into your account at Oh! No! Publishing. Then issue the following command (lines starting with a dollar sign are to be typed without the dollar sign, other lines are sample output):

$ ls -lh /home/hg/repos/reponame/.hg/hgrc
-rw-rw-r-- 1 ohnobinki repogroup 645 Aug  2 22:48 /home/hg/repos/reponame/.hg/hgrc

The above line indicates that the file is owned by repogroup. Your group should be different than in this sample. (Also, if the group is ``users'', you must bother ohnobinki—ask him to change it to the group containing devs who are given permission to push to this repo.) Now, edit your ~/.hgrc file (on my server) to contain the repogroup in the groups variable in the trusted section. The file should look similar to the following:

[trusted]
groups=repogroup

Now, CIA should be notified when commits are made to your project.