tags:

views:

320

answers:

1

I cannot just rm -rf $(find . -name '.svn'), because I've got some directories in my working copy which are unversioned (on svn:ignore) and at the same time working copies of other svn repositories.

my-repo
|+ directory
||- .svn (to delete)
||- files...
|+ another_directory
||- .svn (to delete)
||- files...
|+ directory_ignored (svn:ignore)
||- .svn (different working copy)
||- more files ...

So I'd like to just tell subversion to remove all .svn directories belonging to this working copy only.

Is this possible?

The directory structure is quite complex, so doing it manually would really suck.


Edit: The working solution finally is:

for i in $(export IFS=$'\n'; grep -l 'https://complete-repo-path/' find . -name entries|grep .svn | sed 's/ /\ /' | sed 's/.svn\/entries//'); do echo $i.svn; done

+1  A: 

This seems like a workaround but still...

This will give you the list of directories containing the URL of your svn repository:

grep -l 'https://yourhost/svn/your_working_copy' `find . -name entries|grep .svn` | sed 's/\.svn\/entries//' | xargs echo

If it seems correct to you, you may rm -rf them after that

Dmitry Yudakov
Thank you! Nice one. This worked. I had to slightly modify the expression to make it handle filenames with spaces too by setting the file separator character: for i in $(export IFS=$'\n'; grep -l 'https://yourhost/svn/your_working_copy' $(find . -name entries|grep .svn) | sed 's/\.svn\/entries//'); do echo '##' $i '##'; done (converted `` to $() as is formatting syntax in the comments)
Simon A. Eugster
I noticed that this didn't handle whitespaces correctly; Corrected expression added in the question.
Simon A. Eugster