#!/usr/bin/perl
#
# prettyClientView.pl - a trigger to create a user appropriate client view
# for new clients, but only for people in group 'registered'
#
# Usage: prettyClientView.pl %formname% %formfile% %user%
#
use strict;
my $p4user = "webkeeper";
my $p4passwd = "webber";
my $p4port = "localhost:1666";
my $p4exec = "/p4/1/bin/p4_1";
my $p4 = "$p4exec -p $p4port -u $p4user -P $p4passwd ";
my $clientname = shift;
my $clientspec = shift;
my $user = shift;
my $result = `$p4 groups -u $user`;
if( $result !~ /registered/ )
{
exit 0;
}
my @results = `$p4 clients`;
my $clientFound = 0;
foreach( @results )
{
if( /^Client\s$clientname\s/ )
{
$clientFound = 1;
}
}
if( $clientFound )
{
exit 0;
}
open CLIENT, "<$clientspec" or die "couldn't find file: $clientspec";
my $newspec;
my $viewSeen = 0;
while( <CLIENT> )
{
if( /^View:/ )
{
$viewSeen = 1;
$newspec .= $_;
$newspec .= "\t//guest/$user/... //$clientname/...\n";
next;
}
elsif( !$viewSeen && /^\s/ )
{
$newspec .= $_;
}
elsif( /^\w*:/ )
{
$viewSeen = 0;
$newspec .= $_;
}
}
close CLIENT;
open CLIENT, ">", $clientspec or die $!;
print CLIENT $newspec;
close CLIENT;
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #2 | 24949 | Perforce maintenance |
Deleted triggers that have now been moved to the /p4/hms server instance, and no longer live in this /p4/1 instance. The files were moved to live in the server in wayfarer-p4d:/p4/common/bin/triggers. |
||
| #1 | 14803 | Lester Cheung | Some of the triggers in use... |