[cvsnt] Re: postcommit file

Bo Berglund bo.berglund at telia.com
Thu Feb 13 20:50:06 GMT 2003


On Thu, 13 Feb 2003 15:14:34 -0500, John Peacock <jpeacock at rowman.com>
wrote:

>Tony Hoyle wrote:
>> Postcommit doesn't have any input other than the repository name on the
>> command line... it's the last things that's called before cvs finishes.
>
>This is the piece of information I needed.  Actually, I altered my old 
>update_websites.pl script to just log what was being passed.  And what is 
>actually being passed is the full path to the directory updated, including the 
>local CVSROOT path.
>
>How hard would it be to make postcommit support some of the expansion variables 
>that loginfo supports?  Specifically, I'd like %{} to display only the path 
>relative to the repository root; it just make my script less cranky.  I have two 
>different groups of files I am updating: shared include files in one path and 
>then the site files in a completely different path.  Sometimes I want to just 
>pass the relative directory using %{} and other times I want to hard-code the 
>directory.  It would also be nice if %{CVSROOT} did what you would think it 
>would do here (although to be honest I haven't checked that).
>
>TIA
>
>John

If you create a loginfo script instead (or rather as an extra item)
and let this record what has been committed into a logfile of some
kind, then you could let the postcommit script read this and determine
if you need to update the site and also which files are involved.
The loginfo call will surely finish before the postcommit call is made
so there is no race between them either.
Your logic as to what to do can reside in the postcommit script and
the loginfo supplies the info to act on.
You can use the $CVSPID variable to get at the cvs process running the
commit so you can read the correct info in the postcommit file (but
you have to expande the PID a bit and get extra info to make the
identifier unique, like I had to in my mailing program).


/Bo
(Bo Berglund, developer in Sweden)


More information about the cvsnt mailing list