tags:

views:

257

answers:

2

I am able to create the same SVN branch twice. I would hope that SVN would not allow me to create same branch again. Please help me to fix this issue.

+10  A: 

From SVN RedBook:

Subversion has no internal concept of a branch—it knows only how to make copies. When you copy a directory, the resultant directory is only a “branch” because you attach that meaning to it. You may think of the directory differently, or treat it differently, but to Subversion it's just an ordinary directory that happens to carry some extra historical information.

Because of this copy mechanism, Subversion's branches exist as normal filesystem directories in the repository.

So when you create a branch 'patch', you can have several directories 'patch' within your repository.

What may confuse you is when you create in the same parent directory 'patch' twice, with a different case (Patch vs. patch), in a case-sensitive OS.


To better answer your question:

I would hope that SVN would not allow me to create same branch again.

If you really want to prevent any "case-related path clash", you can set a pre-commit hook (which is also triggered by a svn copy), like this one, from svn tools contrib

case-insensitive.py:

  • Detects new paths that 'clash' with existing, or other new, paths.
  • Ignores existing paths that already 'clash'
  • Exits with an error code, and a diagnostic on stderr, if 'clashes' are detected.

With that hook, you can still create several branches with the same name, but at least not in the same parent directory, with a different case.

VonC
A: 

In SVN, branches (and tags too) are only copies.

SVN has no idea of what a branch is, it only knows about copies. SVN users give to those copies the meaning of branches, but it's only a convention followed by the people, not by SVN.

Davide Gualano