[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Copying a part of another repository, *with* its history

From: Kevin Grover <kevin_at_kevingrover.net>
Date: Tue, 6 May 2008 09:04:11 -0700

On Tue, May 6, 2008 at 8:16 AM, Stephane Bortzmeyer <bortzmeyer_at_nic.fr>
wrote:

> I have a repository where I would like to include a subtree of another
> repository, ***with its history***. I do not know if it is compatible
> with the Subversion model (unique revision number, atomic commits,
> etc). I find no solution in The Book or in the FAQ.
>
> The obvious solution is not accepted:
>
> % svn copy svn+ssh://bortzmeyer@foobar.example.com/home/bortzmeyer/one/two
> https://svn.nic.fr/ReD-AFNIC/Etudes
> svn: Source and dest appear not to be in the same repository (src:
> 'svn+ssh://bortzmeyer@foobar.example.com/home/bortzmeyer/one/two'; dst: '
> https://svn.nic.fr/ReD-AFNIC/Etudes')
>
> I tried the svnadmin dump + load way but I cannot find the right
> combination.
>
> % svnadmin dump /home/bortzmeyer/one > tmp/svn
> % svndumpfilter include /two < tmp/svn > tmp/svn-filtered
> % svnadmin load --parent-dir /ReD-AFNIC/Etudes /var/lib/svn <
> tmp/svn-filtered
>
> But svnadmin load fails:
>
> ...
> <<< Started new transaction, based on original revision 4
> svnadmin: File not found: transaction '92-1', path '/ReD-AFNIC/Etudes/two'
> * adding path : ReD-AFNIC/Etudes/two ... %
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: users-help_at_subversion.tigris.org
>
>

You can do it. But, it requires some work.

You 'svnadmin dump' the source repository (and filter out the paths you
want). Then, you 'svnadmin load' those paths into the new repository.

The tough points are:
1) You may have to edit the dump file to get the paths to be what you want
in the destination repository
2) You have to be careful about which directories exist and which need to be
created

To prevent accidentally editing the 'old' source, you should 'svn delete'
the path from the source repository after successfully migrating it.

Tools: svndumpfilter (comes with CLI svn install), svn_load_dir.pl (and
there's also a newer re-implementation in python, call svnload.py (I think).

I've done this when I have a directory in my test repository that I want to
'promote' to it's own repository. I had to fight to get the initial
directories right.

NOTE: if you have merges or anything that depended on version number in the
source repository, they will not be correct in the destination repository.

Sorry about the lack of details, hopefully this is enough of a pointer to
move you in the right direction. My biggest problems were 1) re-mapping
directories; and 2) making sure leading directories where created ONLY if
needed.

- Kevin
Received on 2008-05-06 18:04:36 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.