Re: svn log question
From: Ryan Schmidt <subversion-2010a_at_ryandesign.com>
Date: Wed, 10 Mar 2010 15:44:18 -0600
On Mar 10, 2010, at 14:49, Kevin Longfellow wrote:
> I'm setting up monitoring hourly commits on several repositories and thought something like this would work:
Subversion will always return one more result than you expect, so you can just discard it. See the box labeled "Is Subversion a Day Early?" on this page:
http://svnbook.red-bean.com/en/1.5/svn.tour.revs.specifiers.html#svn.tour.revs.dates
I'd recommend making this script analyze the log messages in the prior full hour period, not the hour preceding the time that you run the script, since even if you schedule it to run via cron, it might not run at exactly the same time every hour, especially if you're analyzing several repositories one after another.
StartDate=`date -d '1 hour ago' +'%F %H:00:00'`
You also will want to use the -q switch to svn log to save some bandwidth; since you're already using egrep to discard the log messages anyway you may as well not transfer them from the server. You wouldn't even need to use egrep then, really, since you could just take the number of lines of the quiet log output, subtract 3 (to remove the dividing line, the extra log message, and another dividing line), and divide by 2 (to remove the remaining dividing lines), to get the number of changes in this time period.
count_log_lines=`svn log -q -r "{${StartDate}}:{${EndDate}}" file:///${SvnBase}/${1} | wc -l`
|
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.