tags:

views:

979

answers:

4

I'm a newbie with Subversion, so I don't now if this is a dumb question:

I've inherited a subversion repository with a flat structure ( no trunk/tags/branches top level).

I'd like re-structure it so that it follows the

/trunk /tags /branches

layout.

Is this possible?

A: 

Yes. Just make the desired top level structure, add those directories with svn add. Do a checkin (svn ci) and then move stuff to the desired places with svn move. The checkin in the middle may not even be necessary, but that's they way I'd do it.

rz
A: 

Yes. Just use the svn move command!

flukus
+2  A: 

I think "svn move" can operate on directories within the repository, so you shouldn't need to check out or check in anything.

JoelFan
+6  A: 

Especially if you're using Subversion 1.4, see this answer for an alternative:

svn: replace trunk with branch.

Otherwise, move is the simplest way to achieve the restructuring. As @JoelFan said, move will work on directories, so you can perform this operation without a working copy:

svn mkdir --quiet --message "Restructuring" http://svnhost/svnrepos/trunk
svn mkdir --quiet --message "Restructuring" http://svnhost/svnrepos/tags
svn mkdir --quiet --message "Restructuring" http://svnhost/svnrepos/branches

then, appropriate move commands for your sources:

svn move --message "Restructuring" http://svnhost/svnrepos/dir01 http://svnhost/svnrepos/trunk/dir01

Note: If the existing repository has a structure like:

/repos
    /projectA
        /branches
        /tags
        /trunk
    /projectB
        /branches
        /tags
        /trunk

I'd suggest leaving it that way - it would make separating the projects into separate repositories very straightforward if for some reason you need to do so.

Ken Gentle