How to check CVS branch point?

First, I have to admit that I twisted CVS a bit. I had a release tag releaseXthat was made some time ago (i.e. Not HEAD). Then I decided that at this moment I needed a service branch. Instead of creating a branch tag ( branchX) in addition to releaseXI removed the release tag and created a branch tag (erroneously) with the name releaseX. Then I continued to work on this service branch and created releaseX1, releaseX2etc.

My problem: when I check releaseX, I get a branch branch, i.e. The last code from this thread. Now I need the code at the branch point, i.e. The first code releaseX.

Is there any way to do this?

Reverting to a previous version of the repository from the backup is not an option.

Edit: I know I can get around this by doing a date-based check. I would like to know if it is still possible to use tags.

Update (Re @Philip Derbeko): I know that CVS does not correlate between files. But CVS has information about where the branch originated. In ViewVC, I even see this:

File X - Revision 1.y - Branch: MAIN - Branch point for: releaseX

Next file version:

File X - Revision 1.y.2.1 - Branch: releaseX - CVS Tags: releaseX1

Metadata appears to exist. Hence my question: Is it possible to check the branch point and not the HEAD branch?

+5
source share
4 answers

, , , - . . , "ReleaseX0", , , "ReleaseX" . , MAIN, :

cvs co -r releaseX -D "2008-12-30" modulename
cvs co -D "2008-12-30" modulename

:

cvs tag releaseX0

, .


, releaseX releaseX_branch, :

cvs rtag -r releaseX releaseX_branch modulename
cvs rtag -d releaseX modulename

"cvs admin -N <old> : <new> ", . - . ( , ;-).), Renaming . , , .

+9

- , - Google. , . - . - , .

, , PERL script. , : http://www.cvsnt.org/pipermail/cvsnt/2006-February/024063.html

CVS: CVS .0.x . , mainline 1,18, 1.18.0.x, X - ( , x 2 → 1.18.0.2). ".0" , 1.18.0.2, 1.18.2.1, 1.18.2.2. : http://www.astro.princeton.edu/~rhl/cvs-branches.html#branchnumbers

perl script : https://github.com/effectiveprogramming/ep-cvs/wiki/List-CVS-Tags, CVS -t, , , . script : "cvs -q status -R -v filename", ".0" , ".x" . script github . script , _BP.

#!/usr/bin/perl

# Simple perl script.  Given a branch name, determine 
# the file revision a branch was created on for all 
# files in a repository and tag those files with a user defined tag.    
# Created 2013/04/05 CPG
# $Id: lstag,v 1.1 2002/09/26 10:02:53 ec Exp $

use strict;

$::VERSION = "1.0";
$::cvs_ID = '$Id: lstag,v 1.1 2002/09/26 10:02:53 ec Exp $'; #'

undef ($::repo);
# Try #1 to get CVS repository location
if (-r "CVS/Root") {
    open (INF, "<CVS/Root") || die "Failed to read CVS/Root file!\n";
    ###chop ($::repo = <INF>);
    $::repo = <INF>;
    close (INF);
} else {
    # Try #2 to get CVS repository location
    if (!$::ENV{"CVSROOT"}) {
        print "CVSROOT environment variable not found!\n";
        print "CVS not detected...\n";
        exit (10);
    }
}
$::repo =~ s/\n$//g;
$::repo =~ s/\r$//g;
($::repo) = $::repo =~ /([^:]+)$/;
$::repo =~ s/\/*$/\//;

### print "CVS repository at $::repo\n";


# Check commandline arguments
if ($#ARGV < 0) {
    print "Missing argument!\n";
    print "Usage: $0 [ tag]\n\n";
    print "Where: tag is number of "; 
    print "     each file this tag was created.\n";
    print "       tag   shows list of files with this tag\n";
    print "\n";
    exit (1);
}

# Get desired tagname
$::tag = $ARGV[0];
$::taglist = 0;
if ($::tag eq "-l") {
    $::taglist = 1;
}



# Run cvs status and catch output
open (INF, "cvs -q status -R -v |") || die "Failed to run cvs status command!\n";
chop (@::STATUS = <INF>);
close (INF);

# Parse status
$::state = 0;
$::fpath = $::frpath = $::fname = $::fstatus = $::ftag = $::ftagrev = "!UNINITIALIZED VARIABLE!";
undef (%::TAGS);
$::found = 0;
for $::lc (0 .. $#::STATUS) {
    $_ = $::STATUS[$::lc];
    if ($::state == 0) {
        if (/^File:/) {
            ($::fname, $::fstatus) = /^File:\s+(\S+\s*\S+)\s+Status:\s+(\S+)/;
            $::state = 1;
        }
        next;
    }
    if ($::state == 1) {
        if (/^\s+Repository revision:/) {
            ($::frpath) = /(\/.*),v/;
            ($::fpath) = $::frpath =~ /^$::repo(.*)$/;
            push @::INFOL, ( $::fpath );
            $::current = $::fpath;
            $::INFO{$::current}->{"rpath"}  = $::frpath;
            $::INFO{$::current}->{"name"}   = $::fname;
            $::INFO{$::current}->{"status"} = $::fstatus;
            $::fpath = $::frpath = $::fname = $::fstatus = "!UNINITIALIZED VARIABLE!";
            $::state = 2;
        }
        next;
    }
    if ($::state == 2) {
        if (/^\s+Existing Tags:/) {
            $::state = 3;
        }
        next;
    }
    if (/^\s+\S+\s+\([^:]+:/) {
        ($::ftag, $::ftagrev) = /^\s+(\S+)\s+\([^:]+:\s+([^\)]+)\)/;
        if ($::taglist) {
            $::TAGL{$::ftag}++;
        }
        if ($::ftag eq $::tag) {
            $::found++;
            $::INFO{$::current}->{"tag"} = $::ftag;
            $::INFO{$::current}->{"tagrev"} = $::ftagrev;
            $::ftag = $::ftagrev = "!UNINITIALIZED VARIABLE!";
        }
    } else { $::state = 0; }
}

# Print results
print "$0 - CVS tag and file lister version $::VERSION\n";
print "ID: $::cvs_ID\n\n";
if ($::taglist) {
    print "List of all known tags:\n\n";
    foreach $::key (sort {uc($a) cmp uc($b)} keys %::TAGL) {
        print "$::key\n";
    }
} else {
    print "Files with tag \"$::tag\":";
    if ($::found > 0) {
        print "\n\n";
    } else {
        print "  NONE\n";
    }
    for $::i (0 .. $#::INFOL) {
        if (!defined($::INFO{$::INFOL[$::i]}->{"tag"})) {
            next;
        }
        $::name = $::INFOL[$::i];
        $::status = $::INFO{$::name}->{"status"};
        $::tagrev = $::INFO{$::name}->{"tagrev"};

        #  Code added to apply a tag to a branch point:
        # regex to strip from last '.' to end of revision #.
        $::ge = '\.[^\.]*$';

        $::branchPtRev = $::tagrev;
        $_ = $::branchPtRev;
        s/$::ge//;
        $::cmd = "cvs tag -r".$_." ".$::tag."_BP " . $::name . " xst";

        #printf "%10s %s\n", ($_, $::name);

        #  printf "%10s %10s\n", ($::branchPtRev, $_);

        #printf $::cmd;
        #  printf "\n";

        # Run cvs command
        open (INF, $::cmd) || die "Failed to run cvs status command!\n";
        close (INF);
    }
}

print "Script Completed Successfully\n";
+4

CVS. , , . CVS HEAD 1.N, X, , 1.X.B.M. releaseX script, , , 1.X, . , , .

+2

, . , , - . , CVS , . , , , . , script, .

, , ( , ) . , CVS, .

CVS :)

+1

All Articles