Can svn "ignore" deleted files or delete them from repository?

When I try to commit my project to svn I get the following issue

svn: '/var/www/sites/blabla/425/file.png' is scheduled for addition, but is missing

This happens because some material is deleted from the project (and I cannot use svn to delete it). Is there a way to say svn to ignore such files, or just to delete it them if they are not found ?

Answers


When you do a svn status, the output will show any such files which are "missing" as a line starting with an exclamation mark:

!       425/file.png

You should write a script (in your scripting language or command line shell of choice) which parses this output, looks for lines starting with an exclamation mark, extracts the filename, and which then does a svn revert <filename>. This will then undo the local change to that file, allowing you to commit without problems.

edit: since you mentioned a php script in a comment, I suppose you are familiar with PHP scripting. In that case you can make use of the PHP function svn_status.

edit2: if you want to delete the file from the repository, do a svn rm --force <filename> instead.


So you svn add the file but later on deleted it manually? Try;

svn rm --force file.png

to remove it from the SVN index.


Run the following command from Terminal:

svn revert $(svn st | awk 'BEGIN{FS=""} $1=="!" && $2 !~ /\.(sql|log|tmpl)$/ {print $2}')

Works for me:

svn status | grep ^\! | awk '{print $2}' | xargs -L1 svn del --force

and if you have whitespaces in your filenames, we cannot use awk so we cut until the start of the filename (You'll probably have to edit this one: because idk if we must cut 9 characters on every system) :

svn status | grep ^\! | cut -c9- | sed 's/ /\\ /g'| xargs -L1 svn del --force

Need Your Help

Delete default signature in Outlook and replace with content from doc/htm file

vba vbscript outlook

My workplace has introduced an draconian new uniform signature across the entire business which looks absolutely repulsive, and I can't in good conscience email clients without having to manually c...

LRU cache with Doubly Linked List from scratch - moveToHead (Java)

java caching doubly-linked-list lru

I have implemented a simple LRU cache as a doubly linked list written manually from scratch. The cache is filled with objects Request distinguished by their numeric (integer) ID. These Request obje...