Jump to Navigation

Me on Twitter

  • RT @tewoz: Demain, lancement officiel de ma campagne de crowdfunding pour mon recueil de strips « Comme un Lundi » ! Je compte sur vous pou… 1 week 3 days ago
  • Found that in my old CD tower. Noticed the penguin ? Yes it's a #Linux version of #Tribes - Still one of the best g… https://t.co/4QEzHVXhmO 3 weeks 5 days ago
  • RT @esascience: In this #Hubble image, a very distant galaxy – nicknamed the Sunburst Arc – appears at least 12 times 4 weeks 5 days ago
  • The CIA just lost control of its hacking arsenal. Here’s what you need to know. - https://t.co/QrjTDlHJIA 5 weeks 2 days ago
  • RT @timberners_lee: Today the internet is 50 years old. The internet & the web it enabled have changed billions of lives for the better. B… 6 weeks 16 hours ago
  • Head-to-head evaluation of six password managers - Quantopian Security - Medium - https://t.co/WAiev023AJ 6 weeks 2 days ago
  • How I Fully Quit Google (And You Can, Too) - Featured Stories - Medium - https://t.co/d61000B5Fz 7 weeks 6 days ago
  • Just curious to see what happens if I publish a proof that's not been validated yet but another one has been since… https://t.co/tEjW1dOBZk 8 weeks 2 hours ago
  • Verifying myself: I am nicolabs on https://t.co/kWEo6pR64D. 8Q3_sZQCU_eT7R0adjPpzaxxehzySRwhjnWp / https://t.co/AIAa4UWCyX 8 weeks 2 hours ago
  • Verifying myself: I am nicolabs on https://t.co/kWEo6pR64D. SWkl7x3CLQ7yB21lfR5703KSVEq24aUwjKsG / https://t.co/aTGuWxSQzG 8 weeks 2 hours ago

Migrating from Subversion to Mercurial

Instructions are aimed at Windows mainly (on Linux it should be easier).

Need to migrate from Subversion to Mercurial ?

This is a quick guide to migrating an existing SVN repository to a new Hg one.

It takes 2 major steps :

  1. make a local copy of the existing SVN repository
  2. convert it to Hg

Make a local copy of the existing SVN repository

Oddly enough, this was the hardest part to figure out :

1. Create a local repository

It will mirror the existing (remote) one. I just used TortoiseSVN on an new, empty directory.

2. Initialize this repository

C:\Users\nicolas\Work>"C:\Program Files\TortoiseSVN\bin\svnsync.exe" init file:///c:/Users/nicolas/Work/ciform-bak https://plugnauth.svn.sourceforge.net/svnroot/plugnauth

On Windows you will need the following pre-revprop-change.bat file in the hooks subdirectory of your newly created repository :

@REM pre-revprop-change.bat
@ECHO OFF
 
set user=%3
 
if /I '%user%'=='syncuser' goto ERROR_REV
 
exit 0
 
:ERROR_REV echo "Only the syncuser user may change revision properties" >&2
exit 1
https://gist.github.com/1679659

You may find similar code on the net but :

  • the sample that's provided with TortoiseHg (or Tigris' distribution apparently) only contains Linux-ready scripts
  • many samples on the web work fine for common operations but not for the svnsync command we are about to use

It looked strange to me that it was not working out of the box on Windows, but I really had to create that script to make it work...

3. Start the synchronization

C:\Users\nicolas\Work>"C:\Program Files\TortoiseSVN\bin\svnsync.exe" sync --username cbonar file:///C:/Users/nicolas/Work/ciform-bak
[...]
Committed revision 92.
Copied properties for revision 92.
Transmitting file data .
Committed revision 93.
Copied properties for revision 93.

We can now work with this local SVN mirror.

 

Convert the SVN repository to a Hg one

This operation is quite simple...

1. Enable ConvertExtension

With a command line client, it should be as easy as making sure you have the following in your .hgrc or mercurial.ini file :

[extensions]
convert=

With TortoiseHg I just had to enable "convert" in the global settings (I did first on the repo settings only but it didn't work right away so I gave up) :

ConvertExtension enabled in TortoiseHg

2. Run the "hg convert" command

It might be the right time to remap author names...

C:\Program Files\TortoiseHg>hg convert file:///c:/Users/nicolas/Work/ciform-bak file:///c:/users/nicolas/Work/ciform-hg
initializing destination file:///c:/users/nicolas/Work/ciform-hg repository
scanning source...
sorting...
converting...
92 + added trunk directory : main development stream
[...]
0 + a lot of work on the ant task

 

Done. You now have a fully functional Mercurial repository with all changesets from the SVN history !

 

Successful import from SourceForge's SVN to Google Code's Hg :

Sample project imported from Sourceforge's SVN to Google code's Hg

Related links

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • E-Mail addresses are hidden with reCAPTCHA Mailhide.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>. The supported tag styles are: <foo>, [foo].
  • Twitter-style #hashtags are linked to search.twitter.com.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.