Here’s the scenario:
You have this really cool idea of an OSS project and you have already coded some of its source, though not stable enough for release you’d decided to create and uploaded it on Google Code repository to track the development history. “Trunk tree should only have the stable source”, with this in mind you’d decided to create a branch directory (/1.0) and upload your unstable source in there. After days of hacking and cracking, you finally have a source candidate for the trunk tree. So, how do you copy your candidate branch to the empty trunk?
Remember that when you create a new project on Google Code, your initial repository will already have a branches, tags, and trunk tree.
Using “svn merge” will not do, because you still have an empty trunk.
But how about “svn copy“?
> svn copy https://your-project.googlecode.com/svn/branches/1.0 \
https://your-project.googlecode.com/svn/trunk/
That wouldn’t do either. Yes it’ll copy all the files and directories inside the “/branch/1.0” directory but it’ll include the “/1.0” directory. Meaning the end result will be “/trunk/1.0“.
https://your-project.googlecode.com/svn/trunk/1.0
You don’t want that, do you? Remember that Trunk directory should always contain the latest and stable source. So the “/1.0” directory will be inappropriate. What you wanted to achieve in your project repository tree, is to look like this:
- /svn/branches
- /1.0
- source.file.1
- source.file.2
- /tags
- /trunk
- source.file.1
- source.file.2
Solution
The way to do this (without temporarily deleting the trunk directory) is to first, checkout the candidate branch, change working directory and import.
- Checkout the candidate/stable branch:
> svn co https://your-project.googlecode.com/svn/branches/1.0 branch-1.0
> cd branch-1.0
- Import to the empty trunk:
> svn import https://your-project.googlecode.com/svn/trunk \
-m 'Stable source from branches/1.0, revision 26.'
Pros: Quick and easy, without deleting the current trunk tree.
Cons: What happened on the branch (history) stays on the branch.
Got another solution? I’d love to hear from you.