info-cvs
[Top][All Lists]
Advanced

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

Re: script for Branch locking in CVS


From: Mark D. Baushke
Subject: Re: script for Branch locking in CVS
Date: Tue, 04 Sep 2001 08:46:49 -0700

Hi Rakesh,

The way that I implemented this was to have the perl script that is
run by commitinfo read the CVS/Entries file


# start perl code extract

#!/usr/bin/perl

use strict;
use vars qw(%lockedbranch %cvsbranch %branchtag);

# the list of locked branches ... may also be read from a file
# like $CVSROOT/lockedbranches or something if desired
my @lockedbranches = qw(release_1 release_2 release_1a);
foreach my $key (@lockedbranches) {
    $lockedbranch{$key} = 1;
}

if (open(ENTRIES, 'CVS/Entries')) {
    my $ent;
    while ($ent = <ENTRIES>) {
        chomp;
        # /file/ver/timestamp/options/tag_or_date
        my(undef, $filename, $version, $ts, $opt, $tag) = split('/', $ent);
        if ($tag =~ /^T(.*)/) {
            # tag indication
            $cvsbranch{$filename} = $1;
        } elsif ($tag eq '') {
            $cvsbranch{$filename} = '';
        } else {
            $cvsbranch{$filename} = $tag;
        }
    }
    close(ENTRIES);
} else {
    die("Cannot open CVS/Entries.\n");
}

my $directory = $ARGV[0];
shift @ARGV;

my $die = 0;
foreach my $arg (@ARGV) {
    $branchtag{$cvsbranch{$arg}}++;
    if ($lockedbranch{$cvsbranch{$arg}}) {
        print STDERR "$directory/$arg is on a locked branch\n";
        $die = 1 unless ($directory eq 'CVSROOT');
    }
}

exit 1 if ($die);

#...perform other commitinfo checks here...

exit 0;

# end perl code extract

Of course, this may not be the most optimal method (and I didn't
actually test this particular code example), but you should be able
get the idea of how to do the job from it.

        Good luck,
        -- Mark

        
> From: "Rakesh Dhyani" <address@hidden>
> Date: Tue, 4 Sep 2001 09:54:33 +0530
> 
> I am looking for a patch/script for branch locking in CVS . I am using CVS
> 1.10 on RedHat 6.2.
> I have tried using CVS Admin command for this purpose but it doesnot work.



reply via email to

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