Like a lot of people (I think/maybe/probably/noobs), I was in a hurry when I created the svn repository for my current project and didn't bother setting up trunk, branches, and tags subdirs. Now, I regret it, because I am suddenly interested in branching.
This is all very scary, because we're in the middle of testing an app that is supposed to go to the client at the end of the week. If I break this, I screw up our beta testing for everyone. So, I was a bit nervous.
I found the following forum posting, though, and it was very helpful:
In a nutshell, I did everything recommended on the forum:
- Set up a sandbox somewhere to check out the files. I'm on Linux (and this assumes you are, too), so I just logged onto a server to which I had access and went straight home. (I was already in home upon logging in via ssh, but you can just do this: cd ~)
- Check out the current head: svn checkout https://path/to/project (you're on your own for this, since I don't know where your repos lives)
- Alternatively, you could check it out to a specific directory: https://path/to/project somedir (specifying 'somedir' as the new directory to which to check the files)
- Go into the directory (either 'somedir' or the default, if you didn't provide the 'somedir' directory): cd somedir
- Now, make your new trunk directory: svn mkdir trunk (actually type 'trunk' if that's what you want to call your trunk)
- Use a little ol' shell script to loop through the existing files, doing svn mv on each one: for f in *; do svn mv $f trunk; done
- Now, all of your files are actually svn deleted (scary) from the original location and svn added to the new place (trunk)
- You can safely create branches and tags dirs, now. Doing it before would have resulted in them being moved to trunk, I think: svn mkdir branches tags
- Now, commit your changes: svn commit -m "moved files into trunk; created branches and tags dirs"
Not too bad. It seems to have worked without a hitch. I used svn switch on my working repository so that I could continue working on the relocated trunk. (I'm using Subclipse, so I just did it in Eclipse.) Now all I have to do is go onto the test server and do an svn switch to get it pointing at the new repos there, and I should be done. Cross your fingers, and good luck!
No comments:
Post a Comment