Table of Contents:
[ref: rcsintro(1)]
Essentially, Revision Control System (RCS), provides an enhanced archiving/recording system for tracking changes you make to 'important' files.
I use it because I'm always fiddling with configuration files until I don't know what changes I've made and when things crash I don't recall how to get back to a working version.
[ref: rcsintro(1)]
To create an RCS entry we first have to:
[file: /etc/rc.conf.local]
Create the repository, place where the RCS is to be 'stored.' This is usually the directory RCS under the directory where your file is stored.
For example, if we are to edit the file /etc/rc.conf.local we would need to create the directory RCS under /etc
| $ su - # cd /etc # mkdir RCS |
[file: /etc/rc.conf.local]
[ref: ci(1)]
ci (Check In RCS Revisions) stores new revisions of working files into RCS files. When a totally new file is 'checked-in' ci will:
Let's begin our experiment by creating a skeleton of the /etc/rc.conf.local file.
File /etc/rc.conf.local:
| # $Id: rcs.htm,v 1.1.1.1 2002/06/10 02:09:57 samt Exp $ # ## # SECTION 1 - Turn Features on/off # ## # ## # SECTION 2 - Switch Programs On/Off # ## # ## # SECTION 3 - Configuration Options # ## shlib_dirs="" |
|
Template for /etc/rc.conf.local
|
We can now take a look at committing the 1st version of our file by using the command 'ci filename'
| # ci rc.conf.local |
| RCS/rc.conf.local,v <-- rc.conf.local enter description, terminated with single '.' or end of file: NOTE: This is NOT the log message! >> |
| >> Contains Startup Configuration for
initialising OpenBSD startup >> This file should be edited when customising Startup, and not /etc/rc.conf >> . |
| initial revision 1.1 done |
When you run 'ci' the displayed information tells you:
| RCS/rc.conf.local,v <-- rc.conf.local |
You can readily confirm this by listing the contents of the directory RCS, and the created file rc.conf.local,v
| enter description, terminated with single '.'
or end of file: NOTE: This is NOT the log message! >> |
In our example above, we have stated the value of the file we are editing.
| >> Contains Startup Configuration
for initialising OpenBSD startup >> This file should be edited when customising Startup, and not /etc/rc.conf >> . |
| initial revision 1.1 done |
We have successfully created our RCS entry.
[file: /etc/rc.conf.local]
[ref: co(1)]
To make changes to our example file /etc/rc.conf.local, we need to 'check-it-out' from RCS, and to lock it using the 'co -l filename' command
| # co -l rc.conf.local |
| RCS/rc.conf.local,v --> rc.conf.local revision 1.1 (locked) done |
The check-out command 'co' extracts the latest revision from the RCS file and writes it to 'rc.conf.local' We lock the file before editing to ensure that we are the only one editing the file, and the only one allowed to update the file.
From the program response above, we are told the existing revision is 1.1 and it is now locked.
If we take a look at the file, you will see that the $Id: rcs.htm,v 1.1.1.1 2002/06/10 02:09:57 samt Exp $ line at the very beginning of the file has now been expanded to provide some details about the RCS process on the file.
| # $Id: rc.conf.local,v 1.1 2002/02/03 09:26:36 samt Exp samt $ |
For more information on this, check the co(1) man pages.
Now, (a) we can make changes to the file, and (b) No other person has write privileges to the file.
[file: /etc/rc.conf.local]
[ref: rcsdiff(1)]
rcsdiff runs a diff to compare the differences between two versions of a file. By default it will compare the working file with the latest revision in the RCS tree.
TO look at how changes can be reported by RCS, we make the following modifications
to SECTION 1 of the rc.conf.local file.
| # ## # SECTION 1 - Turn Features on/off # ## xdm_flags = "" # use two double-quotes sendmail = "-bd q30m" # for normal use: "-bd -q30m" ftpd_flags= "-DllUSA" # for non-inetd use: ftpd_flags="-D" |
|
Diagram - Sample of Update to Section 1
|
We save the changes to /etc/rc.conf.local and take a look at how rcs views our changes by using 'rcsdiff filename'
| # rcsdiff rc.conf.local |
=================================================================== RCS file: RCS/rc.conf.local,v retrieving revision 1.1 diff -r1.1 rc.conf.local 4a5,8 > xdm_flags = "" # use two double-quotes > sendmail = "-bd q30m" # for normal use: "-bd -q30m" > ftpd_flags= "-DllUSA" # for non-inetd use: ftpd_flags="-D" > |
rcsdiff reads our working file /etc/rc.conf.local and compares it to the current revision (1.1) in the RCS tree.
The default display outputs the changes we made.
[ref: ci(1)]
[file: /etc/rc.conf.local]
We can check-in the update above using (ci.) By using the unlock (-u) or lock (-l) option we tell ci not to delete the working file after checking it in.
| # ci -u rc.conf.local |
| RCS/rc.conf.local,v <-- rc.conf.local new revision: 1.2; previous revision: 1.1 enter log message, terminated with single '.' or end of file: >> |
| >> updated: xdm_flags >> updated: sendmail (standard) >> updated: ftp (configure as non-inetd Anonymous) >> . |
| done |
In the situation of the /etc/rc.conf.local file, we are using RCS to maintain a trace log of changes so we can recover from any serious editorial faults. In such a scenario it is valid to keep the 'lock' on, or remove locking altogether (see the man pages.)
[ref: rcsdiff(1)]
You can compare different revisions of your file by using rcsdiff (releaseA) (releaseB) filename.
For example, to compare the differences between release 1.1 and release 1.3 we can use the following command-line.
| rcsdiff -r1.1 -r1.3 filename |
[ref: rcsintro, ci]
Checking in a file automatically removes the file from the current location and places it into the repository.
To prevent ci from deleting your working file, you can use either
| ci -l filename (check in lock) or |
| ci -u filename (check in unlock) |
These two commands implicitly check out the file after check-in.
To revert to a previous edit, you simply check-out the version you wish to be the 'current' release, and then check it in again.
For example, if I wish to revert to the original file (release 1.1) and I am current up to release 1.4.
| rcsdiff -r1.4 -r1.1 filename |
| describes difference between the current
build and initial release |
| co -r1.1 filename |
| ci -u filename |
| rcsdiff -r1.4 -r1.1 filename |
| should be exactly the same as above diff comparison |
Copyright (c) 2000/1/2 Samiuela LV Taufa. All Rights Reserved.
I reserve the right to be totally incorrect even at the best advice of betters. In other words, I'm probably wrong in enough places for you to call me an idiot, but don't 'cause you'll hurt my sensibilities, just tell me where I went wrong and I'll try again.
You are permitted and encouraged to use this guide for fun or for profit as you see fit. If you republish this work in what-ever form, it would be nice (though not enforceable) to be credited.
|
rrcs - Revision Control System |
Copyright © 2000/1/2 NoMoa Publishers All rights reserved. Caveat Emptor