Svn delete removed files

svn

I have a working copy of an SVN project. Files get deleted from this working copy by an application. When I commit the working copy using the SVN command-line I would like to remove these deleted files from the repository.

If I commit the working copy using svn commit it doesn't remove the files from the project (because they weren't deleted locally with svn delete. Is there some way that I can tell SVN to remove (from the repository) any files that are missing in the working copy?

Best Answer

use an

svn status

it will list changes with the working copy. (deleted files start with a ! )

Then, you can :

svn delete file_to_del1 file_to_del2 etc

and finally commit

You can also write a little snippet to automate this:

svn status | grep '^!' | awk '{print $2}' | xargs svn delete

And eventually add an alias :

alias svn_precommit="svn status | grep '^!' | awk '{print $2}' | xargs svn delete"

If you need to support @ / spaces in file names you need to complicate the script (you should not use those chars in filenames but sometimes thats a decision that has been done by someone else) - you can use this in your .bashrc directly:

svn_prepare_del() {
        svn st | grep '^!' | awk '{$1=""; print " --force \""substr($0,2)"@\"" }' | xargs svn delete
}