How to migrate all URLs in svn:externals properties across a repository?

Nik Reiman picture Nik Reiman · Oct 15, 2008 · Viewed 8.7k times · Source

We are in the process of moving our SVN repositories from one machine to another one, and with it will come a new domain name for the new repo. The problem is, that within the repository, there are lots of svn:externals references to other projects within the repository. So for example, we have projectA, which has in the svn:externals properties:

external/libraryA svn://oldserver.net/repo/libraryA
external/libraryB svn://oldserver.net/repo/libraryB

...and so on. All of the URL's reference this particular domain name, so it can be easily parsed. Having already learned my lesson, I will migrate these URLs to be "svn://localhost/", but I need to find a way to go through the repository history and rewrite all of the old URLs, so that we can still check out older revisions of these projects without having broken links.

How would I go about doing this?

Answer

ldav1s picture ldav1s · Aug 19, 2010

I'd use SvnDumpTool for this. It has exactly what you're looking for:

svndumptool transform-prop svn:externals "(\S*) (|-r ?\d* ?)http://oldserver.net(/\S*)" "\2\3 \1" source.dumpfile source-fixed-externals.dumpfile

This fixes up each external to the subversion 1.5 format, and uses relative URLs.

So svn:externals like:

external/libraryA svn://oldserver.net/repo/libraryA

become:

 /repo/libraryA external/libraryA

using server root relative URLs.