Using TortoiseHg-Mercurial locally with SVN backend

This tutorial will show how to install and configure TortoiseHg to talk to an existing SVN repository. It lets you use Mercurial as an SVN client thus allowing version control of your changes locally while still allowing you to push your changes back to the SVN repository.


Step 1: Installing TortoiseHg

Install the latest version from: http://bitbucket.org/tortoisehg/stable/wiki/download

This will install both TortoiseHg and command line Mercurial.


Step 2: Installing HgSubversion

Now that you have TortoiseHg installed, you will be using it to get the HgSubversion extension. For the sake of the tutorial, we will be using C:\hg-extensions as the extensions directory.

  1. Create the directory "C:\hg-extensions" using Windows Explorer
  2. Right click on the hg-exensions folder and select "TortoiseHg... \ Clone A Repository"
  3. Enter the source "http://bitbucket.org/durin42/hgsubversion/" and destination "C:\hg-extensions\hgsubversion"
  4. Click Clone
  5. Once its done click "Close" then "Cancel" (You will probably try to reclone the repository at least once by clicking "Clone" instead of "Cancel")

You should now have an hg working copy in "C:\hg-extensions\hgsubversion"


Step 3: Configuring Mercurial to Use HgSubversion

  1. Right click anywhere, and select "TortoiseHg... \ Global Settings"
  2. In the dialog that comes up click "Edit File" (This should open up a text editor with "mercurial.ini")
  3. You should add the following to the file:
[extensions]
rebase= 
svn=c:\hg-extensions\hgsubversion\hgsubversion

Now, we need to test and make sure hgsubversion is working. For this we use the command prompt. Go to a command prompt and use the following command:

hg help svn

If you get help text for "Subcommands for Subversion Integration' you are in business.


Step 4: Importing an SVN Repository

At this point - we're going to assume that you have learned a little about how TortoiseHg (or just hg) works, and understand how to use it with a remote Hg repository. Working with a remote SVN repository is essentially the same (with hgsubversion):

Here is an example using Prat's repository:

Just like before, you use "TortoiseHg... \ Clone a repository" from the right click menu.

This time you point the source to the root of the SVN repository (DO NOT Include /trunk). For Prat we use the following as the source:

svn://svn.wowace.com/wow/prat-3-0/mainline

You can use C:\Prat or whatever you want as the destination, then click clone. (Note: This process may take a while as it will import each revision from the SVN repository)

Once this is compete - you will have an Hg working copy and be able to both pull from and push to the svn repository using TortoiseHg.


Comments

Posts Quoted:
Reply
Clear All Quotes