Prev - Index - Next

Version tools

If it happens once, it's a bug.
If it happens twice, it's a feature.
If it happens more than twice, it's a design philosophy.

RCS

The Revision Control System (RCS) is a collection of programs for managing source files, tracking the changes (or revisions) made to the files.

By keeping a list of changes made to each revision of a file, the developer can check or recreate any version of the file. Comments and authorship information can also be logged, which is useful in a project with multiple developers.

The main tools are rcs, ci, co, ident and rlog.
Some editors, such as EMACS, have an RCS mode that automates much of the RCS process.


An RCS example

We have created a script called query.pl:

        [/usr/home/graeme/work]$ ls -l query.pl 
        -rw-r--r--   1 graeme   graeme       6420 Feb  1 23:50 query.pl

We can initialise RCS control on query.pl with rcs:

        [/usr/home/graeme/work]$ rcs -i query.pl 
	RCS file: RCS/query.pl,v
	enter description, terminated with single '.' or end of file:
	NOTE: This is NOT the log message!
	>> A web index query tool
	>> Designed by Joe Bloggs, implemented by Graeme Cross
	>> .
	done

There is now a revision file called query.pl,v. If there is a RCS/ subdirectory, the revision file will be stored there, otherwise it will be kept in the current directory:

        [/usr/home/graeme/work]$ ls -l query.pl 
        -rw-r--r--   1 graeme   graeme       6420 Feb  1 23:50 query.pl
	-r--r--r--   1 graeme   graeme        140 Feb  1 23:53 query.pl,v

When we want to store a particular revision, we use the ci command to "check in" the revision:

        [/usr/home/graeme/work]$ ci query.pl 
	RCS/query.pl,v  <--  query.pl
	initial revision: 1.1
	done

The file is now locked (and has been removed - you can stop this by using the -u flag), and can only be modified by "checking out" the file with co:

        [/usr/home/graeme/work]$ co -l query.pl 
	RCS/query.pl,v  -->  query.pl
	revision 1.1 (locked)
	done
	[/usr/home/graeme/work]$ ls -l query.pl 
	-rw-r--r--   1 graeme   graeme       6420 Feb  1 23:59 query.pl

The file is now locked by you, which means that only you can make changes to the file. This prevents other developers who have access to the file modifying it simultaneously, which could be disastrous.

When you are finished making the new modification, use ci to check the file make in, with comments about the new revision:

        [/usr/home/graeme/work]$ ci -u query.pl 
	RCS/query.pl,v  <--  query.pl
	new revision: 1.2; previous revision: 1.1
	enter log message, terminated with single '.' or end of file:
	>> Added boolean search facilities
	>> Fixed a small bug in the input field parsing code
	>> .
	done

The rlog command displays information about the various revisions, including the "change" comments:

        [/usr/home/graeme/work]$ rlog query.pl 

	RCS file: RCS/query.pl,v
	Working file: query.pl
	head: 1.2
	branch:
	locks: strict
	access list:
	symbolic names:
	keyword substitution: kv
	total revisions: 2;     selected revisions: 2
	description:
	A web index query tool
	Designed by Joe Bloggs, implemented by Graeme Cross
	----------------------------
	revision 1.2
	date: 1999/03/01 13:01:27;  author: graeme;  state: Exp;  lines: +40 -0
	Added boolean search facilities
	Fixed a small bug in the input field parsing code
	----------------------------
	revision 1.1
	date: 1999/03/01 12:56:39;  author: graeme;  state: Exp;
	Initial revision
	----------------------------
	=======================================================================

Note: RCS is also very useful for managing Linux configuration files, such as those found in /etc.


CVS

CVS (the Concurrent Versions System) extends RCS from controlling revisions of individual files in one directory to controlling a software release, which can comprise a collection of subdirectories of files.

Any large software project is ideally suited to using CVS instead of RCS, as CVS has support for concurrent editing of files by developers, and access to previous releases by revision tags or date stamps.

CVS also offers anoncvs facilities, allowing remote developers access (possibly read-only) to source code, which is very useful for Internet based software projects. Many projects, including GNOME and Enlightenment, now offer testers CVS access to development code, which allows users access to cutting edge software releases.

The free BSD projects (FreeBSD, NetBSD and OpenBSD) allow you to upgrade the operating system and ports via a CVS mechanism called cvsup.

For more information on using CVS, have a look at the CVS man page(s) and the CVS FAQs and tutorials.


Prev - Index - Next