开发者

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开发者_JAVA百科 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 ?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜