info-cvs
[Top][All Lists]
Advanced

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

RE: Query in using CVS


From: Stanke, Kay
Subject: RE: Query in using CVS
Date: Mon, 24 Nov 2003 10:36:33 +0100

First of all pardon for non ascii answer but company rules bind me.

The following script is run from our commitinfo hook:

# Please update your path variable with whatever you want to have to get to all
# the tools you need for this script
PATH=/bin:/usr/bin

# This variable contains the list of branches to lock - update this list as per
# your requirement
locked_branches="[INSERT THE BRANCH_TAGS HERE SEPERATED BY BLANKS]"
enabled_user="[INSERT THE CVS_USER_NAMES HERE SEPERATED BY BLANKS]"

# This variable contains the email-ids of people to bug if the checkin fails
# You would probably want to list the ids of the Release Engineers and the CVS admins
people_to_bug="[INSERT VALID EMAIL-ADDRESS TO NOTIFY]"

ErrorExit () {
        Branch=$1

        echo " "
        echo "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !WARNING ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! "
        echo "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !COMMIT FAILED ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! "
                echo " "
        echo "${Branch} is closed for commits for ${USER}"
                echo "Please contact $people_to_bug"
                echo " "
        echo "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !COMMIT FAILED ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! "
                echo " "
        exit 1
}

# This for is probably unnecessary since this script would get two argument - full path to the
# directory where you are doing the checkin and the file you are checking in
for file in $@
do
                # This makes $1 point to the file I am checking in
        shift

                # Grap the 6th field - that contains the branch name.
               Branch=`grep $1 CVS/Entries | awk -F/ '{print $6}' | cut -c2-`
               echo "Checking permisssions on branch ${Branch} for user ${USER}"
                if [[ ${Branch} != "" ]]
                then
                        for locked_branch in $locked_branches
                        do
                            if [[ ${USER} != $enabled_user ]]
                            then
                                test ${Branch} != $locked_branch  || ErrorExit ${Branch}
                            fi

                        done
                else
                fi
        exit 0
done

Perhaps you can use it as a stub and refine it to your needs like generating a notify mail to admins or checking the branch the commit takes place on by a pattern.

Hope this helps. Have fun
Kay Stanke

Informationstechnologie
Anwendungsentwicklung Web & Data Warehouse

ProACTIV_______________________________________
CiV Versicherungen t PB Versicherungen t PB Pensionsfonds AG

ProACTIV-Platz 1, 40721 Hilden
tel  +49 (0) 21 03-34 - 70 26
fax +49 (0) 21 03-34 - 70 29
mailto:address@hidden
internet:       www.proactiv.de


reply via email to

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