views:

14

answers:

2

Hello I have updated cvs a few times and want to get one of the older versions, is it possible to get different versions of the same file?? or should it be only the latest checked in version??

+1  A: 

Yes - in the lingo of CVS it sounds like you have committed several versions (to the repository) and now you want to get one of the previous revs back... so you will be updating your sandbox. If it's a particularly interesting rev, you might want to TAG it so you can find it again without having to use the rev number.

In either case you might run a cvs command like so:

cvs update -r 1.14 foo.java
cvs update -r spiffy_tag foo.java

But know that if you run either of those, you will have a "sticky tag" in your local copy and cannot commit back from there. (Run "cvs status foo.java" to see the sticky)... so if you want to work on that rev and tune it up, you might want to create a branch first... then if you run:

cvs update -r my-branch foo.java

you will be able to commit changes back to the repo.

Jim Thompson
+2  A: 

Switch to a certain revision number: cvs update -r 1.42 myfile

Switch to a certain tag: cvs update -r mytag

Switch to a certain date: cvs update -D 'last friday 12:00 PST'

If you haven't already checked out some version, you can pass -r or -D directly to cvs checkout.

These all switch your working copy to the revision or date you specified (this is called a “sticky tag”). To go back to the head revision, issue cvs update -A.

You can also retrieve a specific revision into a different file with the -p option: cvs update -p -r 1.42 myfile >myfile-1.42. This doesn't touch your working copy of myfile.

Gilles
if I use cvs update, the local would be the one that is updated with that version is it??
sai
@sai: I'm sorry, I don't understand your comment. First you need to create a directory with a working copy (a checkout) with `cvs checkout`, then you can use `cvs update` in that directory. With no option, `cvs update` modifies your files to be the latest revision. With `-r` or `-D`, it modifies your files to be the revision you specified. With `-p`, you need to be in a checkout, but your files won't be modified.
Gilles