Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reducing the size of the .svn folder

In our project we made the decision to reduce the build time by using pre-built binaries. Weekly/monthly we create a stable release and commit it to the repository. The build uses these binaries instead of building everything from source.

For build speed this is fantastic. But, unsurprisingly, it really bulks up the SVN checkout size. Our trunk currently sits at ~22 GB. I realize this is not the intended usage of Subversion. But we don't have an alternative at the moment.

But I'd like to improve the current situation. The .svn folder makes a big contribution to the size of trunk on disk. When the binaries are updated, it seems to keep several bases in the .svn folder. That is, if a binary is 4 GB there is a copy in the .svn. If it's updated then the .svn folder holds the original base plus the new base and bulks up to 8 GB for that one file.

Is it possible to tell Subversion not to keep a base in the .svn folder for certain files? Through google I found a similar question, How to decrease .svn folder size?.

The answer Simon received was

  • Use a partial checkout (which won't work for me as I need the binaries)
  • This is not yet a feature of Subversion
  • It was discussed, but will not be a feature until at least Subversion 1.8

Luckily for me subversion 1.8 has been released. Was this feature added?

I did not notice it in the release notes. Though "Directory and property storage reduction" looks promising.

like image 363
Shane Gannon Avatar asked Jan 09 '14 17:01

Shane Gannon


People also ask

How do I clean up a .SVN folder?

To get a clean copy you need to copy the project folder to another location and clean it there. And finally, there is a second method to get a clean copy of your project — using svn export command. More details about it you can find in the book Version Control with Subversion.

Can I delete .SVN folder?

To remove a file from a Subversion repository, change to the directory with its working copy and run the following command: svn delete file… Similarly, to remove a directory and all files that are in it, type: svn delete directory…

What is the .SVN folder?

svn, also known as the working copy's administrative directory. The files in each administrative directory help Subversion recognize which files contain unpublished changes, and which files are out of date with respect to others' work.

How do I delete a .SVN file in Windows?

Right click on the project, go to Team->disconnect. It will open a popup where you select the first option: 'Also delete the SVN meta-information from file system. ' This will remove all the SVN folders automatically along with svn property files that you might forget sometimes while removing .


2 Answers

There's no way to get rid of the need to store pristines at this point. It's been talked about but it's actually not an easy problem to solve because there's so many different use case situations that would be presented by removing them optionally.

With 1.7 the pristine storage was changed and in some cases you may actually see the situation as worse than before 1.7. Pristines are now stored in files named by the hash of the pristine. So if you have multiple identical files you won't have duplicate pristines stored. However, we also don't cleanup pristines anymore. So they just continue to build up. You can trigger unused pristines to be removed with svn cleanup.

There is a point to keeping unused pristines around, if you're switching between branches we no longer have to download things that you already have the pristine for in 1.8.

like image 95
Ben Reser Avatar answered Oct 22 '22 02:10

Ben Reser


For those using TortoiseSVN client's Cleanup command rather than svn cleanup command, .svn folders size can be decreased by making sure that Vacuum pristine copies option is checked:

enter image description here

Also, it is recommended to cleanup at the top level of the working copy, as indicated here.

[Edit]

According to this answer and SVN change log, svn cleanup has an option to vacuum pristine copies (/vacuum). This is done by default starting from 1.8. From version 1.10 up it is not longer done by default, but can be run using the command svn cleanup --vacuum-pristines (see this answer).

like image 36
Alexei - check Codidact Avatar answered Oct 22 '22 02:10

Alexei - check Codidact