Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
599 views
in Technique[技术] by (71.8m points)

svn - Recursively ignoring files in the entire source tree in subversion

I am not new to Subversion, but I have up till now used Tortoise and never the commadn line. My question is, how do I ignore all files like *.o from the ENTIRE source not just the root.

For example, if I have the following files: /myfile.o /folder1/myfile2.o /folder1/folder1.1/myfile3.o /folder2/myfile4.o

If svn propedit svn:ignore "." in the root directory, and add *.o, it will ignore the myfile.o, but does not ignore /folder1/myfile2.o, /folder1/folder1.1/myfile3.o, /folder2/myfile4.o. Is there a way to add *.o in for an entire project (I cannot do it for the entire repository, which I know can be done, because this project is in a repository with many other projects)?

Please let me know if I need to clarify. Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Edit

The original answer provided below was given prior to Subversion v1.8 which introduced a way to set the default repository level ignore (called svn:global-ignores) without overriding/replacing the svn:ignore property on the root directory and every single subdirectory. Since 1.8, the best way to achieve what you would like is to invoke the following command (credit goes to TManhente):

svn propset svn:global-ignores '*.o' .

On earlier versions (and on later versions), you can still use the approach indicated in the original answer below; however, be aware that this assumes that you are okay with replacing/overwriting the svn:ignore property on each and every subdirectory... this may be fine for a smallish/newish repository but is probably not what you want if you have a large/old repository in which some subdirectories may have independent svn:ignore properties that you do not wish to overwrite.

Original answer

You can use the "-R" or "--recursive" option with "svn propset" as in the following command:

svn propset svn:ignore '*.o' . --recursive

More info

For both cases, you can use the following command for more info about svn propset:

svn help propset

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...