One of our old faithful deployment machines at work got reinstalled and we upgraded SVN from version 1.4.3 to 1.4.6

However the data was incompatible, so we had to run the following commands in order:-

for every folder:-

Take a dump of that path and redirect the output to a temporary path and preserve the relative heirarchy.
Delete the Files under the Path
ReCreate the following frompath which just got deleted
Load this frompath with data from the temporary File Path

And thats it. It can all be done using svncopy.py Since I dont have an online CVS or SVN account, I’ll paste the code here.

I recommend you to look at the code and comment out the lines that you want to comment out. I bear no responsiblity in case anything goes wrong. Please backup the folder if you fear data loss.

Disclaimer: The following code is being released to the public with no strings attached.
However I do not take responsiblity in any way for the side effects of using this code.

Contributed by : Afrobeard

import os;
import dircache;
from optparse import OptionParser;

def fixpath(path):
path = path.replace('\\', '/').replace('//', '/');
path = path.replace('\\', '/').replace('//', '/');

if path == '.':
elif path == './':
path = '.';
elif path.startswith('./'):
path = path[2:]
if path.startswith('/'):
path = path[1:];
if path.endswith('/'):
path = path[:-1];
return path;

def runcmd(cmd):
print cmd

parser = OptionParser()
parser.add_option("-f", "--from", dest="frompath",
help="From Path. Will be deleted later on")
parser.add_option("-t", "--to", dest="topath",
help="To Path.")

(options, args) = parser.parse_args()

options.frompath = fixpath(options.frompath)
options.topath = fixpath(options.topath)


dumpcmd = 'svnadmin dump "'+options.frompath+'/%s" > "'+options.topath+'/%s"'
rmcmd = 'sudo rm -Rf "%s"'
createcmd = 'svnadmin create "' + options.frompath + '/%s"'
loadcmd = 'svnadmin load"' + options.frompath + '/%s" 2:
elif len(os.path.join(root,name).split('/')) > 2:
print os.path.join(root,name)
print name

#1. Taking the DUMP
runcmd(dumpcmd % (name, name))

#2. Removing the from folder
runcmd(rmcmd % name)

#3. Creating the Path into the repository
runcmd(createcmd % name)

#4. Loading contents
runcmd(loadcmd % (name, name))