Below is a fragment of our pre-checkin trigger. It looks up a table
in a mySQL database to see if the current user is allowed to checkin
on this branch. I've left out a lot of the script, but there should be enough
there to show you how it works. We also have CGI scripts that allow
the branch owner (or Clearcase admin) to update the set of people that
can work on the branch, stored in the mySQL database.
Lezz Giles
if ($ENV{CLEARCASE_OP_KIND} eq "checkin") {
my ($file, $branch, @users, $username, $view);
if ($OSNAME eq "MSWin32") {
require "Win32.pm";
$username = &Win32::LoginName;
} else {
$username = (getpwuid($<))[0];
}
$branch = $ENV{CLEARCASE_BRTYPE};
$view = $ENV{CLEARCASE_VIEW_TAG};
#######################################
# Connect to the SCM database
$dbh = DBI->connect('DBI:mysql:scm:vbsrv1', 'guest', '');
$dbh || die "Error connecting to database: $DBI::errstr\n";
...
#######################################
# Get the branch details
$cur = $dbh->prepare("SELECT type,state,owner,hasToken,team FROM branch
WHERE name = ".
$dbh->quote($branch).
" AND component = ".$dbh->quote($component).
" AND codebase = ".$dbh->quote($codebase)
);
$cur->execute();
my ($type,$state,$owner,$hasToken,$team) = $cur->fetchrow_array();
$cur->finish();
...
my ($IHaveToken) = grep {$_ eq $username;} (split(/ /,$hasToken));
my ($IAmOnTeam) = grep {$_ eq $username;} (split(/ /,$team));
if ($team eq "ALL") { $IAmOnTeam = 1; }
...
#######################################
# For a project branch, if anybody else has the token then fail; also must
be on team
} elsif ($type eq "project") {
if (($hasToken && ($ENV{CLEARCASE_OP_KIND} eq "checkin")) && ! $IHaveToken) {
print "The branch owner, $owner, has restricted access on this branch
temporarily.\n";
exit $FAILURE;
}
unless ($IAmOnTeam) {
print "In order to make any changes on a project branch, you must be a
member of the branch team.\n";
print "Talk to the branch owner, $owner, for details.\n";
exit $FAILURE;
}
}
"Chavvakula, Nagalakshmi" wrote:
> Hi,
> We have some development policies,
> 1.All developers are working on development branch and only during the
> release time We are bringing ( merging) the code to main line.
> 2. I locked the main line except clearcase admin account.
> 3. Now we want to make some more branches for some module specific
> development and ,
> open the main line for bugfixes ( only for some of the developers approved
> by team lead.), So I want to remove the lock on main line and use some
> script to control the checkin.
>
> If any one is having a script for , asking like you want to add/remove
> developer to checkin?
> echo the list of developers already having checkin permission etc..? If any
> one is having one i want to share and modify for my requirement.
>
> Thanks and regards.
> nagalakshmi.
>
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
-- Leslie Giles Software Release Manager Avici Systems Inc lgiles@avici.com Phone: 978.964.2030 Fax: 978.964.2100"Do not fear the merge"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This archive was generated by hypermail 2b29 : Tue Jul 31 2001 - 22:04:03 EDT