On Oct 22, 2008, at 03:19, Ruslan Sivak wrote:
> Ryan Schmidt wrote:
>
>>> Looks like after I installed UnixUtils and changed the code slightly
>>>
>>> svn st --depth=infinity | sed -n "s/^\! //p" | xargs svn rm
>>>
>>> it seems to work. What if the file name has a spaces in it?
>>> Does anyone have a regex for that?
>>
>> The regular expression is accurate for any filename; the problem
>> is the xargs command which splits input on whitespace, whether
>> that be a newline or a space. Maybe there is an argument to xargs
>> to tell it to split only on newlines. Or you could replace xargs
>> with a short script written in perl or another language of your
>> choice. For example:
>>
>> svn st --depth=infinity \
>> | sed -n "s/^\! //p" \
>> | perl -e 'while (<>) {chomp;unlink;}'
>
> This doesn't seem to do what the other script does. Unless I'm
> mistaken this will delete the file (which is already deleted to
> start with).
Sorry, of course, you're right. I wasn't paying attention. Change
"unlink" to something that will cause perl to call "svn rm" with the
argument $_ instead.
> Either way, I don't currently have perl installed, and would rather
> not install it unless I had to.
I'm sure it can be written in most any scripting language, or even a
compiled program. Whatever you have at your disposal.
> There does seem to be a switch to xargs to tell it that you're
> separating filenames using the null character -0. Is there a way
> to do the regular expression to make it insert a null character there?
I don't know a way to tell sed to use a null byte between output
lines instead of a newline.
However, the tr utility can translate newlines to null bytes.
svn st --depth=infinity \
| sed -n "s/^\! //p" \
| tr "\n" "\0" \
| xargs -0 -n 1 svn rm
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-10-22 10:39:54 CEST