Brief CVS Guide

From wiki.gromacs.org

Jump to: navigation, search

Quick Reference

  • cvs co module = check out a copy of 'module' into your working directory (you only need to do this once)
  • cvs -R co module = like the command above, except use rCVS to get from a remote host
  • cvs update = update all the files in the current directory
  • cvs commit = commit all of the files you have changed to the main repository
  • cvs add file1 = alert CVS that file1 should be added to the repository at the next 'cvs commit' invocation.
  • cvs rm file1 = alert CVS that file1 should be removed from the repository at the next 'cvs commit' invocation.

Advanced Commands/Hints

  • cvs history -Ta -n module = show all tags on 'module'
  • cvs diff -r HEAD file1 = show difference between my checked out file1 and the most recent version in CVS
  • cvs rtag tagname module = tag 'module' in CVS with 'tagname' (NOTE: this creates a history entry, the 'cvs tag' command does not)
  • cvs update -j branchtag = merge 'branchtag' into previously checked out version (NOTE: files added to the branch are not added!)
  • CVS/Entries = this file shows you the tag and RCS version of what you checked out

Topics covered below

  • Checking Out a Module for the First Time
  • Commiting Your Changes to the Main Repository
  • Getting Updates and Merging Changes from Different Users
  • Adding New files to an Existing Module
  • Reverting to Old Versions of Files (Tags)

Checking Out a Module for the First Time To check out something for the first time use a command like this:

     cvs co beget


or if the repository is on a remote computer:

     cvs -R co beget


CVS will create a directory called 'beget' in your current working directory and copy all of the files and subdirectories associated with the module 'beget' into it. All of the remaining CVS commands must be issued from the 'beget' directory.

Commiting Your Changes to the Main Repository You can edit any of the files you want, and when you are ready to commit your changes to the master repository do,

     cvs commit


CVS will at some point start an editor (vi or emacs depending on your environment variables) and ask you to enter some text that will be stored as part of a history of changes. If this is successful, then your versions of the files will be copied back to the main site so that everyone can access them.

Getting Updates and Merging Changes from Different Users If someone else changes the files while you are working on your own copy, you must update your copy with the command

     cvs update


to get the new versions. You can chose to update your files at any time. Before committing any files, CVS will check to see if you need to do an update. If you do, CVS prints a message and aborts the commit. If someone else has changed a file that you have also changed, CVS will attempt to merge the new changes into your file. If it is unsuccesful at doing so it will alert you to a 'conflict.' If there is a conflict, the new file will contain sections that have both your changes and the other persons changes. These sections will be flagged by lines like

>>>>>>>>>>>>

and

<<<<<<<<<<<<

The user must then look at the conflicting regions, choose what is correct and edit the file.

Adding New files to an Existing Module If you create new files, you have to tell CVS to put them into the repository. First do,

     cvs add newfile1 newfile2

then do a 'cvs commit'.


The 'add' command alerts CVS to commit the named files at the next invocation of cvs commit.

Reverting to Old Versions of Files (Tags) Every time you commit a file to CVS it increments a revision number. The first commit is 1.1 then 1.2 and 1.3 etc. (I don't know if or how it ever gets to 2.1). To revert to an old version of a file you can use the version number as a tag as in

     cvs co -r 1.6 bbsim/dat/dcha.db


to check out version 1.6 of dcha.db. You could also use the update command

     cvs update -r 1.6 dcha.db

but be careful that you don't commit the old version on top of the current version. To see what version number the current file is do

     cvs status dcha.db


You can also revert to files that were tagged as a particular version by the user. For example

     cvs co -r v200 bbsim/dat


would check out all of the files in dat that were tagged by somebody as version v200. To see what user tags have been created do

     cvs history -Ta -n bbsim


Retagging a previous version and adding to it The following will make "new_tag" which will be the same as "last_tag" even though you are working with the HEAD.

     cvs rtag -r last_tag new_tag gnmuon


Don't use tag or it will tag the current directory stuff too. OK, now you can update the files from HEAD that you want to include in the "new_tag":

     cvs tag -F new_tag file1 file2 file3
Personal tools
download / installation