up vote 7 down vote favorite
2
share [g+] share [fb]

Is there a way to directly tar the latest version of an SVN folder without the SVN hidden files? I would like to create a tar archive without the SVN files. I know you can get the latest with the SVN tracking files, but is there a one liner that will directly send the information to an archive?

link|improve this question

I don't know about svn, but github allows you to download .tar.gzs of a git repo. – Macha Nov 29 '09 at 13:54
feedback

5 Answers

up vote 8 down vote accepted

The easiest way to make a copy of the latest version of a repository without all the .svn folders is to use the svn export command.

Here's how I would make the archive:

$ svn export URL PATH ; tar czf exported_copy.tgz PATH

Where URL is the URL of your svn repository and PATH is a local path suitable for saving a copy of the exported repository. I don't know a way to do it more directly than this. Unfortunately you do end up with the exported copy hanging around, so you might just want to put the whole thing in a short bash script which then deletes the temp files afterwards.

EDIT: While this is the easiest method and is what I used as well I would be careful. In my research I found this http://narfation.org/2009/01/08/creating-recreatable-tar-gz-from-svn which clearly tells us the problem of preserved group/user ownership which causes problems when deploying to another system. I have tried this script with modifications of my own to suit my purpose and you might benefit as well.

link|improve this answer
feedback

Maybe version 1.23 of tar allows you to exclude all versioning files from command line but unfortunately don't work on my 1.20 version:

tar cvfz --exclude-vcs archiv.tar.gz directory/
link|improve this answer
Very nice! I didn't know about that option‌​. – Peter Murray Jul 7 '10 at 15:16
feedback

Go to the subversion working directory (checkout) and run this:

find -name .svn -prune -o -print | cpio -o -H tar | gzip > archive.tar.gz

If you're using GNU utilities you can also run:

find -name .svn -prune -o -print0 | cpio -o -0 -H tar | gzip > archive.tar.gz

If possible, I would recommend using the ustar format (-H ustar).

link|improve this answer
feedback

If I understand correctly, you're wanting to tar the results of an svn checkout?

So, in pseudocode, it'd look something like this:

svn export branch; find branch | grep -v '/.' | xargs cp tarbranch ; tar -zcf tarbranch.tgz tarbranch
link|improve this answer
feedback

I see as well:

tar cvfz archive.tar.gz directory/  --exclude='*/.svn'

Thanks tar.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.