Dump and load foreign subversion repositories using svnadmin and svndumpfilter

What for ?


This is mostly a reminder for mysef about the way of dumping and loading subversion repositories.

Let's say I have two subversion repositories. repoA and repoB. I got a component called P at the root of repoA as below :
repoA /
P /
trunk /
branches /
tags /
What I'd like todo is to copy P from repoA to repoB preserving all the history logs for P.

Dumping the repository


Let's say I started the developement of P with revision 28000 and my last checkin related to P is at revision 38000. The revision numbers are important because it will decrease the needed time to dump the actual svn repository. Less revisions to dump means less time needed :)

We will use svnadmin to do that.

Go on the server hosting the subversion repository and dump it this way  :
$ svnadmin dump --quiet --revision 28000:38000 /home/svn/repoA > repoA.dump
This operation can last a while depending on the size of your repository.

svnadmin dump options :

$ svnadmin dump --help
dump: usage: svnadmin dump REPOS_PATH [-r LOWER[:UPPER] ] [--incremental]

Dump the contents of filesystem to stdout in a 'dumpfile'
portable format, sending feedback to stderr. Dump revisions
LOWER rev through UPPER rev. If no revisions are given, dump all
revision trees. If only LOWER is given, dump that one revision tree.
If --incremental is passed, then the first revision dumped will be
a diff against the previous revision, instead of the usual fulltext.

Valid options:
-r [--revision] arg : specify revision number ARG (or X:Y range)
--incremental : dump incrementally
--deltas : use deltas in dump output
-q [--quiet] : no progress (only errors) to stderr

Filtering P component from repoA's dump


What we are interested in here is only component P. We need to filter out for P component. We will use svndumpfilter to do that.
$ cat repoA.dump | svndumpfilter include P > P.dump
svndumpfilter options  :
$ svndumpfilter --help
general usage: svndumpfilter SUBCOMMAND [ARGS & OPTIONS ...]
Type 'svndumpfilter help <subcommand>' for help on a specific subcommand.

Available subcommands:
exclude
include
help (?, h)

Loading back P dump to repoB


Now go on the server hosting repoB. Before that, transfer your P.dump to this server. We will use svnadmin to load it back

$ svnadmin load --quiet /home/svn/repoB < P.dump
svnadmin load options :
$ svnadmin load --help
load: usage: svnadmin load REPOS_PATH
Read a 'dumpfile'-formatted stream from stdin, committing
new revisions into the repository's filesystem. If the repository
was previously empty, its UUID will, by default, be changed to the
one specified in the stream. Progress feedback is sent to stdout.
Valid options:
-q [--quiet] : no progress (only errors) to stderr
--ignore-uuid : ignore any repos UUID found in the stream
--force-uuid : set repos UUID to that found in stream, if any
--use-pre-commit-hook : call pre-commit hook before committing revisions
--use-post-commit-hook : call post-commit hook after committing revisions
--parent-dir arg : load at specified directory in repository
Here we are. You just need to remove P from repoA
$ svn remove http://svn.foo.com/repoA/P
Of course, what would be really cool, instead of the dump/load
operations, would be something like that being possible in between foreign repositories
$ svn move https://svn.foo.com/repoA/P https://svn.foo.com/repoB/

Thanks Florent for the pointers.

Important announcement: Join the Nuxeo team and contribute to the Nuxeo project! We have open positions in France and the UK for open source Java EE developers and sales engineers, both junior and senior.

Like this post? Share it:


Trackback Pings

Trackback URL for this entry:
http://blogs.nuxeo.com/sections/blogs/julien_anguenot/2006_04_21_dump-load-svn-repositories-using-svnadmin-svndumpfilter/tbping
Posted by Julien Anguenot @ 04/21/2006 04:48 AM. - Categories: coding, linux -  1 comments

Nuxeo Bloggers: Log in!
Nuxeo - Indesko - Nuxeo 5 Project
All content is copyrighted by their author.
CPSSkins is Copyright © 2003-2006 by Jean-Marc Orliaguet. | CPS is Copyright © 2002-2006 by Nuxeo SAS.