开发者

Is SVN global ignore recursive?

I am new to SVN, and I want to ignore a directory recursively, like in G开发者_Python百科it. I have a directory, sample, which I want to ignore recursively.

>svn status
sample/first/1.jpg
sample/second/2.jpg
sample/third/3.jpg

I have tried:

  1. svn ps svn:ignore "*" . (under the sample directory)
  2. Setting global ignores in ~/.subversion/config as global-ignores = sample.

But still it shows the same result when I run svn status:

>svn status
sample/first/1.jpg
sample/second/2.jpg
sample/third/3.jpg

How can I recursively ignore a directory in SVN?


svn -R propset svn:ignore . -F somefile.txt

Where somefile.txt is a file containing all the svn ignore patterns you want recursively set.


If you want to ignore the directory samples and all the content within, you must set svn:ignore in the directory containing the samples directory. You did it within samples itself. Please note two things:

  1. svn:ignore affects only unversions files. This means, that files and directories already known to SVN will still show up.

  2. svn:ignore settings are not cumulative or recursive. If you want to ignore only the *.jpg files in you treee, you have to set svn:ignore to *.jpg in each directory.

Please note, that the command svn propset has an -R (aka. recursive) option, which might help. But keep in mind, that propset is not propadd. This is of course only a concern if you want to set different values in the tree.


There is a new SVN property to do this from SVN 1.8 onwards. See the bottom of this page from the SVN book:

svn:global-ignores

It applies to the folder you set it on and everything underneath, and you do not need to specify recursive. For example, to set on the current directory:

svn propset svn:global-ignores "bin obj" .


From http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.advanced.props.special.ignore :

"The patterns found in the svn:ignore property apply only to the directory on which that property is set, and not to any of its subdirectories."

[...]

"Once an object is under Subversion's control, the ignore pattern mechanisms no longer apply to it. In other words, don't expect Subversion to avoid committing changes you've made to a versioned file simply because that file's name matches an ignore pattern—Subversion always notices all of its versioned objects."

You could use the -R flag but that only applies the property recursivly - it doesn't change the properties effect so won't apply to any new directories created.

Also I suggest using propedit instead of ps as it allows mulitline edit, otherwise it's tricky to deal with more than one ignore pattern.


For those on *nix:

Although the documentation implies that ~.subversion/config should already have the default configuration in it, mine (SVN 1.6.17 on Ubuntu) was empty.

Here's the format I finally got to work (this is the entire file), includes the default settings and I've added *.ignore on the end:

[Miscellany]
global-ignores=*.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store *.ignore
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜