Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to revert to previous commit in CVS

Tags:

cvs

legacy

For legacy reasons, I'm using CVS on a project. Recently I committed some changes which broke our code and I needed to revert them. What's CVS's analog of git revert -r <old_revision>?

Looking at past questions like How to revert big change, CVS commits don't group the files that were changed. Is the only way to revert by using dates?

Also, what's the best way to view past changes? CVS log outputs too much info, most of which is unnecessary. I want to see commit messages and changed files.

like image 315
Fiona T Avatar asked Feb 05 '12 23:02

Fiona T


People also ask

How do I revert to a previous version of a file at cvs?

Retrieving the older version of the file is simple, but it is a little tricky to then use the old version as a starting point for new edits. CVS "tags" the file with the version number. This tag can get in the way of either committing the old version with new edits or going back to the most up to date version.

How do I check my cvs commit history?

Whenever you commit a file you specify a log message. To look through the log messages which have been specified for every revision which has been committed, use the cvs log command (see section log--Print out log information for files).

How do I commit a code to cvs?

Technically, the way to send files to the CVS repository is to add them to Eclipse's version control and then commit them. You do that by right-clicking the files and selecting Team→ Add to Version Control. Then select Team→ Commit to commit the files.


1 Answers

CVS documentation can be found here, but from this site it tells how to revert a single file:

MAKING THE OLD VERSION THE CURRENT VERSION

Save the version of "oldfile" to something else and check out the "current" version.
Note: you must still to do update -A to get the current version, because even though you have > renamed
"oldfile" the tag is still associated with the file "oldfile" and is not removed till > update -A is done.

Then rename the "old" version to the "current" version.
% mv oldfile oldfile.old.ver
% cvs update -A oldfile
% mv oldfile.old.ver oldfile
% cvs commit -m "reverting to version 1.5" oldfile

You can now carry on checking out, editing and commiting the file as normal.

This won't handle many files in a recursive fashion, but hopefully helps.

like image 198
Dave M Avatar answered Sep 18 '22 15:09

Dave M