Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit size of Subversion repository

Tags:

svn

Hi I'd like to limit the size of my repository by specifying a maximum size, however I cannot find any information on doing so. Is this technically possible?

edit: sorry if I wasn't clear. I want to keep a functional repository where I can keep committing patches, however the oldest revisions of documents that have at least one newer revision can be automatically removed to stay within the sizelimit. so say that I can go about 67 revisions back because older ones have been removed (ideally keeping the commit messages).

like image 983
svandragt Avatar asked Jan 07 '10 13:01

svandragt


People also ask

How do I find my SVN repository size?

To see disk space usage for an individual Subversion repository, click Repositories in the main navigation bar, select the checkbox for the repository and click Info. To see the disk space used by all repositories, see the Disk space chart in the Administration > Statistics page.

Is SVN free?

Subversion is free — technically. After all, it's an open source tool. But free doesn't come without setbacks. Using SVN often leads to losses in productivity and high administrative costs.

What is the purpose of an SVN Subversion repository?

Subversion is used for maintaining current and historical versions of projects. Subversion is an open source centralized version control system. It's licensed under Apache. It's also referred to as a software version and revisioning control system.


1 Answers

Doing this is major surgery on your repository. Make sure you're fully aware of what you're doing before doing this for real on a real repository.

You won't be able to do what you're after for individual files, but you can do this across the whole repository. What you need to do is cut off the history tail for the repository.

What this means is that if you've got 5000 revisions in your repository, and you cut off the oldest 1000 revisions, you'll end up with a repository with just the most recent 4000 revisions.

Doing this requires a dump/restore cycle, which means that you'll have to disable write access to the repository whilst you're working on and rebuilding the repository.

You won't lose any files that are still visible when browsing the repository, but the history for any particular file may be lost entirely (if all modifications to it were in the first 1000 revisions). Obviously if a file was deleted in one of the early revisions, you won't be able to get it back at all after the cut.

Also note that the naive way of doing this will renumber all of your revisions starting from 0, so in the above example, revision 5000 will become revision 4000 after the truncation. If this will cause you problems, you'll have to do extra work.

So, assuming we want to lose the earlist 1000 revisions, the basic workflow is:

  1. Take your repository offline (or at least make it read-only)
  2. run svnadmin dump [repository path] -r 1000:HEAD > repository.dump. This will create a dumpfile which only includes revisions from 1000 onwards. By not using the --incremental flag, the first revision in the dumpfile will contain a complete dump of the repository as it looked at revision 1000 (excluding all history).
  3. Create a clean repository with svnadmin create and copy the conf & hooks directories from the old repository.
  4. run svnadmin load [new repository path] < repository.dump to load up the most recent revisions.
  5. Move the old repository out of the way (keep it around for backup) and move the new repository into its place.

If you want to preserve the revision numbers you'll have to load the empty revisions from somewhere. You can do that by dumping out the revisions 1:999 into a separate dump file and then using svn dumpfilter to get rid of everything from it, then load up the empty revisions followed by the revisions you want. It's a bit fiddly, but will get you there.

like image 150
Jim T Avatar answered Nov 08 '22 07:11

Jim T