www.LinuxHowtos.org

edit this article

Using RCS


This short tutorial shows you how to use of RCS to keep track of changes in configuration files. To get RCS and its related tools, install rcs.

Note: Similarities between CVS and RCS will cause any $Header: /var/www/www.gentoo.org/raw_cvs/gentoo/xml/htdocs/news/en/gwn/20040216-newsletter.xml,v 1.1 2004/02/17 01:53:48 carlos Exp $ or $Id: 20040216-newsletter.xml,v 1.1 2004/02/17 01:53:48 carlos Exp $ tags to be rewritten when you put files under revision control.

Code Listing 1: Adding files to RCS
# cd /etc
# mkdir RCS

// Put make.conf under revision control
# ci -i make.conf
RCS/make.conf,v <-- make.conf
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> make.conf - custom settings for portage
>> .
initial revision: 1.1
done
// The file is now in RCS, so put it back in /etc for reading
# co make.conf





Notice that make.conf is now under revision control and is read-only. To edit the file, you need to perform the following steps:



Code Listing 2: Editing a file under revision control
// Checkout the file with locking enabled
# co -l make.conf
RCS/make.conf,v --> make.conf
revision 1.1 (locked)
done

// Edit the file
# ${EDITOR} make.conf

// Check the file back in and unlock it.
# ci -u make.conf
RCS/make.conf,v <-- make.conf
new revision: 1.2; previous revision: 1.1
enter log message, terminated with single '.' or end of file:
>> changed DISTDIR to use a drive with more space
>> . done


This can be a tedious process so it's better to put all the commands in a script to do it automatically.



Code Listing 3: Example script for revision control
#!/bin/sh
# Script to edit files under revision control
[ [ -f "RCS/$1,v" ]] && co -l $1
${EDITOR} $1
[ [ -f "RCS/$1,v" ]] && ci -u $1

For more information on using RCS see man 1 rcsintro.

From http://www.gentoo.org/news/en/gwn/20040216-newsletter.xml


rate this article:
current rating: average rating: 1.5 (89 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back