Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a clean way to move / to /trunk?

Tags:

svn

I made the mistake of creating a Subversion repository without the usual trunk, branches, and tags directories. That is, the root directory of the project maps to the root directory of the repository. Now I want to create a feature branch, but there's no good place to put it. What I'd like to do is move / to /trunk, preserving its properties and history. Am I out of luck?

like image 517
Adam Siler Avatar asked May 02 '10 14:05

Adam Siler


2 Answers

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.

like image 156
John Carter Avatar answered Sep 23 '22 16:09

John Carter


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:

  1. Dump your existing repository into a file:

    svnadmin dump /path/to/myrepo/ > /some/dir/myproject.svndump 
  2. Create a new repository:

    svnadmin create /path/to/mynewrepo/ 
  3. Add the trunk/ folder and commit it, in the working copy directory:

    mkdir trunk; svn add trunk; svn commit trunk -m "Add: trunk folder" 
  4. Load the dumpfile into the new repository using trunk as parent-dir:

    svnadmin load --parent-dir trunk /path/to/mynewrepo/ < /some/dir/myproject.svndump 
like image 34
Wolfram Avatar answered Sep 20 '22 16:09

Wolfram