简体   繁体   English

如何在svn:ignore值中指定负模式

[英]How do I specify a negative pattern in an svn:ignore value

I'm using SVN as my VCS. 我正在使用SVN作为我的VCS。 I have a folder where I keep user-uploaded files. 我有一个文件夹,我保存用户上传的文件。 Obviously I don't need those under version control. 显然我不需要那些受版本控制的人。 However, there is a single file in the folder, which I need - .htaccess. 但是,文件夹中有一个文件,我需要它 - .htaccess。

It's already under version control, but how do I specify that I need all other files besides .htaccess ignored in that folder? 它已经受版本控制,但如何指定除了该文件夹中忽略的.htaccess之外我还需要所有其他文件?

I've come across this article: ThoughtsPark.org: Using negative patterns for Subversion's svn:ignore property , but the approach given is kind of cryptic to me and I'm not able to get it working. 我遇到过这篇文章: ThoughtsPark.org:使用Subversion的svn:ignore属性的负面模式 ,但给出的方法对我来说有点神秘,我无法让它工作。

Thanks in advance! 提前致谢!

Subversion will not apply the patterns in svn:ignore to already versioned files. Subversion不会将svn:ignore的模式应用于已经版本化的文件。 So in your example the pattern * should be OK. 所以在你的例子中,模式*应该没问题。 Just ignore everything unversioned. 只要忽略所有未经修改的东西。

The idea is that you make a file pattern which matches all files, except .htaccess. 这个想法是你创建一个匹配所有文件的文件模式,除了.htaccess。 In the article, they use character classes to make such a pattern. 在文章中,他们使用字符类来制作这样的模式。

Eg 例如

[^a]*

Matches any file which first letter is not an a. 匹配第一个字母不是a的任何文件。 This won't work if you specify the full .htaccess filename like this, but the following may work for you: 如果您像这样指定完整的.htaccess文件名,这将无效,但以下内容可能对您有用:

[^.]*

This will ignore any file not starting with a dot. 这将忽略任何不以点开头的文件。

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

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