I made the mistake of creating a Subversion repository without the usual trunk
, branches
, and tags
directories. That is, the root dire
As the other answers point out, just doing a svn mv into the trunk directory will do this. To then update your working copy, check out the svn switch command.
Can’t you just create the trunk dir and move everything from / to trunk?
Used therefromhere's answer, which worked fine, but wanted to add the commands including the parameters, i.e. as executed on the svn server's command line:
Dump your existing repository into a file:
svnadmin dump /path/to/myrepo/ > /some/dir/myproject.svndump
Create a new repository:
svnadmin create /path/to/mynewrepo/
Add the trunk/
folder and commit it, in the working copy directory:
mkdir trunk; svn add trunk; svn commit trunk -m "Add: trunk folder"
Load the dumpfile into the new repository using trunk
as parent-dir
:
svnadmin load --parent-dir trunk /path/to/mynewrepo/ < /some/dir/myproject.svndump
Quick example of how I did it.
I wanted to move file:///svn/myRepo
to file:///svn/myRepo/trunk
cd /
svnadmin dump /svn/myRepo > my.dump
killall svnserve
sudo rm -r -f /svn/myRepo
svnadmin create /svn/myRepo
svnserve -d -r /svn
svn mkdir file:///svn/myRepo/trunk -m "Created trunk dir"
svnadmin load /svn/myRepo --parent-dir trunk < my.dump
The clean way to do this is using svnadmin to dump out the whole repository using
svnadmin dump
Then create a new repository with the trunk directory at the root, and reload the dump with
svnadmin load --parent-dir trunk
If you do an svn move then that will mess things up if you ever update back to a revision before the move, since the files will move back to their previous location, which is probably not what you want.
You need to create /trunk
and do an svn move of all contents of root inside the trunk and then commit.
After that you'll switch
your working copy to /trunk
.