为什么我可以两次创建相同的SVN分支? [英] Why am I able to create the same SVN branch twice?

查看:81
本文介绍了为什么我可以两次创建相同的SVN分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够创建相同的SVN分支两次。我希望SVN不允许我再次创建相同的分支。请帮助我解决此问题。

解决方案

来自 SVN红皮书


Subversion没有分支的内部概念,它只知道如何制作副本。复制目录时,结果目录只是一个分支,因为您将其附加了该含义。您可能会以不同的方式考虑目录,或者以不同的方式对待目录,但是对于Subversion而言,它只是一个普通目录,恰好带有一些额外的历史信息。


由于这种复制机制,Subversion的分支存在作为存储库中普通文件系统目录。


因此,当您创建分支补丁时,您的存储库中可以有多个目录补丁。 / p>

在区分大小写的OS中,在相同的父目录补丁中创建两次,使用不同的大小写(补丁与补丁)时,您可能会感到困惑。




为了更好地回答您的问题:


我希望SVN不允许我创建


如果您确实想防止任何与案例相关的路径冲突,则可以设置一个 pre-commit钩子(也是由svn副本触发),就像这样,来自 svn工具贡献


不区分大小写。py



  • 检测与现有或其他新路径冲突的新路径。

  • 忽略已冲突的现有路径

  • 退出并显示错误代码,并在stderr上进行诊断,如果检测到冲突。


使用该钩子,您仍然可以创建多个具有相同名称但至少不在同一父目录中且具有不同大小写的分支。


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.

解决方案

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.

这篇关于为什么我可以两次创建相同的SVN分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆