To know why using RCS to control config files is a good thing, read
micah's email about it.
Quick Menu:
This is a small howto on using RCS, taken from
http://www.rescomp.berkeley.edu/about/training/allres/RCS-HOWTO/x24.html
Checking out files
To check out a file, simply do a co -l filename in the appropriate
directory. co stands for "check out", and the -l stands for "lock".
This means you are locking the file so no one else can check it out.
[mrman@hal /opt/adm]$ ls -al system
-r--r--r-- 1 joebob staff 71857 Apr 24 13:14 system
[mrman@hal /opt/adm]$ co -l system
RCS/system,v --> system
revision 1.533 (locked)
done
[mrman@hal /opt/adm]$ ls -al system
-rw-r--r-- 1 mrman staff 71857 Apr 30 02:43 system
[mrman@hal /opt/adm]$ ls -al RCS/system,v
-r--r--r-- 1 joebob staff 141211 Apr 24 13:14 RCS/system,v
As you can see, what co -l system does is copy the last revision from
RCS/system,v to ./system, and lets you write to the file. The RCS/
system,v is larger, as it contains all the revisions and extra
information since the file was first made.
You can now make whatever changes you need to the file.
Checking in files
After you are done editing the file, it's time to check it in. This is
done with ci -u filename in the directory. The ci stands for "check
in", and the -u stands for "unlock".
[mrman@hal /opt/adm]$ ls -al system
-rw-r--r-- 1 mrman staff 73422 Apr 24 13:14 system
[mrman@hal /opt/adm]$ ci -u system
RCS/system,v <-- system
new revision: 1.534; previous revision: 1.533
enter description, terminated with single '.' or end of file:
'>
> Type what you did here.
'>
> .
done
[mrman@hal /opt/adm]$ ls -al system
-r--r--r-- 1 mrman staff 73422 Apr 30 02:43 system
[mrman@hal /opt/adm]$ ls -al RCS/system,v
-r--r--r-- 1 mrman staff 151311 Apr 24 13:14 RCS/system,v
What this does is to write your revisions into RCS/system,v, removes
the lock, and then makes the file not writeable by anyone. It allows
you to log into RCS what you did. Of course, you don't need to log it
if you made changes to a logfile. Ending the log is done with a single
dot.
Breaking locks
So what do you do when you need to edit a file that is locked by
someone else?
Make sure that person isn't still editing the file at that time. If
you can talk to or can ytalk them, then make them check the file in.
Break the lock with rcs -u filename and put in a log when it prompts
you. This will mail the person whose lock you are breaking.
Copy the file to a tempfile (cp filename filename.old) so the person's
changes aren't lost.
Check out the file (co -l filename) yourself.
Copy the tempfile back to the real one (cp filename.old filename).
Check in the file (ci -u filename).
Now you can check out the file properly and make your changes.
Here is an example:
[mrman@hal /opt/adm]$ co -l system
RCS/system,v --> system
co: RCS/system,v: Revision 1.545 is already locked by joebob.
[mrman@hal /opt/adm]$ ls -al system
-rw-r--r-- 1 joebob staff 85737 Apr 30 15:14 system
[mrman@hal /opt/adm]$ rcs -u system
RCS file: RCS/system,v
Revision 1.545 is already locked by joebob.
Do you want to break the lock? [ny](n): y
State the reason for breaking the lock:
(terminate with single '.' or end of file)
'>
> You didn't unlock the file. You suck.
'>
> .
[mrman@hal /opt/adm]$ cp system system.joebob
[mrman@hal /opt/adm]$ co -l system
RCS/system,v --> system
revision 1.545 (locked)
done
[mrman@hal /opt/adm]$ mv system.joebob system
[mrman@hal /opt/adm]$ ci -u system
RCS/system,v <-- system
new revision: 1.546; previous revision: 1.545
enter description, terminated with single '.' or end of file:
'>
> Checked it in for joebob. He didn't unlock.
'>
> .
done
[mrman@hal /opt/adm]$ ls -al system
-r--r--r-- 1 mrman staff 85737 Apr 30 16:43 system
I worte this based on co manual page
Reverting to an older version
first check out the file:
ci -l[rev] file_name
where [rev] is the revision number that you want to revert to.
Now
check the file in normaly.
This was taken from RCS mini HOWTO:
http://www.tldp.org/HOWTO/mini/RCS.html
Revision histories
The rlog(1) program provides information about the archive file and the logs of each revision stored in it. A command like
rlog work_file_name
will print the version history of the file, each revision's creation date and userids of author and the person who locked the file. You can specify archive attributes and revision parameters to view.
--
NeGu - 24 Feb 2006 fixed maillist link
PietroFerrari - 29 Aug 2002