Clone wiki

hgsubversion / Use


The original goal was to have as many of the commands as possible live as subcommands of the svn subcommand. These days, the goal is to have as many commands as possible wrap their hg-native counterpart.

Cloning a repository

Right now, you can only clone repositories that use a more-or-less standard Subversion layout. That is, the default location where work is done is called trunk, branches are located in a sibling of that directory called branches. Tags are expected to be another sibling of trunk called tags, but that is configurable.

For example, to get a clone of Nose:

$ hg clone svn+ nose

This will replay all the revisions from the Subversion repository into a new Mercurial repository. If nose already exists, it will try to use that as a repository previously created with the same command.

The last argument, nose, is not strictly required. But because of how Google Code lays out projects, the default target would be named svn — not very helpful. Note that although http and https URLs work, they are first treated as Mercurial repositories, and if that doesn't work, thay are treated as Subversion repositories. This may cause some annoyances — for example, double authentication — so svn+ can prepended to them to cause hgsubversion to deal with them directly.

Pulling New Updates

To pull new revisions from the remote repo, use hg pull while in the repository. hgsubversion will figure out that the default path is a Subversion one and override the default pulling mechanism.

Other Stuff

You can use the usual Mercurial commands to work with this repository. If you have a series of commits on a given branch, and want to move them to the tip of that branch, use the hg rebase --svn command while on the tip of your work, and those changesets will automatically be rebased over top of the new upstream work.