Why am I able to create the same SVN branch twice?

落爺英雄遲暮 提交于 2019-12-24 10:45:46

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/333785/why-am-i-able-to-create-the-same-svn-branch-twice

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!