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

Re: changing repo layouts

From: Erick Calder <e_at_arix.com>
Date: Sat, 22 Aug 2009 19:09:50 -0700

On Aug 15, 2009, at 10:18 PM, David Weintraub wrote:

> On Sat, Aug 15, 2009 at 1:54 AM, Erick Calder <e_at_arix.com> wrote:
> the structure I want is: /project/trunk, /project/tags, /project/
> branches. I found the --trunk, --branches and --tags options
> available to cvs2svn but from the documentation I could not hope to
> figure out how to use these to build what I want...
> Okay, we converted one project at a time, so the --branches and --
> tags options allowed us to specify the location in the repository
> where we wanted the branches and tags. I am not a Python developer,
> so I didn't bother with the options file. However, I did find this
> piece of information which you might find very handy:
> <http://cvs2svn.tigris.org/faq.html#onetoone>
> Or you do what I did: Write a shell script to convert one project at
> a time, and specify where the trunk, tags, and branches for that
> project would be using the --trunk, --tags, and --branches command
> line options:
> for cvs_module in $CVSROOT/modules/*
> do
> cvs2svn -s $cvs_module-svn --trunk /modules/$cvs_module/trunk --
> branches /modules/$cvs_module/branches --tags /modules/$cvs-module/
> tags
> done

I've struggled to make this work, and have ended up writing a little
tool to flip the hierarchy left by your code above (see comments
below)... so I'm wondering how I could get the mini-HOWTO below into
somewhere that makes sense:

Assuming that the CVS repository to convert lies at $CVSROOT, we first
convert the entire store, project by project, placing it in a
temporary area:

# rm -rf /tmp/cvs-svn
# mkdir -p /tmp/cvs-svn
# for d in $CVSROOT/*
        cvs2svn --encoding=ascii --encoding=iso8859_10 \
                --svnrepos=/tmp/cvs-svn/$m \
                --trunk=$m/trunk \
                --branches=$m/branches \
                --tags=$m/tags \
# rm -rf /tmp/cvs-svn/CVSROOT

notice that cvs2svn takes relative paths for the --branches, --trunk
and --tags. this is implied in the syntax description (via the
default value used) but it would be better explicitly stated.

also, the --encoding is useful when you have non-ascii characters in
the names of your files (in the repository). chose a suitable
encoding as needed.

now create a fresh Subversion repository (and don't forget to create
an account that you can use to move stuff around):

# svnadmin create /var/svn

and import all the projects from the temporary place:

# for p in /tmp/cvs-svn/*; do svnadmin dump $p |svnadmin load /var/
svn; done

at this point we're almost there. nested projects will not be
properly laid out. For example, code for a perl module like
POE::Component::FS::Detect will exhibit the following structure:


when what we'd really like is (since /POE, /POE/Component and /POE/
Component/FS are just placeholders (empty directories) and will never
have branches/tags of their own):


we can fix that by calling the attached script like this (replacing
<user> and <pass> with the account created when the repo was created):

# svnrepo-layout-flip <user>/<pass> prune

the second parameter is optional and will remove empty directories like:


which we don't need.


To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-08-23 04:08:19 CEST

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.