views:

399

answers:

4

When I do a cvs status of my project I get different revision numbers for different files. What is happening here? Should not all the files have the same revision number?

A: 

CVS doesn't have global revision numbers, they are per-file. (In fact, CVS doesn't even have atomic commits)

Rytmis
CVSNT does have atomic commits, though.
Oliver Giesen
Hmm, thanks for the clarification. :)
Rytmis
+8  A: 

The CVS revision number reflects how many times that file has been changed. If you want something consistent across a project you'll need to use cvs tag after committing to give everything a consistent label.

Nick Fortescue
Coming from SVN had a harrowing experience with CVS today. I had to revert my project back to a certain state. So I checked the revision no of one of the files in the commit I wanted to revert to and tried to update my project to that revision using update -r command. Everything got screwed. Then I saw the time of the commit and updated the project to that time using update -D. Is this the best way to do it or is there any other method?
Abhi
Yes, there is another method. It's called tagging. If you're using CVSNT there's also commit IDs (auto-generated) and bug IDs (user-specified).
Oliver Giesen
explanation of CVS numbers: http://www.network-theory.co.uk/docs/cvsmanual/Revisionnumbers.html
SashaN
@Abhi: If there's a state you think you might want to revert to, tag it. Check everything out, get it the way you want, and "cvs tag". The next best thing is to go by time with -D, as you tried, but you can get an inconsistent state. If somebody was doing a large commit at that time, you may only pick up some of it. Using "cvs rtag" instead of "cvs tag" has exactly the same problem.
David Thornley
+4  A: 

no. cvs does not have a single revision number like more modern version control systems. Each file has its own separate version. If there is any way you can move to another version control system like subversion, mercurial, git...do it.

Chris Gow
So it is different from SVN where each commit changes the revision no of the head?
Abhi
Am forced to use CVS :(.
Abhi
"The head" does not have a specific revision number in CVS. HEAD is just a kind of virtual tag that identifies the latest revision of each file on its designated default branch (typically the trunk).
Oliver Giesen
A: 

CVS was originally a set of scripts over the file-oriented RCS, and it never escaped its history. A CVS repository is a collection of RCS files arranged in the directory structure you want when it's checked out, plus some lock directories. Remember that and you'll understand (and maybe be able to anticipate) a lot of CVS idiosyncracies. (Later VCS have had the idea of directories built in, as well as things like file continuity across renames.)

The CVS idea of a global state is a tag, which has to be applied manually. This is done by tagging each and every RCS file. It's also possible to get a copy of the repository at a given time, but this is not necessarily consistent, as large commits are not necessarily atomic.

So, no, the CVS revision of a file is the RCS revision in the repository, and has nothing to do with any other revision number. Don't sweat the revision numbers.

David Thornley