views:

1003

answers:

10

I recently converted my cvs repository to svn using cvs2svn and I recently noticed that every directory has a hidden folder called .svn. My current build script copies a lot of directories from my versioned resources directories and it ends up copying the .svn files. Is there anyway to make svn not include these files when I checkout or do I need to write a script to delete all these .svn files. There are many files that have these hidden .svn directories so this would be a pain unless I could write a recursive script to do this but I don't if I can do this for my windows installer. Is there an easy way to stop svn from putting this hidden directory everywhere in my project?

+14  A: 

You can do a thing called an SVN Export to get the files without the .svn directories i think

http://blog.joshbuhler.com/?year=2005&monthnum=11&day=09&name=svn-export-learn-it-use-it-love-it&page=

mcintyre321
Yep, SVN Export will remove the .svn files. You could make a batch file to run the export command from the command line and incorporate that into your build process.
Jon
check this link it helped me.... http://cocoabugs.blogspot.com/2010/09/script-to-remove-hidden-svn-folder.html
jeeva
+4  A: 

Those folders are required for how subversion works with a working copy (i.e. where you've done a checkout).

One option would be for you to do an export to another location. The export would not have the .svn folders, and you could run your script on that. Documentation: svn export, TortoiseSVN Export

Another option would be to modify your script to ignore hidden directories, or build a better build tool.

crashmstr
A: 

I dont know if I would delete them, but maybe modify your build script to ignore copying them would be a good idea. I use Ant to build compile and build my war and it does so ignoring .svn dirs.

Nick
Deleting them is not a good idea unless you want that folder to NOT be a working copy anymore.
crashmstr
+1  A: 

I posted this yesterday over here, but here is again because I kind of put it in the wrong thread anyway...


I've got something that should make your day. Original source is here.

This is a (perfectly safe) Shell Extension that will add "Delete SVN Folders" to your right click menu in Windows. Run it on any directory containing those pesky files.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@="Delete SVN Folders"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \""

To make this part of your build script copy that call to cmd.exe and execute it.

Nathan Taylor
+1  A: 

svn export is what you want. It will give you a clean copy of the code tree without the .svn directories (note that this copy is not under version control and svn commands won't work on it once it's exported).

I utilize this method to launch code on production servers. Our build script takes an export of the code branch, tars and gzips it, uploads it to the correct server, and unzips/untars it.

zombat
+2  A: 

I'm not sure in your specific case that you want to remove all those .svn directories. But if you do, here is a bash one-liner to do just that:

find . -name .svn -print0 | xargs -0 rm -r
Charles Finkel
A: 

You could take a look at SVK, which is a layer on top of Subversion. One of the advantages is that the repository metadata for your working copy, which is normally stored in the .svn dirs, is instead kept in a single central location, so you don't have the ugly hidden .svn dir problem. It's pretty nice.

ire_and_curses
+2  A: 

And a PowerShell version

ls  -Force -Recurse -Filter  .svn  | rm -Force -Recurse
Scott Weinstein
Sometimes one inherits code where this is just more useful. Thanks!
jray
+1  A: 

If wanna do this with ruby just paste my script at the root folder you want to remove recursively: http://fabianosoriani.wordpress.com/2009/03/19/ruby-script-to-remove-svn-folders/

Fabiano PS
A: 

find . -name '.svn' -depth -exec rm -rf '{}' \; -ls

Ralph