在服务器上强制 svn:eol-style=native? [英] Force svn:eol-style=native on the server?

查看:29
本文介绍了在服务器上强制 svn:eol-style=native?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,为了确保每个添加到我们项目中的新文件的 subversion 属性 eol-style 设置为 native,我们必须将其添加到 eol-stylecode>~/.subversion/config 我们每台开发人员机器上的文件:

Currently, in order to ensure the subversion property eol-style is set to native for each new file added to our project, we have to add this to the ~/.subversion/config file on each of our developers machines:

[miscellany]
enable-auto-props = yes

[auto-props]
*.java = svn:eol-style=native

有没有办法在 svn 服务器上做同样的事情?

Is there a way to do the equivalent on the svn server?

推荐答案

没有没有.

您可以使用钩子脚本来查找要设置或不设置的属性,但除此之外这是不可能的.Subversion 与 CVS 不同,不能更改来自提交的代码内容.

You can use a hook scripts to look for the property to be set or not, but apart from that it's not possible. Subversion, differently than CVS, cannot change the content of the code coming from a commit.

SVN 书籍包含关于 这个问题:

The SVN book includes a note about this question:

不要尝试使用钩子脚本修改事务.一个常见的例子是在提交期间自动设置诸如 svn:eol-stylesvn:mime-type 之类的属性.虽然这看起来是个好主意,但它会导致问题.主要问题是客户端不知道钩子脚本所做的更改,也没有办法通知客户端它已经过时了.这种不一致会导致令人惊讶和意外的行为.

Warning

Do not attempt to modify the transaction using hook scripts. A common example of this would be to automatically set properties such as svn:eol-style or svn:mime-type during the commit. While this might seem like a good idea, it causes problems. The main problem is that the client does not know about the change made by the hook script, and there is no way to inform the client that it is out-of-date. This inconsistency can lead to surprising and unexpected behavior.

与其尝试修改事务,不如在 pre-commit 钩子中检查事务,如果不满足要求则拒绝提交要求.

Instead of attempting to modify the transaction, it is much better to check the transaction in the pre-commit hook and reject the commit if it does not meet the desired requirements.

这篇关于在服务器上强制 svn:eol-style=native?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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