Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get revision number of a tagged file in WinCvs

This seems like it should be so simple, but I can't find any solution that appears to work...

I need a CVS command that given the name of a tag that you have applied to a file, it will give you the revision number.


CVS Tree structure:

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

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


The closest thing I can find is using the log command with the -Q flag, but that still gives me much more information than I need.

ex: cvs -Q log -h filename

Passing the tagname to the log command seems to have no effect.


CVS Version information:

enter image description here


My current solution is to use a perl script to parse the output from the log command but there has to be a simpler way...

like image 273
tjwrona1992 Avatar asked May 13 '15 21:05

tjwrona1992


People also ask

How can I see my CVS tag?

You can use the ' -v ' flag to the status command to see all tags that a file has, and which revision numbers they represent. Tag names must start with an uppercase or lowercase letter and can contain uppercase and lowercase letters, digits, ' - ', and ' _ '. The two tag names BASE and HEAD are reserved for use by CVS.

What are CVS tags?

Tags are often used to record the version number used by the developers, rather than the CVS revision number, which is used primarily as a CVS internal designation. Tag names must start with a letter and can contain alphanumeric characters, hyphens (-), and underscores (_).

How to delete a tag in CVS?

Deleting or moving a branch is done with the -d or -F command options to cvs tag and cvs rtag , in the same way you delete or move any other tag. CVS also requires the -B option in the command as a way of indicating that you know the tag denotes a branch and you really mean to move or delete it.


1 Answers

Passing a tag name (with a -r option) to the log command does have an effect, just not a particularly useful one and it's effect is hidden by "-h".

Usually the easiest way to get a revision number for your VERSION file (the normal use-case for this) is to include a keyword in it; ie:

# Thu 21 May 08:40:59 BST 2015
THISREV="$Revision$"

Note: to get a repository version number this VERSION file must be committed every time you make a commit to the repo.

If you need a revision for a specific file then you're basically falling back on scripting from the "symbolic names" part of the log. So for r-1-0-0 you do this:

cvs -Q log -h VERSION | awk '/^\tr-1-0-0:/ {print $NF;}'

There's no direct equivalent of the git describe command.

like image 191
user3710044 Avatar answered Oct 16 '22 16:10

user3710044