0
votes

I have an old Subversion repository with many projects inside it. Each of the project follows the canonical trunk-branches-tags convention for SVN.

I can convert the entire SVN repository to Mercurial using:

$ hg convert /some-path/old-svn-rep
# This creates old-svn-rep-hg

$ cd old-svn-rep-hg
$ hg update
# Can see all the projects as separate directories

If you know SVN, you know that the directory organization inside /some-path/old-svn-rep is:

$ ls /some-path/old-svn-rep
conf/
db/
hooks/
locks/
format
README.txt

How do I convert a single project inside this SVN repository, say named Foo, into a Mercurial repository?

This obviously does not work:

$ hg convert /some-path/old-svn-rep/Foo
assuming destination Foo-hg
initializing destination Foo-hg repository
/some-path/old-svn-rep/Foo does not look like a Subversion repository

Please assume that the SVN project has changes in the trunk, many branches and tags.

3

3 Answers

1
votes

hg convert can take any URL that you would use to checkout the project in the SVN repository.

In my tests, svn checkout /some-path/old-svn-repo/Foo doesn't work either. What you need to do is prefix it with file:// if you are cloning something from the local filesystem - i.e. svn checkout file:///some-path/old-svn-repo/Foo

It is the same for hg convert so try hg convert file:///some-path/old-svn-repo/Foo

0
votes

HGSubversion extension and clone SVN-repo (hg clone) from project root

0
votes

I was able to do this with the following steps:

svnadmin create Foo

I needed to alter this command as I did not have access to the svn server so the versions didn't match during clone:

svnadmin create --compatible-version 1.6 Foo

Follow steps 1-5 here: howto use svnsync to mirror a repository on windows

svnsync init file:///projects/Foo /some-path/old-svn-rep/Foo
svnsync sync file:///projects/Foo

Follow step 2 here to create usermapping.txt: Goodbye Subversion, Hello Mercurial: A Migration Guide

Install hgsubversion: hgsubversion

hg clone --config extensions.hgsubversion=/path-to-hgsubversion / 
--config hgsubversion.authormap=usermapping.txt / 
file:///projects/Foo hg-Foo