Mike Christensen
Mike Christensen

Reputation: 91628

How to "svn ignore" a file, without overriding the existing ignore list

I'd like to ignore a bunch of files recursively in our enlistment, such as /bin and /obj and *.user. I have a list of all these patterns in a file called .svnignore which is checked in. I can recursively apply this ignore list to every directory like so:

svn propset svn:ignore -R -F .svnignore .

I run this every so often when we add new projects and stuff. However, now I want to ignore just the /QEData directory in the root (not recursive, just that one instance). So, after running the above command, I then run:

svn propset svn:ignore QEData .

However, this seems to wipe out all the patterns from .svnignore on the root directory and replace them with just the /QEData pattern. How can I add to the ignore list without overriding the existing ignores on that directory?

Note: I'm looking for an answer that can be scripted on Windows and/or PowerShell.

Upvotes: 1

Views: 935

Answers (2)

Lazy Badger
Lazy Badger

Reputation: 97282

Non-interactive Windows-type propedit

echo NEWSTRING> PATH\TO\TEMPFILE
svn pg PROPERTY >> PATH\TO\TEMPFILE
svn ps PROPERTY -F PATH\TO\TEMPFILE .
del PATH\TO\TEMPFILE

Each such pseudo-pe will add two empty strings at the end of property-value list, empty lines are ignored SVN on processing anyway

Note about global-ignore

With

svn propget svn:global-ignores -v
Properties on '.':
  svn:global-ignores
    *.dat

and WC like

dir /B /S
z:\WC\a.txt
z:\WC\Sub
z:\WC\b.dat
z:\WC\Sub\c.dat
z:\WC\Sub\d.txt

with status

svn st --no-ignore
?       Sub
I       b.dat

I.e., in short - If into directory of WC with defined svn:global-ignores pattern added subdir and files in this subdir, matchng and not-matching pattern, TortoiseSVN on commit select all needed and only needed objects

TSVN Commit

Upvotes: 3

mmonem
mmonem

Reputation: 2831

Can this help?

echo -e "`svn propget svn:ignore`\nQEData" | svn propset svn:ignore -F - .

Update:

This can be a base for a script to append ignores

#!/bin/sh

if [ $# -ne 1 ]
then
    echo -e "Usage: `basename $0` <something to be ignored>\n"
    exit 1
fi

IGNORE=$1

echo -e "`svn propget svn:ignore`\n$IGNORE" | svn propset svn:ignore -F - .

Upvotes: 1

Related Questions