How to get a list of tags created in CVS repository?
Asked Answered
S

5

20

Are there any CLI commands that can be used to get a list of Tags that have been created on a branch or head of a module within a specified time frame?

What I briefly need is a list of Tags and the date when they were created. Given following parameters

  1. Module Name
  2. Branch Name (or :: HEAD)
  3. Start Date
  4. End Date
Shemeka answered 30/5, 2011 at 9:52 Comment(0)
S
15

One can list tags or branches present in a module using the following command. This is something picked up from another answer at SO

To list all tags:

cvs -Q -d :pserver:*User*:*Pass*@*HostName*:/cvsroot rlog -h *Module*| awk -F"[.:]" '/^\t/&&$(NF-1)!=0{print $1}' | sort -u

To List all branches:

cvs -Q -d :pserver:*User*:*Pass*@*HostName*:/cvsroot rlog -h *Module*| awk -F"[.:]" '/^\t/&&$(NF-1)==0{print $1}' | sort -u

This uses the magic branch numbers to identify is a symbolic link is a branch or a tag.

As skaffman mentioned in one of the answers on this page, it is not possible to determine date when tag is created. The best one can do is to identify an approximate date by considering the most recent date listed in the logs for that tag.

Something like this:

cvs -Q -d :pserver:*User*:*Pass*@*HostName*:/cvsroot rlog -N -S -r*TagName* *Module* | grep ^date: | sort | tail -1 | cut -d\; -f1 | sed -e 's/date: //'

This is a bash script I worked out to give list of all tags with their approx. creation date

#!/bin/bash

CVSROOT=$1
PROTOCOL=$2
LOGIN=$3
PASSWORD=$4
MODULE=$5
REVISION=$6
OUTPUT=$7

CVS_HOST=""
if test "${PASSWORD:-t}" != "t" ; then
    CVS_HOST=":${PROTOCOL}:${LOGIN}:${PASSWORD}@${CVSROOT}"
else
    CVS_HOST=":${PROTOCOL}:${LOGIN}@${CVSROOT}"
fi

CVS_REVISION=""
if test "${REVISION:-t}" != "t" ; then
    CVS_REVISION="-r${REVISION}"
fi

echo "\"Tag Name\",\"Create Date\"" > ${OUTPUT}

echo "EXEC: cvs -Q -d ${CVS_HOST} rlog -h -S ${CVS_REVISION} ${MODULE} | awk -F"[.:]" '/^\t/&&\$(NF-1)!=0{print \$1}' | sort -u"
cvs -Q -d ${CVS_HOST} rlog -h ${CVS_REVISION} ${MODULE} | awk -F"[.:]" '/^\t/&&\$(NF-1)!=0{print $1}' | sort -u | while read tagName
do
    #get approx create date
    echo "EXEC: cvs -Q -d ${CVS_HOST} rlog -N -S -r$tagName ${MODULE} | grep ^date: | sort | tail -1 | cut -d\; -f1 | sed -e 's/date: //'"
    date=`cvs -Q -d ${CVS_HOST} rlog -N -S -r$tagName ${MODULE} | grep ^date: | sort | tail -1 | cut -d\; -f1 | sed -e 's/date: //'`

    #Save to output file
    echo "\"$tagName\",\"$date\"" >> ${OUTPUT}
done
Shemeka answered 31/5, 2011 at 7:25 Comment(1)
The list all tags command appears to work, but I get the error "Terminated with fatal signal 11" before it prints the output.Cottager
M
22

I just learned:

cvs status -v

Lists all tags and braches for each and any file together with the revision it belongs to.

You could work from there ...

Mizell answered 15/8, 2013 at 8:39 Comment(0)
S
15

One can list tags or branches present in a module using the following command. This is something picked up from another answer at SO

To list all tags:

cvs -Q -d :pserver:*User*:*Pass*@*HostName*:/cvsroot rlog -h *Module*| awk -F"[.:]" '/^\t/&&$(NF-1)!=0{print $1}' | sort -u

To List all branches:

cvs -Q -d :pserver:*User*:*Pass*@*HostName*:/cvsroot rlog -h *Module*| awk -F"[.:]" '/^\t/&&$(NF-1)==0{print $1}' | sort -u

This uses the magic branch numbers to identify is a symbolic link is a branch or a tag.

As skaffman mentioned in one of the answers on this page, it is not possible to determine date when tag is created. The best one can do is to identify an approximate date by considering the most recent date listed in the logs for that tag.

Something like this:

cvs -Q -d :pserver:*User*:*Pass*@*HostName*:/cvsroot rlog -N -S -r*TagName* *Module* | grep ^date: | sort | tail -1 | cut -d\; -f1 | sed -e 's/date: //'

This is a bash script I worked out to give list of all tags with their approx. creation date

#!/bin/bash

CVSROOT=$1
PROTOCOL=$2
LOGIN=$3
PASSWORD=$4
MODULE=$5
REVISION=$6
OUTPUT=$7

CVS_HOST=""
if test "${PASSWORD:-t}" != "t" ; then
    CVS_HOST=":${PROTOCOL}:${LOGIN}:${PASSWORD}@${CVSROOT}"
else
    CVS_HOST=":${PROTOCOL}:${LOGIN}@${CVSROOT}"
fi

CVS_REVISION=""
if test "${REVISION:-t}" != "t" ; then
    CVS_REVISION="-r${REVISION}"
fi

echo "\"Tag Name\",\"Create Date\"" > ${OUTPUT}

echo "EXEC: cvs -Q -d ${CVS_HOST} rlog -h -S ${CVS_REVISION} ${MODULE} | awk -F"[.:]" '/^\t/&&\$(NF-1)!=0{print \$1}' | sort -u"
cvs -Q -d ${CVS_HOST} rlog -h ${CVS_REVISION} ${MODULE} | awk -F"[.:]" '/^\t/&&\$(NF-1)!=0{print $1}' | sort -u | while read tagName
do
    #get approx create date
    echo "EXEC: cvs -Q -d ${CVS_HOST} rlog -N -S -r$tagName ${MODULE} | grep ^date: | sort | tail -1 | cut -d\; -f1 | sed -e 's/date: //'"
    date=`cvs -Q -d ${CVS_HOST} rlog -N -S -r$tagName ${MODULE} | grep ^date: | sort | tail -1 | cut -d\; -f1 | sed -e 's/date: //'`

    #Save to output file
    echo "\"$tagName\",\"$date\"" >> ${OUTPUT}
done
Shemeka answered 31/5, 2011 at 7:25 Comment(1)
The list all tags command appears to work, but I get the error "Terminated with fatal signal 11" before it prints the output.Cottager
M
5

If you have the history function enabled, you can execute the following command:

cvs history -a -T

It will give you some lines like this, giving you date+time, user, module and tagname of each tagging operation:

T 2011-04-02 07:55 +0000 ralph  mylib [testtag:A]

For more information check the cvsbook on history

Macintosh answered 1/6, 2011 at 2:20 Comment(0)
S
3

CVS can't do that, it's too primitive. Tags are attached to individual file revisions, not to the module or repository. Furthermore, the tags have no date metadata, so you can't tell when they were created, either.

So none of the selection criteria you specified can be used. The only criteria you can use is a specific versioned file, which will tell you which revisions have which tags, but that's it.

Superfine answered 30/5, 2011 at 10:6 Comment(4)
Is it possible to manipulate output of any of the CVS command to get this information?Shemeka
@Salman: No - like I said, CVS doesn't store that information.Superfine
Thanks. I have posted some of my finding and the way I am getting around the problem. This is not an accurate methods but gives me fairly good results. Can you take a look at the answer and let me know if you find something wrong here? I have just started with CVS a couple of days back, a second opinion will be of great help. Thanks.Shemeka
Actually CVS does store this kind of information in its history file. But this logging must be enabled when the repository is set up.Macintosh
H
0

I am Using Cvs Repository using cvsnt(install) ..

Queries:

1) I want only List of tag name from cvs.

2) How to create Repository using cvsnt.

3) How to Check-in Entire module into New Repository.

I try Sample:

1) when I try to create a new repository

cvs -d :pserver:<user>@<host>:<new_repository> init

2) Import Module into repository

cvs -d repository_path import name_of_project vendor_tag release_tag
Helicograph answered 12/7, 2019 at 7:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.