Search code examples
svnmercurialmercurial-convert

Split Subversion repository into multiple Mercurial repositories?


We're migrating from Subversion to Mercurial and have run into a bump in the SVN->Hg conversion process. Right now, our single SVN repo holds code for a couple distinct "projects", and we'd like to split them apart in the migration process. Our SVN repo is organized as:

.
|-- proj1
|   |-- branches
|   |-- tags
|   `-- trunk
`-- proj2
    |-- branches
    |-- tags
    `-- trunk

and we'd like to simply make proj1 and proj2 their own Hg repos. We'd like to, of course, not have history specific to proj1 appear in proj2's log either. Right now, when hg convert does the conversion, it just reads all the files pretty dumbly, not even distinguishing branches from trunks.

What's the process for filtering by directory and recognizing SVN branches in hg convert?


Solution

  • I've got it working now, thanks to the ConvertExtension wiki page!

    I tried Ry4an's method, but it came with the downsides of having to first convert the SVN repo into an intermediate Mercurial repo before splitting everything, and that branches, trunk, and tags weren't being recognized because there are two projects each with their own branches, trunk, and tags.

    I found that manually specifying the branches, trunk, and tags directory worked great for converting one project from SVN to Mercurial at a time:

    hg \
    --config convert.svn.trunk=proj1/trunk \
    --config convert.svn.branches=proj1/branches \
    --config convert.svn.tags=proj1/tags \
    convert --authors authors.txt original-svn-dir hg-proj1
    

    This will take care of recognizing SVN branches, tags, and trunk and filter for only proj1 revisions at the same time. Then, I just repeated it for proj2.