Recursively ignoring files in the entire source tree in subversion

I'm not new to Subversion, but so far I have used Tortoise and have never been by default. My question is how to ignore all files, such as * .o, from the ENTIRE source, and not just from the root.

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

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

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

+45
version-control svn tortoisesvn
Aug 05 '09 at 1:09
source share
3 answers

Edit

The initial answer below was given before Subversion v1.8, which introduced a way to set ignore repository level by default (called svn:global-ignores ) without overriding / replacing the svn:ignore property in the root directory and in each individual subdirectory. version 1.8, the best way to achieve what you want is to call the following command (credit goes to TManhente):

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

In earlier versions (and later versions) you can still use the approach specified in the original answer below; however, keep in mind that this assumes that you are fine with replacing / rewriting the svn:ignore property for each subdirectory ... this may be good for a small / new repository, but probably not what you want if you have a big / old in which some subdirectories may have independent svn:ignore properties that you don't want 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

Additional Information

In both cases, you can use the following command to get more information about svn propset:

 svn help propset
+63
Aug 05 '09 at 1:13
source share

Just an update: Subversion 1.8.0 introduces Inherited Properties and Reactitory Dictated Configuration (for auto-substitution and ignore), which can also be used in this case.

You can set the new svn:global-ignores in the root path. It will "only affect subtrees installed on the path on which the property is set."

This new property is set in the same way as svn:ignore :

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

Additional information is available in the Subversion 1.8.0 Release Notes .

+38
Jun 22 '13 at 19:15
source share

As pointed out by @ hackmaster.a in the comment, the example given in the accepted answer has a side effect to remove all previous svn:ignore settings. Using propedit instead of propset does not work either.

The correct way to add multiple files recursively is to put your names in a list separated by svn propset svn:ignore "[LIST]" . property with svn propset svn:ignore "[LIST]" .

For example:

  svn propset svn:ignore -R "*.pkl > *.class > Thumbs.db > data.tmp" . 

Of course, > are just shell invitations.

This command changes the svn:ignore properties of the current directory . and each of its subfolders recursively.

+3
Sep 04 '14 at 15:26
source share



All Articles