Converting a svn repository with layout changes

Tom Widmer tom.widmer at gmail.com
Sat Apr 10 19:22:18 BST 2010


Marius Gedminas wrote:
> http://mg.pov.lt/eazysvn/svn is an Subversion repository that used the
> trivial "everything in root" layout for 49 revisions, then switched to
> trunk/ + branches/ + tags/ for the rest.
> 
> bzr-svn chokes on that:
> 
> $ bzr branch http://mg.pov.lt/eazysvn/svn eazysvn
> bzr: ERROR: bzrlib.errors.NoSuchRevision: <bzrlib.plugins.svn.logwalker.CachingLogWalker object at 0xa94254c> has no revision Revision number 66
> 
> *** Bazaar has encountered an internal error.  This probably indicates a
>     bug in Bazaar.  You can help us fix it by filing a bug report at
>         https://bugs.launchpad.net/bzr/+filebug
>     attaching the crash file
>         /home/mg/.cache/crash/bzr-20100410155414-11172.crash
>     and including a description of the problem.
> 
>     The crash file is plain text and you can inspect or edit it to remove
>     private information.
> 
> 
> What are my options for getting this converted into a DVCS?  I'd prefer Bazaar,
> but I assume once I got any of the other two (git, hg) it wouldn't be too
> difficult to convert them to a Bazaar repo, no?
> 
> (Incidentally, git-svn handles this repository fine, but I end up with
> directories named /trunk and /tags/1.1.10/ in the source tree, which is
> suboptimal).

hg convert is quite easy to use for this kind of conversion 
(http://mercurial.selenic.com/wiki/ConvertExtension). Look at --filemap 
(for renaming folder during import) and --splicemap (for joining 
multiple imports together).

i.e. if you don't have any branches, you could do:
hg convert --rev 49 http://mg.pov.lt/eazysvn/svn earlyHistory
hg convert http://mg.pov.lt/eazysvn/svn/trunk laterHistory
hg convert --splicemap sm laterHistory earlyHistory

The file sm should contain:
<full sha of first rev of laterHistory> <full sha of last rev of 
earlyHistory>

You could also see how it copes with a plain (probably not too well):
hg convert http://mg.pov.lt/eazysvn/svn

Getting the history into Bazaar then should be doable - rename info is 
lost by hg's fast-export, but you could try bzr-hg: 
http://wiki.bazaar.canonical.com/ForeignBranches/Mercurial

Tom




More information about the bazaar mailing list