Preets
Preets

Reputation: 6952

Tortoise CVS - Prevent a user from committing changes in a branch?

How do I prevent a developer from committing changes into a particular branch in CVS?

Recently, a fellow developer committed code into the main branch, leaving me with a lot of rolling back to do ;-( How can I prevent this?

Upvotes: 1

Views: 2918

Answers (3)

Mark
Mark

Reputation: 11

This approach works for me:-

1) Create a shell script that checks the branch being committed against a parameter. I store this in CVSROOT for convenience, but it can be anywhere on the CVS server.

#!/bin/bash

if [ -f CVS/Tag ]
then
  TAG=`cat CVS/Tag`
else
  TAG=THEAD
fi

if [ "$TAG" == "T$1" ]
then
  echo Cannot commit to $1
  exit 1
else
  echo Commit ok
fi
exit 0

Then modify the commitinfo file to run this script for a particular branch:-

ALL /cvs/repos/CVSROOT/checkbranch.sh YOUR-BRANCH-NAME-HERE

This will then cause the script to run for all checkins. It will pass the branch name as a parameter. The script will compare the parameter against the branch for the code being checked in, and will throw an error if they match. If you want to lock multiple branches, then add multiple lines to commitinfo.

Obviously if a developer really wants to commit something, they can hack the commitinfo file, but it prevents mistakes rather than deliberate attempts to break things.

Upvotes: 1

Oliver Giesen
Oliver Giesen

Reputation: 9439

Might not be the case but if you're running CVSNT on the server you can simply use the cvs chacl command. See http://cvsnt.org/manual/html/chacl.html for details. I haven't used TortoiseCVS in a while but I guess there might even be a GUI option for that in there (your server would still have to be CVSNT for it to actually work).

Note that TortoiseCVS is just a graphical frontend for the CVSNT client. Your questions will be easier to answer if you supplied some information about your server.

Upvotes: 1

Eduard Wirch
Eduard Wirch

Reputation: 9922

Change the access permissions for this user for this particular branch to read only.

Honestly, I don't have a clue. But this may help: CVS Access Control List Extension Patch

Upvotes: 1

Related Questions