tags:

views:

348

answers:

4

I have the pattern svn:ignore datasheets/*/*.pdf
It is supposed to ignore all pdfs that are at an arbitrary depth under multiple "datasheet" directories under the current root folder.

As an example: say I have a dir structure like this

Websites
  -web1
    -dataSheets
      -AT
        -ignore.pdf
      -BE
         -NL
          -ignore.pdf
         -FR
          -ignore.pdf
          -ignore2.pdf
    -licenseAgreements
      -important.pdf
  -web2
    -datasheets
      -etc

In this example the pattern needs to ignore all the ignore.pdfs without ingoring the important.pdf too.

The shown pattern still includes all my pdf files.

I know there are a bunch of similar questions, but none of them seem to tackle the problem with the various hierarchy levels.

A: 

svn:ignore works only on directory its been set. To ignore files under subdirectories you have to apply this property recursively to subdirs. (-R switch).

Please try this:

svn propset svn:ignore "*pdf" -R datasheets
greg
it's still adding all the pdfs :S
borisCallens
+2  A: 

From the documentation:

[U]nlike the global-ignores option, 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.

You need to apply the ignore pattern to each directory recursively, which you can do using the --recursive option.

Michael Hackner
sadly the example given is not the real situation. In my real world case there are many datasheet folders and the folders will come and go. Applying it each time would be madman's work
borisCallens
A: 

You should use the build in global-ignores feature. ignoring with svn properties will work only on a single level and yes, you have to change them or re-add them if new folders will be added.

So use the client feature of global-ignores which can be found in your local configuration [around line 94, look for "global-ignores].

Local config can be found under:

windows:

%APPDATA%\subversion\config

*nix

~/.subversion/config
Peter Parker
He doesn't want to ignore all PDFs, only most of them.
Michael Hackner
I thought he want to ignore all pdfs of a certain filename, but not to ignore other filenames
Peter Parker
A: 

I am 80% sure you cannot do what you want out-of-the box. Look into a post-commit hook -- you can evaluate the pathname of the file being added and reject it if it meets the criteria you specify.

Coderer