Today I wanted to grab the latest revision of Model Glue in hopes of checking out something which is fairly intriguing to me, Coldspring integration. I'm unable to do this from my workstation, so I SSH'ed to my FreeBSD box at home (the server which you're reading this page from) to grab it via the Subversion command line client.
One annoying thing about doing a checkout of a Subversion branch is that it also grabs all of the .svn directories which contain the history of changes. This is fine if you plan on committing changes to the code base, but not if you just want a working copy of it. These directories can get quite large and take up an incredible percentage more space than the code. To get rid of these directories before SCP'ing the code to my workstation, I used this command to clean out all of those directories (from the root directory where I pulled down the code):
-
find . -type d -name '.svn' -print0 | xargs -0 rm -rdf
This cleaned out all of the cruft that I didn't need, and I was able to grab it without needing to gzip it first. Hopefully this helps someone else faced with a similar problem.
Update: Even though the same thing can be done with an svn checkout command, this command is still very useful when you've created new code and added it to svn, but then refactor/move it before you check it in. You can delete all of the .svn files and directories, and then add the directories/files back into subversion again without it getting angry at you.
9 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
Do you have CF running on FreeBSD???
At the moment, no, as I refuse to pay so much for software licensing for a personal site when PHP, Java, Python, Ruby, et al are free.
However, it's not really that hard to do as long as you know FreeBSD fairly well.
Couldn't you have done a "svn export" instead of a checkout? Sounds like you wanted to look, not so much actually work on the code...that would have been sufficient (i think!) to drop the .svn folders and such.
Brandon, you can use
svn exportto checkout the code when you don't intend to check it back in. It just grabs the files for you.Right.. I already use that in the Ant task I usually use to pull stuff from svn, doh.
I got all geeked-out about figuring out a way to do delete the .svn directories via a command and forgot about export.
Brandon,
Don't listen to them. This is a great trick!
I didn't know about export either (but will never make that mistake again). This saved me a lot of trouble.
Thanks!
Tim
Tim,
Yes, I agree, I still use this one all the time. Usually to clean-up code when I need to check it in but it's been copied from another svn repo (like when merging new code in a branch into trunk, etc).
Continuing the Discussion