> Edvard Majakari wrote:
>> Hi folks,
>>
>> You'd imagine this is in the FAQ. Oftentimes when I wanted to make sure
>> there's no cruft lingering around eg. after building a system, I used to
>> run 'cvspurge', which removed every file from current dir and subdirs not
>> known to CVS. I can't find equivalent in Subversion after reading the
>> manual.
Helge Jensen wrote:
> You could use
>
> svn status --no-ignore | grep -e '^[I\?]' | cut -c 8-
>
> to get a list of those files and directories that SVN doesn't know or is
> ignoring.
>
> Then you could further pipe that into
>
> xargs rm -r
>
> But you'd need to think a bit about esacping whitespace if the
> file-names contain such. especially newlines would give you a hard time :)
Indeed, that's the correct principal. Here's my script:
#! /bin/bash
DRYRUN=""
if [ "$1" = "-n" ]; then
DRYRUN="yes"
shift
echo "DRYRUN MODE"
fi
IFS='
'
for i in `${SVN-svn} status --no-ignore "$@" | sed -n 's/^[I\?] //p'`
do
if [ "${i/,//}" != "$i" -o "${i/%.swp//}" != "$i" ] ; then
echo "SKIPPING: $i"
else
echo "$i"
if [ -z "$DRYRUN" ]; then
rm -rf "$i"
fi
fi
done
I've made a few enhancements above the core functionality.
1. Dryrun (-n) mode
2. Handles whitespace in names (but not newlines)
3. Condenses the grep&cut into a single sed.
4. Skips *.swp files (vim swap).
5. Skips things with commas in the name. I use this to maintain unversioned
stores of scripts, notes, etc. within a working copy, and avoid accidentally
purging them.
I guess I should add this to tools/client-side/...
Max.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Sep 9 00:31:22 2004