Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy twice causes branch inside a branch instead of error

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?

like image 651
Slav Avatar asked Nov 11 '22 03:11

Slav


1 Answers

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.

like image 168
Ben Avatar answered Nov 15 '22 07:11

Ben