Discussion:
Question about CVS Trigger Scripts
App Penetrator
2010-08-20 21:41:43 UTC
Permalink
I've been using the documentation and configuration file comments to come up
with pre-commit and post-commit hooks for CVS that have been working very
well, but there is a caveat:

These scripts are run for each different directory that is committed. This
means, when I commit multiple updated directories in one commit command, my
trigger scripts are called more than once. Precisely once for each
different directory in the commit.

This is fine for most cases, but I would like to be able to determine when
the _entire_ commit has begun and when it has ended. Is it possible? How
can I do it?

Thanks,

appp
Arthur Barrett
2010-08-22 22:46:03 UTC
Permalink
Hi appp,

It's really not that simple.

Over at the CVSNT project (GPL/Free Software, runs on Unix/Linux as well as Windows etc) we struggled with this sort of thing when we created the failsafe audit plugin for CVSNT. Thankfully CVSNT has a 3GL trigger interface as well as the script trigger interface - but we still had to radically alter the core code, I'll explain why.

Not only are scripts called per-directory - CVS processing behaves the same way. So you can successfully commit half your files, and then some failure occurs (eg: deadlock, revision not up to date because someone else committed a new revision while your process was processing some other module) the server process exits.

Now these 'exits' happen all over the place - whilst some are easy to spot, others take a lot of digging. In short to ensure that some 'postcommand' process gets ran EVERY time (end of commit) required a lot of work.

CVSNT is ported from CVS 1.11 codeline - so there is a chance that the 1.12 codeline has addressed this - but I'm sceptical.

So in short: you can use precommand/postcommand (I'm not sure which version of CVS has these triggers - all I know is we've got them in CVSNT) and build up a list of what to handle in postcommit and handle the case where postcommand is never called.

If your implementation requires these sorts of functions then I personally recommend CVSNT instead of CVS (but I would wouldn't I - after spending the last 6 years working on it...).

Regards,


Arthur Barrett



-----Original Message-----
From: info-cvs-bounces+arthur.barrett=march-***@nongnu.org on behalf of App Penetrator
Sent: Sat 21/08/2010 7:41 AM
To: info-***@gnu.org
Cc:
Subject: Question about CVS Trigger Scripts

I've been using the documentation and configuration file comments to come up
with pre-commit and post-commit hooks for CVS that have been working very
well, but there is a caveat:

These scripts are run for each different directory that is committed. This
means, when I commit multiple updated directories in one commit command, my
trigger scripts are called more than once. Precisely once for each
different directory in the commit.

This is fine for most cases, but I would like to be able to determine when
the _entire_ commit has begun and when it has ended. Is it possible? How
can I do it?

Thanks,

appp
Paul Sander
2010-08-23 09:05:17 UTC
Permalink
Or you can write a program that accepts CVS' command line arguments
and environments, invokes the CVS command line, and calls per-command
triggers as appropriate based on its input and the CVS exit status.
Post by Arthur Barrett
Hi appp,
It's really not that simple.
Over at the CVSNT project (GPL/Free Software, runs on Unix/Linux as
well as Windows etc) we struggled with this sort of thing when we
created the failsafe audit plugin for CVSNT. Thankfully CVSNT has a
3GL trigger interface as well as the script trigger interface - but
we still had to radically alter the core code, I'll explain why.
Not only are scripts called per-directory - CVS processing behaves
the same way. So you can successfully commit half your files, and
then some failure occurs (eg: deadlock, revision not up to date
because someone else committed a new revision while your process was
processing some other module) the server process exits.
Now these 'exits' happen all over the place - whilst some are easy
to spot, others take a lot of digging. In short to ensure that some
'postcommand' process gets ran EVERY time (end of commit) required a
lot of work.
CVSNT is ported from CVS 1.11 codeline - so there is a chance that
the 1.12 codeline has addressed this - but I'm sceptical.
So in short: you can use precommand/postcommand (I'm not sure which
version of CVS has these triggers - all I know is we've got them in
CVSNT) and build up a list of what to handle in postcommit and
handle the case where postcommand is never called.
If your implementation requires these sorts of functions then I
personally recommend CVSNT instead of CVS (but I would wouldn't I -
after spending the last 6 years working on it...).
Regards,
Arthur Barrett
-----Original Message-----
Sent: Sat 21/08/2010 7:41 AM
Subject: Question about CVS Trigger Scripts
I've been using the documentation and configuration file comments to come up
with pre-commit and post-commit hooks for CVS that have been working very
These scripts are run for each different directory that is
committed. This
means, when I commit multiple updated directories in one commit command, my
trigger scripts are called more than once. Precisely once for each
different directory in the commit.
This is fine for most cases, but I would like to be able to
determine when
the _entire_ commit has begun and when it has ended. Is it
possible? How
can I do it?
Thanks,
appp
Martin Neitzel
2010-08-24 22:51:53 UTC
Permalink
These scripts are run for each different directory that is committed. [...]
This is fine for most cases, but I would like to be able to determine when
the _entire_ commit has begun and when it has ended. Is it possible? How
can I do it?
Have a look at $PREFIX/share/cvs/contrib/commit_prep and .../log_accum.
They work in concert to send out combined commit mails, good comments
are in commit_prep.

Martin Neitzel

Loading...