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

Splitting out project from repo

From: Jonathan Petersson <jpetersson_at_automattic.com>
Date: Fri, 1 Mar 2013 19:15:32 +0100

I've a repository that's grown incredibly big and we're going to start
breaking out each project in the repo to separate repos. However I've
ran into a couple of issues in regards of Node-copyfrom-rev which
doesn't match up properly upon dump/load resulting in the following:

svnadmin: E160006: Relative source revision -18169 is not available in
current repository
svnadmin: E160013: File not found: transaction '37-1c', path
'tags/1.6.1/file.php'

I've done some efforts to rewrite the dump-files and
revision-definitions but it doesn't seem to match up properly making
it hard to automate the process. Any suggestions of changes are
welcome, please notice however that using svndumpfilter isn't really
an option due to the size of the repo it takes hours to break out just
a single project and this repo contains several thousand.

#!/bin/bash

project=$1
repo=/root/svn-copy/oldrepo
rm -fr $project*
mkdir $project
cd $project
svnadmin create $project
i=1
svn log file://$repo $project | grep -e ".*r[0-9].*|.*" | awk '{ print
substr($1,2) }' | sort -g | while read rev; do
    revs[$rev]=$i
    svnadmin dump $repo --quiet -r $rev --incremental >> $project.$rev.bak

# Rewrite revision number to ease rewrite of Node-copyfrom
perl -pi -e "s/Revision-number: $rev/Revision-number: $i/;" $project.$rev.bak
# Rewrite node-paths
perl -pi -e "s/Node-path: $project\//Node-path: /;" $project.$rev.bak
# Rewrite Node-copyfrom-path
perl -pi -e "s/Node-copyfrom-path: $project\//Node-copyfrom-path: /;"
$project.$rev.bak

# Rewrite Node-copyfrom-rev
for rev in $(grep Node-copyfrom-rev $project.$i.bak | awk '{ print $2 }'); do
    perl -pi -e "s/Node-copyfrom-rev: $rev/Node-copyfrom-rev:
${revs[$rev]}/;" $project.$i.bak
done

# Remove prop for old project-folder
sed -i "/Node-path: $project/,/PROPS-END/d" $project.$rev.bak

svnadmin load --ignore-uuid $project < $project.$rev.bak
    let i=$i+1
    rm -fr $project.$rev.bak
done

svnadmin setuuid $project

Please notice that the rewrite of the revision-numbers has mitigated
the node-copyfrom-rev somewhat but not entirely as it seems like
node-copyfrom-repo points incorrectly sometimes when dumping this way.

Best
Received on 2013-03-01 19:17:42 CET

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.