In my experience conversion of a real-word Subversion repository with bunch of projects and years of history is a little more involved. Mostly because in Subversion it's fine to have one huge repo for all the stuff. On the contrary Mercurial repositories are advised to be much more fine-grained.
I assume the following Subversion repository layout:
├── project1
│ ├── branches
│ ├── tags
│ └── trunk
│ ├── package1
│ └── package2
└── project2
Conversion should turn package1
and package2
into separate Mercurial repositories with their own history. In this answer I'm interested in single path, but conversion of tags and branches is also possible.
Preparation
I usually do conversion on a remote server with fast connection. For Debian-family the following packages are required.
apt-get install mercurial subversion python-subversion
Then Convert extension should be enabled.
echo -e "[extensions]\nhgext.convert=" >> ~/.hgrc
On Windows make sure you've fulfilled the prerequisites.
Execution
Note, that if you try to do a conversion directly from a remote subversion repo it will likely take hours, so the following creates mirror of the project's path. Then each conversion is a matter of seconds to minutes.
cd /tmp
svnadmin create svn-mirror
# on Windows you may need to look at comments to accepted answer
echo '#!/bin/sh' > svn-mirror/hooks/pre-revprop-change
chmod +x svn-mirror/hooks/pre-revprop-change
svnsync init file:///tmp/svn-mirror svn://subversion.repo/project1
svnsync sync file:///tmp/svn-mirror
echo 'include project1/trunk/package1' > package1-map
echo 'rename project1/trunk/package1 .' >> package1-map
hg convert --filemap=package1-map svn-mirror package1
echo 'include project1/trunk/package2' > package2-map
echo 'rename project1/trunk/package2 .' >> package2-map
hg convert --filemap=package2-map svn-mirror package2
Then inside package directory you can run hg serve -p 8080
and clone from http://your.host:8080
with a mercurial client or repo manager like RhodeCode.