How do I get a snapshot of a CVS repository back to a certain date?

By Alvin J. Alexander, devdaily.com

To solve your first problem, let's assume that yesterday was September 14, 2001, and your project name was KickStart. To check out the code from your KickStart repository from late last night, use this command:

  cvs co -D "2001-09-14 23:59:59 GMT" KickStart

Now your working version will reflect the state of the repository from one second before midnight last night, Universal Coordinated Time (also known as "Greenwich Mean Time").



Why did you have to specify the time and "GMT"? Wouldn't I automatically get the correct copy of the repository just by specifying the date?



No you wouldn't. If you had just specified the date, like this:

  cvs co -D "2001-09-14" KickStart

you would have checked out a version of the repository that essentialy began the day, 2001-09-14. According to the CVS book "Open Source Development with CVS", the date 2001-09-14 is interpreted as "the midnight that begins 2001-09-14", so you would only have the code that began that day. It is a big difference.

The "GMT" is specified because that is how the CVS repository stores date/time information. Because people around the world may be working on a given project, this is a good way to keep the date/time consistent. However, it also means you must be aware of this when you want to go back to a previous revision by specifying the date.


devdaily logo