在工作中,我刚刚开始使用 Subversion 和 AnkhSVN,而不是 Visual Source Safe。我设法将其整合得足够好,但看起来并不一样。
使用 VSS 会发生以下情况:
用户通过右键单击并选择“签出”或编辑文件来签出文件。如果另一个用户尝试修改同一文件,他会收到错误消息。没有 2 个用户可以同时编辑同一个文件。没有花哨的合并。没有冲突,也没有冲突解决方案。
我知道 Subversion 背后的理念是不同的,但是有什么方法可以用 Subversion 复制上述行为吗?
AnkhSVN 中有一个名为“更改时自动锁定文件...”的选项,但即使我在编辑文件时激活此选项,它也不会自动锁定。
即使此选项有效,其他用户在提交文件之前也不会看到锁定。当他们尝试像在 Visual Source Safe 中那样编辑它时,不会收到错误。
基本上来说:可以使用 Subversion 和 AnkhSVN 复制 Visual Source Safe 的行为吗?
At work I just started using Subversion with AnkhSVN instead of Visual Source Safe. I managed to integrate it well enough but it doesn't seem the same.
Using VSS the following would happen:
A user check out a file by right clicking and selecting "check out" or by editing it. If another user tried to modify the same file he would get an error. No 2 users could edit the same file at the same time. No fancy merging. No conflicts and no conflict resolutions.
I understand the the philosophy behind Subversion is different but is there any way that this behavior described above could be duplicated with Subversion?
There is an option in AnkhSVN called "Automatically lock files on change..." but even if I activate this option when I edit a file it never gets automatically locked.
Even if this option worked the other users wouldn't see the lock until they commited the file. They wouldn't get an error when they tried to edit it like they would in Visual Source Safe.
So basically: can Visual Source Safe's behavior be duplicated using Subversion and AnkhSVN?
发布评论
评论(3)
使用 subversion over source safe 的要点是,您没有拥有独占锁,并且许多人可以处理同一个文件。
如果您开始使用文件上的独占锁来使用 SVN,您将失去 SVN 的很多好处。
这个想法是解决代码合并期间的冲突。
请参阅这个 SO问题和答案进行一些讨论问题(
修订控制锁定:还没有定论吗?
)。The point of using subversion over source safe is that you don't have exclusive lock and many people can work on the same file.
You are loosing quite a lot of the benefits of SVN if you start using it with exclusive locks on files.
The idea is that you fix conflicts during merges of code.
See this SO question and answers for a bit of a discussion on the issues (
Revision control locking: Is the jury still out?
).Agent SVN 是 Subversion 的 MS-SCCI 插件(就像 VSS),因此它与 Visual Studio 集成就像VSS一样。
它还有一个锁定签出选项,有了这个功能,它确实感觉很像 VSS。
The Agent SVN is a MS-SCCI plugin (just like VSS) for Subversion so it integrates with Visual Studio just like VSS.
It also has a Lock on check out option and with that feature on it does feel a lot like VSS.
您需要在要显式锁定的文件上设置
svn:needs-lock
subversion 属性。实际上仅建议用于无法轻松合并的文件,例如(大多数)二进制文件,而不是文本/代码文件。通常文本/代码文件会自动合并得很好,当它们不发生冲突时通常很容易解决。在设置了 svn:needs-lock 属性后,当您尝试编辑文件时,AnkhSVN 会要求您锁定文件(与 VSS 中的签出相同)。如果启用“自动锁定文件”功能,锁定对话框将被抑制,您将锁定文件而不显示对话框。
Svnbook 解释了 lock-modify-unlock 和复制修改合并,以及svn:needs-lock 行为
You need to set
svn:needs-lock
subversion properties on the files that you want to explicitly lock. It's really only recommended for files that cannot be easily merged, like (most) binary files and not on text/code files. Usually text/code files merge great automatically, and when they don't conflicts are usually easy to solve.AnkhSVN will ask you to take lock the file (same as checkout in VSS) when you attempt to edit it when the
svn:needs-lock
property is set. If you enable the "Automatically lock files" feature, the lock dialog is suppressed, and you will take a lock on the file without a dialog showing up.Svnbook explains the differences between a lock-modify-unlock and copy-modify-merge, and the svn:needs-lock behavior is also described