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

svn-clean

From: Wilfredo Sanchez <wsanchez_at_mit.edu>
Date: 2002-08-15 22:36:56 CEST

   Since "make distclean" craps out more often than not, and I wanted to
get rid of all files which aren't in the repository, I wrote the
following script to nuke anything not managed by SVN. Now, I'm
cheating because I'm poking in .svn/entries, which I'd call a no-no.

   Better would be to use "svn status", but that craps out if I'm off of
the network. A bummer, since the information I want is available
locally. Is there another way?

        -wsv

#!/bin/sh

##
# Delete items which are not managed by SVN
##

top=$(pwd)

for dir in $(find . ! \( -name .svn -prune \) -type d -print); do
     if [ -d "${top}"/"${dir}" ]; then # Test dir in case it got deleted
         cd "${top}"/"${dir}"
         for file in $(find . ! -name . ! \( -name .svn -prune \)
-prune); do
             if ! grep "^ name=\"$(basename "${file}")\"" .svn/entries
> /dev/null 2>&1; then
                 echo "${dir}/${file}"
                 rm -rf "${file}"
             fi
         done
     fi
done

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 15 22:37:14 2002

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.