4

I have a big directories tree involving many subdirectories. In many of the directories I used the svn propedit svn:ignore ., and ignored files and/or directories in the given directory. Now, I want to ignore, in all subdirectories the directories called foo. In this answer, it is suggested to invoke:

svn propset --recursive svn:ignore foo .

from the tree's root. The problem is, that once invoking this, it overrides all predefined ignores in the various subdirectories - and this is undesired. Essentially I would like to append to the ignore list of each directory in the tree, a line with entry foo in it. Does SVN supports this kind of action? If not, then I was thinking of scripting this task, and add to the file dir-prop-base (which seems to hold the ignore list) in each ./sub/directory/.svn (where . is the tree's root) the needed line. Is it safe to do it?, namely manually mess with .svn content?

1 Answer 1

6

I recommend using a bash script for this task. But instead of manipulating the files directly, stay with the svn command tools. This solution is simple and safe. The following script might do the job, if executed with find -type d ! -path "*/.svn*" -exec /tmp/add_svn_ignore.sh {} + from the working directory:

#! /bin/bash
ignore="foo"
for pathname in "$@"; do
    lines="$( svn propget svn:ignore "$pathname" )"
    grep -F -x -q "$ignore" - <<< "$lines" ||
    svn propset svn:ignore "$lines"$'\n'"$ignore" "$pathname"
done
2
  • Thanks for your reply! I tried it and it seems like the find command you suggested is wrong, I get find: illegal option error for each letter of "type" and finally find: d: No such file or directory. I'm using OS X in case it matters. Thanks again.
    – Dror
    May 22, 2012 at 6:31
  • 1
    I am using GNU find. On OS X, find requires a path before the first option. Try find . -type d ... instead of find -type d ....
    – nosid
    May 22, 2012 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.