5
votes

I have a normal SVN structure:

http://server/DEV/Project/trunk
http://server/DEV/Project/branches

I then branch off with the following command:

svn copy -m "message" "http://server/DEV/Project/trunk@123" "http://server/DEV/Project/branches/rel123"

Everything works great, and the content of /trunk@123 is placed under the new branch path /branches/rel123. All good.

Added : /DEV/Project/branches/rel123 (Copy from path: /DEV/Project/trunk, Revision, 123)

The problem:

If someone accidentally executes the branch off again, I expect it to fail with "svn: E160020: Path 'rel123' already exists". However it does not fail.

Repeating the same svn copy command in-fact copies the /trunk to /branches/rel123/trunk

Added : /DEV/Project/branches/rel123/trunk (Copy from path: /DEV/Project/trunk, Revision, 123)

So now, I end up with /branches/rel123 that contains all the files off the trunk, plus the extra folder "trunk" (/branches/rel123/trunk) that also contains all the same files off the trunk.

I have tried:

I've tried terminating the paths to force SVN to understand this is the absolute directory name, but no luck (i've stripped out http://server part in below examples)

svn copy -m "message" "/DEV/Project/trunk@123/" "/DEV/Project/branches/rel123"
svn copy -m "message" "/DEV/Project/trunk/@123" "/DEV/Project/branches/rel123"
svn copy -m "message" "/DEV/Project/trunk@123" "/DEV/Project/branches/rel123/"
svn copy -m "message" "/DEV/Project/trunk@123/" "/DEV/Project/branches/rel123/"
svn copy -m "message" "/DEV/Project/trunk/@123" "/DEV/Project/branches/rel123/"

Anyone experiencing this? Is this a known issue? Any workarounds to prevent this "branch inside a branch" mistake?

1
I have the exact same problem. And the answer "don't do that" below is not helping. Did you solve this ?Eria
@Eria nope. I control this through strict process now: Jenkins jobs do all the branching/reintegration and I control the Jenkins permissions. But the underlying issue remains unsolvedSlav
Exact same problem here. I have automated creating a tag (svn copy trunk tag/<version>)... and doing that twice should fail, not just create another 'trunk' directory inside an existing tag :(dokaspar

1 Answers

1
votes

It's a feature. It lets you do things like:

svn move *.txt docs

to put all .txt files into a subdirectory.

This mirrors how any shell's "mv" or "move" or "cp" or "copy" or "xcopy" or "robocopy" command works.