info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: simple example of commitinfo


From: Mark E. Hamilton
Subject: Re: simple example of commitinfo
Date: Thu, 17 Nov 2005 11:35:47 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

Hensley, Jeffrey L ERDC-ITL-MS Contractor wrote:
Okay, I thought that using commitinfo would be straightforward, but I’m clearly missing something.

What I would like to do is to do a check to make sure that the C source files have the “agreed-upon” formatting before they are commited. And I want to do this by running “indent” on them.

Can someone point me to some example with what needs to be in the commitinfo file, plus a script that takes the filename(s) are runs a check on them?

Read these:

http://ximbiot.com/cvs/manual/cvs-1.11.21/cvs_18.html#SEC171
http://ximbiot.com/cvs/manual/cvs-1.11.21/cvs_18.html#SEC181


Try this:

Add this to CVSROOT/commitinfo:

ALL ${CVSROOT}/CVSROOT/test_script


Add this to CVSROOT/checkoutlist:

test_script Could not update CVSROOT/test_script


Create CVSROOT/test_script with this:

#!/bin/sh
dirName=$1
shift
for filename in $*
do
    test ! -e $filename && continue
# Simple check
    egrep >/dev/null 2>&1 'blah' $filename ||
        { echo "Failure message" ; exit 1 ; }
# Or complex check
    check_for_formatting_here $filename ||
        { echo "Failure message" ; exit 1 ; }
    ...
done


I don't think that you can modify files within the commitinfo script, and even if you can I wouldn't recommend it. (Users get cranky when something changes their code behind the scenes.) It should probably only check for the correct format, and bail if it is incorrect.

http://ximbiot.com/cvs/manual/cvs-1.11.21/cvs_18.html#SEC171

Any scripts that commitinfo runs (directly or indirectly) need to be somewhere in the repository (${CVSROOT}/CVSROOT is commonly used) and named in the checkoutlist file.

http://ximbiot.com/cvs/manual/cvs-1.11.21/cvs_18.html#SEC181

--
----------------
Mark E. Hamilton
Orion International Technologies, Inc.
Sandia National Laboratory, NM.
505-844-7666





reply via email to

[Prev in Thread] Current Thread [Next in Thread]