|
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
-----Original Message-----
From: address@hidden [SMTP:address@hidden On Behalf Of Karl-König Königsson
Sent: Friday, November 21, 2003 9:44 AM
To: JacobRhoden
Cc: cvs
Subject: Re: Query in using CVS
This is all very well if you are content with a granularity on module or
directory level. What if you have branches of your code and want to
control access to that?
I want, for instance, in my project people to be able to check in rather
freely in HEAD, but once a version is released (or about to be released)
we branch the code tree and then there are other rules.
After this point must all checkins go through code moderators and they
should be the only ones allowed to check into this particular branch.
Is this possible? Or rather: has anyone done this before and is willing
to share their code/findings?
Cheers!
Karl-Koenig Koenigsson
[Prev in Thread] | Current Thread | [Next in Thread] |