This article has some quick shortcuts on how to use the CVS revision control system. Learn how to tag, import, checkout, and export your projects under source control.
Keeping track of changes in your software projects
After battling is out with Python for the last night, I was finally able to automate the retrieval of web page with urllib2 using free anonymous proxies. I thought about the changes I had made, and how I should keep track of them. This brought back memories of RCS in my software engineering classes.
Why should you use a revision control system? To keep track of changes in your software code, to coordinate development efforts between developers, and to manage large projects in a effective manner.
RCS was a revision control system that was used by our team to manage changes in the code. The one major problem with RCS, is that it used file locking. There were times when memebers of the team would lock files and we would be stuck having to break the locks.
A few years ago, I came across CVS, another revision control system. CVS is used by alot of the open source advocates. Many projects that are coded by people in vastly different regions of the world use CVS to coordinate the development effort.
I was writing this blurb, not to just rant, but rather for a quick reference to CVS. I find that when I need to remember how to use a program, I usually have to scour the web for information. Here is a quick reference for my use and your use. I will update it as I use the other commands.
To import a existing project into CVS
First change to the directory where the sources are
# cd dir_where_sources_ar
Next import the sources into the CVS tree
#cvs import -m “Importing sources for CVS” proj_dir/some_dir vendor_name start
Next get rid of the old file so that they do not cause conflicts with CVS. You might want to
keep a spare backup somewhere
#rm *
now check the files using the name you imported them with. If you are in the original
directory where you had the sources, the check out will create the subdirectory structure
/proj_dir/some_dir and place the sources under it.
#cvs checkout proj_dir/some_dir
To sync of the project files if another developer has been also working on the project, first
change to the working directory on your machine then
#cvs update
This will merger any changes that have already been committed to the source tree
since the last time you have checked out the source files
U Somefile means a update has been made on that file by someone
To commit your changes to a particular file issue the command
#cvs commit some_file
To view the log entries of a particular file
#cvs log somefile
To look at actual differences between revisions eg 1.0 and 1.1
#cvs diff -c r 1.0 -r 1.1 somefile
older stuff is denoted by **** and newer stuff by ——-
To add new files to a existing CVS source tree
#cvs add somefile
Once is has been added do a update then issue a commit for that file
To delete a file, first remove the file from your working directory
then mark it with the rm command
#cvs rm somefile
Next issue a commit for the file. The file will still be in the CVS history, but it will
become nonexistant in the newer checkouts.
To see which files were changed in a directory
#cvs -n update
To move a tag
#cvs tag -r X.X -F tagname file
or
#cvs rtag -F tagname modulename
To see where a tag is (I had these in notes I will have to double check this)
#cvs -q status
#cvs -q tag TAGNAME
To checkout a portion of a project under a directory name different than that in the repository use the following
#cvs checkout -d yourdirectory project/somesub/someothersub
To ignore some files on update place a file called .cvsignore in the directory you want to ingnore files for in your working copy
in the file you can specify wild cards like * or *.* or explicit file names
To export a project without the CVS admin directories use the following command
cvs -d /path/to/repository/ -q export -r
For more specific information please visit the manual at the cvs home page
http://www.cvshome.org/docs/manual/cvs.html