Converting a svn repository with layout changes

Jelmer Vernooij jelmer at samba.org
Wed Apr 14 23:04:50 BST 2010


On Thu, 2010-04-15 at 00:44 +0300, Marius Gedminas wrote:
> On Wed, Apr 14, 2010 at 06:33:36PM +0200, Jelmer Vernooij wrote:
> > On Wed, 2010-04-14 at 19:27 +0300, Marius Gedminas wrote:
> > > On Mon, Apr 12, 2010 at 06:53:08PM +0300, Marius Gedminas wrote:
> > > > On Mon, Apr 12, 2010 at 06:34:51PM +0300, Marius Gedminas wrote:
> > > > > On Sat, Apr 10, 2010 at 06:37:10PM +0200, Jelmer Vernooij wrote:
> > > > > > On Sat, 2010-04-10 at 19:01 +0300, 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.
> ...
> > > Now
> > > 
> > > $ bzr branch http://mg.pov.lt/eazysvn/svn eazysvn
> > > 
> > > gives me a repository containing 66 revisions, half of which contain
> > > directories named trunk/, branches/ and tags/
> > > 
> > > $ bzr branch http://mg.pov.lt/eazysvn/svn/trunk eazysvn
> > > 
> > > gives me a repository containing 15 revisions, losing old history.
> >
> > This is correct - see the output of:
> > 
> > svn log http://mg.pov.lt/eazysvn/svn/trunk
> > 
> > which also reports just 15 revisions.
> 
> You asked svn log to filter by pathname and it does so, but the full history
> itself is still there.  Compare
> 
>   svn log http://mg.pov.lt/eazysvn/svn/trunk/README.txt
>   (10 changesets)
The history of the trunk directory is what matters, that is the branch.
Bazaar does not support tracking cherry-picks and that's what is
happening here with README.txt. The branch "trunk" was created in r50
and /trunk/README.txt was cherry-picked into it from the / branch
(/trunk is not an ancestor of /trunk). Since Bazaar cannot represent the
cherrypick bzr-svn discards that information.

> I think my approaches are:
> 
>   * bzr branch http://mg.pov.lt/eazysvn/svn eazysvn, followed by
>     bzr rm tags branches; bzr mv trunk/* ./; bzr rm trunk; bzr commit
>       - upside: simple
>       - downside: ugly history
> 
>   * svnadmin dump, tweak the history using svndumpfilter, import into a
>     new svn revision, then convert it with bzr.
>       - upside: clean history
>       - downside: medium amount of effort
>       - upside: I've used svndumpfilter before; can't say I've loved it
> 
>   * bzr branch http://mg.pov.lt/eazysvn/svn eazysvn, then dump the bzr
>     branch into some format (fast-export?), filter it (with sed? perl?),
>     import into a new bzr branch
>       - upside: clean history
>       - downside: medium amount of effort
>       - upside: unfamiliar tools
> 
>   * write a custom conversion script/fork bzr svn-import.
>       - upside: clean history
>       - downside: a lot of effort
This would be tricky to get right, see earlier comments. You might have
more luck patching svn2bzr for something like this.

>   * implement and submit a patch for bzr svn-import to handle
>     mixed-style layouts (I can't be the only one on the planet who
>     tended to start with simple small Svn repositories and later
>     migrated to trunk+tags+branches!)
>       - upside: giving back etc.
>       - downside: even more effort
It's not the mixed layout that is giving problems. It's the fact that
your trunk branch didn't exist before r50. bzr-svn handles layout
changes just fine as long as the branch was copied.

To give an example: It's perfectly possible to have a branch at /foo
that was later renamed to /trunk. bzr-svn will happily import the
history beyond the rename.

>   * convince someone else to implement support of mixed-style svn
>     repositories
>       - downside: I'd have to be very persuasive
See comment above, mixed-style layouts are already supported.

>   * try Tom Widmer's Mercurial recipe, then see about converting to bzr
>     (or stay with hg, it can't hurt to be fluent in more than one DVCS)
>       - upside: simple
>       - downside: not Bazaar
>       - upside: fluency in another DVCS
I doubt Mercurial handles this better. If they do, I'd be interested to
hear in how they represent it as they do not support tracking
cherrypicks either AFAIK.

Cheers,

Jelmer



More information about the bazaar mailing list