windows Subversion 自动道具问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/323462/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:39:51  来源:igfitidea点击:

Subversion auto-props woes

windowssvntortoisesvnvisualsvnankhsvn

提问by Rob

This is driving me nuts so any advice from fellow users would be welcome. I am using Subversion, with a copy of VisualSVN 1.6.1 installed on a Windows server. On my PC I am using a combination of TortoiseSVN and the wonderful AnkhSVN Visual Studio plugin. Everything works like a dream, but now I am trying use the svn:keywordsfeature so I can include $Id$at the top of all my source files. Now, for existing files I can edit the SVN properties and add this keyword and it all works fine, but I want this done automatically for new files - and I cannot make it work.

这让我发疯了,所以欢迎来自其他用户的任何建议。我正在使用 Subversion,在 Windows 服务器上安装了 VisualSVN 1.6.1 的副本。在我的 PC 上,我结合使用 TortoiseSVN 和出色的 AnkhSVN Visual Studio 插件。一切都像做梦一样,但现在我正在尝试使用该svn:keywords功能,以便我可以将其包含$Id$在所有源文件的顶部。现在,对于现有文件,我可以编辑 SVN 属性并添加此关键字,并且一切正常,但我希望为新文件自动完成此操作 - 但我无法使其工作。

According to the documentation you need to edit a special Subversion Config file located in your C:\Documents and Settings\<user>\Application Data\Subversionfolder. My PC already had a copy of this file, so I changed it to look like this:

根据文档,您需要编辑位于C:\Documents and Settings\<user>\Application Data\Subversion文件夹中的特殊 Subversion 配置文件。我的电脑已经有这个文件的副本,所以我把它改成这样:

[miscellany]
enable-auto-props = yes

[auto-props]
*.cpp = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.hpp = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.rc = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.rc2 = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.cc = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.c = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.h = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.wsf = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.js = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.htm = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.html = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.css = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision

I then added a new file to an existing Visual Studio project (from within Visual Studio), added $Id$to the top and committed it - but, alas, the svn:keywordsproperty is not being set.

然后我将一个新文件添加到现有的 Visual Studio 项目(从 Visual Studio 中),添加$Id$到顶部并提交 - 但是,唉,svn:keywords没有设置该属性。

Does anyone know how to get this working? I even tried adding settings to the registry (in HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config) but still no joy. I then tried messing with Config files on the SVN server itself, but nothing seems to work.

有谁知道如何让这个工作?我什至尝试将设置添加到注册表(在HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config),但仍然没有乐趣。然后我尝试弄乱 SVN 服务器本身上的配置文件,但似乎没有任何效果。

I have obviously missed something blindingly obvious!

我显然错过了一些非常明显的东西!

采纳答案by Rob

You're right, the issue lies with AnkhSVN. The keywords properties will not be automatically added if the new file is added in Visual Studio (with AnkhSVN 2.0.5250). It will only be added if you add the file using Tortoisvn.

你是对的,问题在于 AnkhSVN。如果在 Visual Studio(使用 AnkhSVN 2.0.5250)中添加新文件,则不会自动添加关键字属性。仅当您使用 Tortoisvn 添加文件时才会添加它。

I downloaded a trial version of VisualSVN (plugins to Visual Studio). It does not have this issue. Properties are automatically added to new files added in Visual Studio.

我下载了 VisualSVN 的试用版(Visual Studio 插件)。它没有这个问题。属性会自动添加到 Visual Studio 中添加的新文件中。

回答by LenW

It seems that the answer is just some silly quotes around the actual keywords :)

似乎答案只是围绕实际关键字的一些愚蠢的引用:)

[auto-props]
*.cpp = svn:eol-style=native;svn:keywords="Author Date Id HeadURL Revision"

回答by schnaader

If you want to be sure you've picked the correct config file, use TortoiseSVN's edit button: Subversion Wiki.

如果您想确保您选择了正确的配置文件,请使用 TortoiseSVN 的编辑按钮:Subversion Wiki

The only similar problem I could find was a user complaining about this not working with uppercase file extensions, but this is for Fedora, not for Windows: link

我能找到的唯一类似问题是用户抱怨这不适用于大写文件扩展名,但这适用于 Fedora,而不适用于 Windows:链接

回答by Rob

This seems to be an issue with AnkhSVN. I did some tests outside of Visual Studio, using TortoiseSVN to add the files, and it started working (using my user config file). I will try the latest AnkhSVN to see if this makes any difference.

这似乎是 AnkhSVN 的问题。我在 Visual Studio 之外做了一些测试,使用 TortoiseSVN 添加文件,然后它开始工作(使用我的用户配置文件)。我将尝试最新的 AnkhSVN,看看这是否有什么不同。

I'd prefer to have this done at the server end, but this seems to be user-specific.

我更愿意在服务器端完成这项工作,但这似乎是特定于用户的。

Either way, thanks for the pointers Len and schnaader.

不管怎样,感谢 Len 和 schnaader 的指点。