Ashot
Ashot

Reputation: 10959

What is the shortest way to get the last revision info of a file in cvs?

For getting check-in data about some file I use cvs log filename which prints long list of all revisions. Is threre a better way for getting only last check-in info (revision, data, user). I have seen cvs log options, the -r option want revision number. Is there a way of getting it without knowing the revision number?

Upvotes: 1

Views: 331

Answers (2)

Neil Cafferkey
Neil Cafferkey

Reputation: 1

I found out by accident that using the -r option on its own (without giving a specific revision, range etc.) gives information about the latest revision only:

cvs log -r filename

Upvotes: 0

Clare Macrae
Clare Macrae

Reputation: 3799

There doesn't seem to be a way, with cvs log to request just the last revision to a file, according to this reference page.

cvs log -N excludes tag names, to shorten the output, and you could pipe it through head -20, for example, to reduce the volume of output:

cvs log -N filename | head -20

Depending in how clever you want to get - or how much time you want to spend on this - you could do better, by using the fact that cvs status gives you the current version number of a file, e.g.

cvs -Q status  Readme.Overview.txt
===================================================================
File: Readme.Overview.txt       Status: Up-to-date

   Working revision:    1.7
   Repository revision: 1.7     /cvsroot/tortoisecvs/TortoiseCVS/Readme.Overview.txt,v

So you could write a script that extracts the Working revision value from that output, and then passes it to cvs log -r.

Upvotes: 2

Related Questions