tags:

views:

129

answers:

4

i have been sent a directory tree of source code that i want to import into my subversion repository. The issue is that at some point this code was in a different subversion repository. There are a huge number of directories and subdirectories and i basically want to clean up all of the subversion .svn folders before i attempt to import to a new repository and i dont want svn to get confused.

is there anyway to clean out a directory structure to remove all svn references?

+2  A: 

In the root of the project, with GNU find:

find . -name .svn -execdir rm -r {} +

EDIT: Corrected, with thanks to rkulla. -delete does not -delete non-empty directories.

Matthew Flaschen
run this from a command prompt ?
ooo
Yes. I'm assuming you have a UNIX-like system, with GNU find.
Matthew Flaschen
i am running this on windows . .
ooo
Well, you install it for Windows pretty easily. There's a setup program at http://gnuwin32.sourceforge.net/packages/findutils.htm . Of course there are other options.
Matthew Flaschen
The -delete option won't remove nonempty directories. Use this instead: find . -name .svn -exec rm -r {} +;
rkulla
Thanks, rkulla. I went with execdir because it's less susceptible to race conditions.
Matthew Flaschen
+4  A: 

svn export will produce a copy of the source tree without the .svn folders. Example:

svn export <old_project_root> <new_name_of_clean_directory>

I believe TortoiseSVN also has this capability from within a menu.

kostmo
The issue with this is that "Files not under version control will not be copied."
Matthew Flaschen
If you use the Export menu in TortoiseSVN in an existing working copy, it will go through cleaning out all .svn files without touching anything else. http://tortoisesvn.net/node/343
Ben Voigt
@Matthew: If "at some point this code was in a different subversion repository", it seems more likely that everything relevant would be versioned. Important point, regardless.
kostmo
+2  A: 

Stefan, author of TortoiseSVN, has a complete explanation here. The gist of it is to use a built-in TortoiseSvn right-click helper to do the job like so:

alt text

Ben Voigt
A: 

For more possible solutions see the following question ‘Un-SVN’ a working copy.

One answer contains a Windows batch script that will cleanup all .svn folders.

sakra