Alex Rivera | Logout

Converting a company from SVN to Hg?

Asked 2009-06-19T16:29:54.113
15

We're a heavy user of SVN here. While the advantages of GIT over SVN made us want to change, the advantages of Hg over SVN mean it's now time to change and we need to start doing so very soon.

I'm not so worried on the client side, but here are my questions.

  1. There are some excellent books on setting file metaproperties, properly organizing projects, etc on SVN. What is that book(s) for Hg?

  2. Is there a way to convert an SVN repository (that you've used) and can report how well it went? We don't want to lose years of commit logs if possible.

  3. When you DO convert, how did you split up the old code? Did you commit trunk as one project, and tags/forks as another?

  4. If you used SVN for legacy work, did you check in updates to SVN or something else?

Edit
Report

3 Answers

4

Please start by going to the Mercurial wiki. There you'll find a prominent link called Mercurial: The Definitive Guide which links to the hg book as it's called. You probably know the svn book for Subversion -- this is the equivalent for Mercurial (they're even hosted on the same server, but written by different authors).

Further down on the wiki front page, you'll find a section for refugees from other version control systems. There is a link with information for SVN users and repository conversion. The former explains that you can try HgSubversion if you want to do a bi-directional conversion between Subversion and Mercurial and the latter explains how to use the convert extension to do a (possible incremental) Subversion -> Mercurial conversion.

Did you find any of these pages already? If not, please tell us how we can improve these pages in order to make these things easier to find.

answered 2009-07-02T23:27:45.320
0

I had a rather large subversion repository where every main folder was a module. To split it up I used the following incantation:

for i in *; do \
    echo include "\"${i}\"" > /tmp/hgv.map; \
    echo rename "\"${i}\"" . >> /tmp/hgv.map; \
    hg convert --filemap /tmp/hgv.map /mnt/e/sqlwork/ "/mnt/h/work/${i}"; \
done

It gets every folder in the current directory, generates a filemap for the convert subcommand and converts the directory into a hg repository. I had no history-loss and hit no other obstacles. You may want to have a look at the convert extension.

answered 2010-06-15T04:59:55.350
0
  1. The hginit.com from Joel Spolsky is a very good intro.
  2. I've used hg convert plugin to convert (sic) my Subversion repo to a Mercurial version. Worked very well. See the plugin doc for details. There are (of course) other ways.
  3. hg convert indeed copies the full svn set, including branches and tags (and any other directory structure present in your repo).
  4. It is much better to use one single version control system, but if needed you can link with subversion by using the hgsubversion plugin.
answered 2011-03-30T09:16:33.313

Your Answer