tags:

views:

912

answers:

5

How do I create a branch in subversion that is deeper than just the 'branches' directory?

I have the standard 'trunk', 'tags' and 'branches' structure and I want to create a branch that is several directories deeper than the 'branches' tag.

Using the standard svn move method, it gives me a 'folder not found' error. I also tried copying it into the branches folder, checked it out, and the 'svn move' it into the tree structure I wanted, but also got a 'working copy admin area is missing' error.

What do I need to do to create this?

For the sake of illustration, let us suppose I want to create a branch to go directly into 'branches/version_1/project/subproject' (which does not exist yet)?

+11  A: 
svn copy --parents http://url/to/subproject http://url/to/repository/branches/version_1/project/subproject

That should create the directory you want to put the subproject in (--parents means "create the intermediate directories for me").

Blair Conrad
Doh! Didn't see that in the manual. Still good to have as a reference I suppose.
kaybenleroll
+1  A: 

If you're using TortoiseSVN, you can use its "Repository Explorer" to do such things. Makes it all pretty WYSIWYG simple.

xanadont
+3  A: 

Since subversion doesn't actually think of branches as anything special other than more directories, you can always just create the directory tree you want (with svn mkdir) then copy the code you want into the tree location.

Or just use the --parents flag @BlairC mentioned.

zigdon
+2  A: 

I second the use of TortoiseSVN, simply right-click on the directory and go to TortoiseSVN->Branch/tag... to quickly create a branch at a specified directory. Be sure to fill out the URL to be what you want it to be on the resulting "Copy (Branch / Tag)" dialog window.

Kit Roed
+1  A: 

svn doesn't really manage your branches. It simply does a wholesale copy. It's up to you how you want to manage it.

warsze