简体   繁体   English

冲突文件的SVN预提交钩子

[英]SVN pre-commit hook for Conflicted files

I have a file named test.txt . 我有一个名为test.txt的文件。
When ever file conflict occurs. 每当发生文件冲突时。 we get 4 files eg 我们得到4个文件,例如

test.txt
test.txt.min
test.txt.r1
test.txt.r2

In test.txt we get some text like test.txt我们得到一些类似的文本

<<<<<<< .mine
>>>>>>> .r2

So my question is that 所以我的问题是
Is there a way to prevent user to commit the conflicted file? 有没有一种方法可以防止用户提交冲突的文件?
I mean, 我的意思是,

  • User cant commit a file containing text <<<<<<< .mine >>>>>>> .r2 用户无法提交包含文本<<<<<<< .mine >>>>>>> .r2的文件

  • User cant commit some extra files created 用户无法提交一些创建的额外文件

    I am using tortoiseSVN with visualSVserver in Windows 我在Windows中将TortoiseSVN与visualSVserver一起使用

The Easy way : 简单方法

This problem seems easily solvable by software(eg a hook script), however the real problem will be worse(believe me, I implemented it once for a customer!). 这个问题似乎可以通过软件(例如挂钩脚本)轻松解决,但是真正的问题会更糟(相信我,我为客户实施过一次!)。 Your people will start to remove the conflict markers and will rename these files to unmatch your regex in your hook script resulting in flooding your repository with all kind of conflicted files. 您的人员将开始删除冲突标记,并将重命名这些文件以使其与钩子脚本中的正则表达式不匹配,从而导致存储库中充斥所有类型的冲突文件。 Worse than that: Nobody can reconstruct the underlying conflicts as the conflict markers are gone! 更糟糕的是:随着冲突标记的消失,没人能重建潜在的冲突!

The correct way : 正确的方法

You should explain your users how this conflicts occur. 您应该向用户说明这种冲突是如何发生的。 If they are happening very often, usually another (external) problem is responsible(bad software design, no team communication, etc.). 如果它们经常发生,通常会引起另一个(外部)问题(软件设计不良,没有团队沟通等)。 SVN forbids to commit a conflicted file. SVN禁止提交有冲突的文件。 You should show how to resolve this conflict. 您应该展示如何解决此冲突。 In standard SVN usecases conflicts are not a big issue (except on merging) 在标准SVN用例中,冲突不是大问题(合并时除外)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM