简体   繁体   English

SVN防止无锁提交?

[英]SVN prevent commit without lock?

I need to prevent users from committing one specific file under svn unless they got a lock for it. 我需要防止用户在svn下提交一个特定文件,除非他们对此有锁。 I used the svn:needs-lock property and it does what I want, but there is a limitation there - users cannot edit the file locally for testing purposes. 我使用了svn:needs-lock属性,它可以实现我想要的功能,但是这里有一个限制-用户不能出于测试目的在本地编辑文件。 These are model (DevEx - xml) files, and while merging them is a giant pain (hence the need for a lock) I'd like to give the users the ability to modify the file locally, but prevent them from checking it in without getting a lock. 这些是模型(DevEx-xml)文件,虽然合并它们是一个巨大的痛苦(因此需要锁定),但我想让用户能够在本地修改文件,但要防止他们在没有文件的情况下检入得到锁。

Can it be done? 能做到吗 How? 怎么样?

The purpose of a lock in Subversion isn't strictly to prevent users from committing - it's to help prevent users from locally editing a file that can't be merged when they perform an update later. 锁定Subversion的目的并不是严格防止用户提交,而是防止用户本地编辑一个文件,这些文件以后执行更新时无法合并。

SVN locks are there to facilitate communication between users - they are not intended to be an airtight "this is locked down" system. SVN锁在那里可以促进用户之间的通信-它们并不是要成为不透气的“此锁”系统。 If you're having frequent issues with developers conflicting over these locks, you need better communication between them. 如果开发人员经常遇到与这些锁冲突的问题,则需要在它们之间进行更好的通信。

If your users really need to edit the file locally without taking a lock, they can remove the read-only attribute on their local copy manually - as long as they understand the ramifications of doing so (they won't be able to update/merge until they revert their local changes). 如果您的用户确实确实需要在不锁定的情况下在本地编辑文件,则他们可以手动删除其本地副本上的只读属性-只要他们了解这样做的后果(他们将无法更新/合并)直到他们revert本地更改)。

An alternative would be to make your model a "template" and require users to make local copies for their editing purposes. 一种替代方法是使模型成为“模板”,并要求用户出于编辑目的制作本地副本。 Then lock, update and commit the template when they're done with their changes and are ready to share with others. 然后,在完成更改并准备与他人共享时,锁定,更新并提交模板 See the Subversion FAQ for more . 有关更多信息,请参见Subversion FAQ But you'll still have a merge issue to contend with. 但是您仍然需要解决合并问题。 Again, communication is the solution here, not software. 同样, 通信是解决方案,而不是软件。

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

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