How to clone Mercurial to Subversion?

1.2k Views Asked by At

I'm a VERY happy user of bitbucket and mercurial after years of putting up with subversion (and CVS, SourceSafe and others; anybody remember SCCS?). I've considerable project history now in my local hg repo, pushed daily to bitbucket and thence to my home machines.

Problem is, my company wants me to maintain a copy of this history in subversion. And I've hit a stone wall trying to set this up. I've installed hgsubversion, I think correctly. And I've used svnadmin to create an empty svn repository ready to hold the hg history.

But now what? The instructions say to start by pulling a clone (of nose? what's that? I assume this means checkout a copy of the new empty svn directory. OK did that.

But now what? I assume the next step is to push my real local hg clone to the empty svn repo I just checked out. But nothing I've tried will do this. Pull fails as follows, reporting "unrelated repository" (as I recall I gate it the URL of my master local hg repo to get around the "Needs a URL" popup on everything else I've tried.

found new changeset 139d02f4b233 examining 4e97a23b6815:342df9e52cec abort: repository is unrelated [command returned code 255 Mon Apr 25 11:29:33 2011]

The result of all this fumbling around is a directory with .hg, .svn and .hgignore entries and nothing else.

So, I feel I'm missing something basic that hundreds of others must have tried by now. Can someone please help me get started? Thanks!

PS: Currently the intent is to maintain SVN permanently as the team repo and push changes there from Hg periodically which would remain the main client for me indefinitely. In case this matters...

2

There are 2 best solutions below

2
On

Perhaps look at the answers to this question.

Hgsubversion is for working with a repository cloned from SVN using Hg, not the other way around.

0
On

You can use the convert extension:

hg convert --dest-type svn mercurialrepo svnrepo

And hgsubversion allows you keep both of them in sync ( bidirectional)

Answered here at SO already:

Converting from Mercurial to Subversion

Migrating from Mercurial to Subversion