I've also begun some serious repository conversion from CVS to Subversion. Pretty slick, but I've had to write a few scripts to deal with oddities. I've opted not to create a separate subversion repository for each of my projects (way too much overhead there) and instead am just using a single repository. I figure if something grows too big (or needs to be shared) that I will simply dump the data out and then import it into the new repository.
The structure I've chosen has, at a high level, a partitioning scheme based on the type of thing being stored. For instance, I have java-devel, unix-devel, and server-config at this time. Under each of these is the typical trunk/tags/branches directories. Under that exists whatever structure makes sense. java-devel is organized as Eclipse proejcts, server-config is organized by servers (which is now down to one), and unix-devel has files just dumped into trunk. I don't do too much Unix development anymore. :-/
Anyway, the partitioning scheme seems to make cvs2svn barf with an error. I've opted instead to use cvs2svn to create a dumpfile which gets tweaked and then loaded in via svnadmin. Just incase it's useful to others, here's a current copy of the script:
#!/bin/bash
# Import CVS projects into new SVN repository in my weird structure...
# /Grouping/trunk/Project/...
# tags/Project/...
# branches/Project/...
# Usage:
#
GROUPING="$1"
PROJECT="$2"
if [ -z "$GROUPING" -o -z "$PROJECT" ]
then
echo "Please include both the project grouping and the CVS project name."
exit 1
fi
# Dump out the project...
/usr/local/cvs2svn/cvs2svn --dumpfile=/tmp/${PROJECT}.dump --trunk=trunk/${PROJECT} --tags=tags/${PROJECT} --branches=branches/${PROJECT} /home/cvsroot/${PROJECT}
# We need to drop the trunk/branches/tags directory creation as they are
# already present, hence the gawk script.
cat /tmp/${PROJECT}.dump | gawk '
BEGIN {
ignore = 0;
}
{
if ($0 == "Node-path: trunk" || $0 == "Node-path: branches" || $0 == "Node-path: tags") {
ignore = 5;
}
if (ignore > 0) {
ignore--;
} else {
print $0;
}
}' | svnadmin load --parent-dir ${GROUPING} /home/svnroot/general

No comments:
Post a Comment