Thursday, December 3, 2009

Fixing an existing subversion project to migrate to the trunk/branches/tags convention

Here's the procedure I used to move an existing "dumb" subversion project to one that follows the subversion convention (trunk/branches/svn). It's a combination of the two ideas presented in the articles below. More steps then I was hoping for, but it's a pretty simple-to-follow solution and much less aggravating than the Eclipse approach.

(this procedure assumes that you are using Linux, but the process would be similar on Windows or Mac)

// 1. Checkout a fresh copy of your project
$ svn co myproject

// 2. Change directories to make it easier perform svn operations
$ cd myproject

// 3. Add the new trunk directory
$ svn mkdir trunk

// 4. Locate all files/dirs in the current directory and svn move them to the trunk directory
$ find . -maxdepth 1 ! -name trunk -exec svn mv '{}' trunk \;

// 5. Double check that all files have been svn move'd (.classpath, .project, build.xml, etc)
$ ls -la trunk

// 6. Commit all changes
$ svn ci -m "myproject: moving all files from myproject into myproject/trunk"

// 7. Switch your local copy of the module to
$ svn switch myproject


No comments: