Merge SVN Repositories

r659 | coelho | 2010-01-31 10:01:16 +0100 (Sun, 31 Jan 2010)

NAME - Merge SVN repositories into one, in rev/date order


svn-merge-repos [options] -t repos[/subdir] repos[/ssubdir]:tsubdir...


--help or -h

This help.

--man or -m

More help.

--svn=/path/to/svn or -s cmd

Use this 'svn' command.

--svnadmin=/path/to/svnadmin or -a cmd

Use this 'svnadmin' command.

--svndumpfilter=/path/to/svndumpfilter of -d cmd

Use this 'svndumpfilter' command.

--target=repos_path/subdir or -t path/dir

Path to destination repository, possibly within the specified sub directory. You cannot merge several repositories within the very same destination directory.


Add a 'merge:source' revision property to tell the revision source. Revision property changes must be allowed on the target repos in order to do so.

--verbose or -v

Be verbose. Repeat for more.

--version or -V

Show script revision and exit.


Arguments are of the form 'repos_path/ssubdir:tsubdir'. The source sub-directory 'ssubdir' of the source repository is merged into the specified target sub directory 'subdir/tsubdir' in the target repository.


Revisions are exported and imported thanks to the 'svnadmin' command. This means that an actual filesystem path to the repository is necessary. URL-based subversion repository path will not work.

The sorting is based on revision numbers within a given source, and on dates between different sources. The resulting merged revisions are not fully sorted with respect to dates, as other prior commits in the same repository keep their original dates.

Do not merge big and pretty independent repositories. Consider using 'svn:external' properties prior to merging repositories.

To split a repository, 'svnadmin dump' + 'svndumpfilter include' are your friends.

It is a very bad idea to use the repository while the merge is in progress.

Do not trust hardware. Do not trust software either. Always backup your data, especially before running any automatic thing such as this script.


  sh> -t ./proj ./foo/trunk:proj1 ./bla/trunk:proj2

Merge "trunk" of repositories "foo" and "bla" as subdirectories "proj1" and "proj2" in repository "proj".


All softwares have bugs, this is a software, hence...

The documentation is scarce.

I'm unsure about what happens with svn copies. Just merge your trunk?

Dates are in some timezone. What happens around daylight time changes?

The sorting breaks around year 10000. Shame on me, but I'll be dead by then.



(c) 2006-2010 Fabien COELHO <svn-merge-repos at coelho dot net>

This is free software, both inexpensive and available with sources. The GNU General Public License v3 or more applies (GPLv3+). The brief summary is: You get as much as you paid for, and I am not responsible for anything. See for details.

If you are very happy with this software, I would appreciate if you could send a postcard mentioning it (see my web page for current address).


The latest version of the script is available at


Subversion at

svndumptool at, by Martin Furter: a set of python classes and a command to manipulate svn dump files. Although it may be less straightforward, it should do a better job especially if you want to reorganize 'branches' and 'tags' directories.

svnfusion at by Marcos Mayorga: a bash script which merges full repositories, with few options available.


This documentation is about $Revision: 659 $ of the script.