开发者

Limit size of Subversion repository

开发者_如何转开发

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).


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.


There is no simple way to do this. You will really need to rebuild the repository dropping the oldest revisions. There is no single SVN command for doing this. The process you need is roughly:

  1. Do an svnadmin dump (which can be done only on the host).
  2. Use svndumpfilter to filter out the unwanted revisions.
  3. Create a new repository and use svnadmin load to load into the new repository.

This link will give you some information on svndumpfilter, which is the crucial part of this entire operation.

Rethink: svndumpfilter gives control over which files/paths to include or exclude, but I'm not so sure it gives the fine grained control over revisions...


In a pre-commit hook, you could "abort" the transaction if the repository exceeds a limit.


Since all revisions in SVN are based on diffs of what came before, there is no way to "clean out" old revisions. If you really need to do this for some reason, you will have to every so often take an export and re-import that into a new repository.


you can not do it. on opposite to CVS, subevrsion doesn't keep the entire sources per revisions but only a difference between upcoming revisions (well a little bit smarter but not important for this question)


  1. Create windows user account for SVN
  2. Enable quota control for all NTFS drives (My Computer -> Drive -> Properties -> ...)
  3. Setup quota limit to size you need (for ex, 20 Mb)
  4. Configure SVN server to run under account you just created
  5. Enjoy!
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜