问题
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:
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...
回答1:
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.
来源:https://stackoverflow.com/questions/30225099/get-revision-number-of-a-tagged-file-in-wincvs