[Top][All Lists]

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

Re: CommitInfo - how do I figure out branch or Trunk..

From: Mark D. Baushke
Subject: Re: CommitInfo - how do I figure out branch or Trunk..
Date: Sun, 27 Apr 2003 07:57:08 -0700

Vivek Venugopalan <address@hidden> writes:

> Hello
>   I would like to figure out whether a commit request is happening on a
> branch or the trunk.  Is there any way to do that in a commitinfo triggered
> script?  The background is that I want to prevent check in of files to
> branches which is considered as "dead" from the project perspective.  Any
> ideas?
> Thanks
> Vivek

The commitinfo triggered script may run a command like 'cvs -n status'
on the list of files and you could parse that looking for any 'dead'
'Sticky Tag:' entry. Another possibility is to actually read the
CVS/Entries file looking for the files that are being tested and
reject commits that deal in the branch you consider dead.

This is a perl fragment that can read a CVS/Entries file:

$ENTRIES = 'CVS/Entries';
open(ENTRIES, $ENTRIES) || die("Cannot open $ENTRIES.\n");
while (<ENTRIES>) {
    # /file/ver/timestamp/options/tag_or_date
    my($filename, $version,$ts,$opt,$tag) = split('/', substr($_, 1));
    $cvsversion{$filename} = $version;
    if ($tag =~ /^T/) {
        $tag =~ s,^T,-r,;               #  tag indication
    if ($tag eq '' || $tag =~ /^-r/) {
        $cvsbranch{$filename} = $tag;
    $cvsoption{$filename} = $opt;

the $cvsbranch{$filename} will contain a -rTAG or '' value that was
given by the user on checkout or update of their tree, so you could
compare it against the list of -rdead-branch values you want to use.

        Good luck,
        -- Mark

reply via email to

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