[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: pre-commit

From: Ryan Schmidt <subversion-2006d_at_ryandesign.com>
Date: 2006-12-07 04:43:47 CET

On Dec 6, 2006, at 20:17, Tony Morris wrote:

> Is it possible to determine the size of a commit in a pre-commit hook?
> i.e. the size of the delta that is about to be applied. Is it possible
> to fail a commit if doing so exceeds a certain total repository size?
>
> Using quota is not an option, since I am using Apache at the front
> running as its own user.

Someone recently asked how to determine the size of the files
committed; that was answered here:

http://svn.haxx.se/users/archive-2006-11/1416.shtml

Determining the size of the revision (the size of the deltas) should
be much simpler even, since by pre-commit hook time it's already been
created. Your hook is given the transaction id and the path to the
repository. All you should have to do is look into the db/
transactions directory of the repository and see how big the
transaction with your id is.

Determining the total size of the repository could be a performance
bottleneck, so it might be a good idea to cache that in a file
somewhere, and read that file, rather than recompute the real
repository size at each commit. You can add the size of the current
transaction to the size in the file to keep it up to date. If this
should become inaccurate, you can regenerate the file accurately via
cron job, maybe late every night.

-- 
To reply to the mailing list, please use your mailer's Reply To All  
function
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Dec 7 04:45:03 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.