[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: removing missing files/directories?

From: Raman Gupta <rocketraman_at_fastmail.fm>
Date: 2005-07-15 13:34:47 CEST

John C. Fowler wrote:
> Keep in mind... if there is a space in the file name some of these
> scripts will fail.
>
> Dale Worley wrote:
>
>>>From: Julien ALLANOS [mailto:julien.allanos@aql.fr]
>>>Is there a simple way to remove missing files/directories
>>>(those marked ! in svn
>>>st) all in once? At the moment I have to copy/paste files
>>>names to svn remove,
>>>and I didn't see any option in svn remove to do this.
>>
>>It seems like a simple shell scripting problem:
>>
>> svn rm $( svn status ... | sed -e '/^!/!d' -e 's/^!//' )

Put this "svnapply" script in your /usr/local/bin, and then execute:

svnapply \! svn rm

Works with spaces too. Improvements are welcome:

#!/bin/bash
#
# Applies arbitrary commands to any svn status. e.g.
#
# Delete all non-svn files (escape the ? from the shell):
# svnapply \? rm
#
# List all conflicted files:
# svnapply C ls -l

APPLY=$1
shift

svn st | egrep "^\\${APPLY}[ ]+" | \
  sed -e "s|^\\${APPLY}[ ]*||" | \
  xargs -i "$@" '{}'

Cheers,
Raman

Received on Fri Jul 15 13:38:14 2005

This is an archived mail posted to the Subversion Users mailing list.