In my project I have a folder with resources which I don’t want to manually add or remove to the repository as I add or remove them to my working copy.
I wrote a simple bash script that checks svn state and calls svn add for files marked with a ? and svn remove for files with a !. I added this bash script to my build script. The problem is, svn remove returns an error when called with a file that doesn’t exist locally anymore. This results in my build script being aborted and returning an error too.
Is there a way to suppress these errors? I tried --force and --quiet. Didn’t help.
Example:
MacBook-Pro:proj Bill$ echo "test" > foo.bar
MacBook-Pro:proj Bill$ svn st
? foo.bar
MacBook-Pro:proj Bill$ svn add foo.bar
A foo.bar
MacBook-Pro:proj Bill$ rm foo.bar
MacBook-Pro:proj Bill$ svn st
! foo.bar
MacBook-Pro:proj Bill$ svn rm foo.bar
D foo.bar
svn: 'foo.bar' does not exist
There are (at least) two different cases in which
svn statprints a line with an exclamation point:svn rmwas not used.svn addwas used on the file, and the file does no longer exist in the working directory.svn rmworks in the first case, but exits with an error in the second case. There are several ways to solve this issue – depending on what you want to achieve:touch "$filename" ; svn rm --force "$filename".svn revert "$filename".