Getting the revision number of the end of a branch in WinCvs

117 Views Asked by At

I need a CVS command that given the name of a branch, it will give you the revision number of the last file in that branch.


CVS Tree structure:

(filename)
    |
    +--> 1.1-----(branch)
          |         |
          |      1.1.1.1
          |         |
          |      1.1.1.2
          |         |
          |      1.1.1.3
          |
          |
         1.2
          |
          |
          :

For example: Using a CVS command, given the tag name "branch", how can I get CVS to give me the revision number "1.1.1.3"?


I have tried using the log command and expected to be able to parse the output of the log command in order to get the version number, but the version that the log command outputs for the branch does not match the version number at the end of the branch.

ex: cvs -Q log -h filename


CVS Version information:

enter image description here


I posted a similar question here about getting the version number of a file from a tag name. I never got a clear answer on how to do that either, but I was able to find a workaround by parsing the log output with a Perl script.

Since the log output for the branch does not match the version number at the end of the branch my Perl script solution doesn't work here.

1

There are 1 best solutions below

1
On BEST ANSWER

you should use cvs log -rMyBranch. MyFilename, where MyBranch. is branch in question with dot added as last character, and MyFilename is filename in question.

Example:

cvs log -rTestBranch. TestFile.txt

RCS file: C:\cvsroot/TestRepository/TestFile.txt,v
Working file: TestFile.txt
head: 1.2
branch:
locks: strict
access list:
symbolic names:
    TestBranch: 1.2.0.2
keyword substitution: kv
total revisions: 4; selected revisions: 1
description:
----------------------------
revision 1.2.2.2
date: 2015/06/08 18:32:52;  author: Codeguard;  state: Exp;  lines: +1 -1;  kopt: kv;  commitid: 117c5575dfce6e9e;  filename: TestFile.txt;
2
=============================================================================

From there, you can easily parse the revision.