<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0044)http://wikiserv/wikidoc/index.php?title=RCS -->
<HTML lang=en dir=ltr xml:lang="en" 
xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>RCS - Wikidocs</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content=RCS name=KEYWORDS>
<META content=index,follow name=robots><LINK href="/favicon.ico" 
rel="shortcut icon">
<STYLE type=text/css media=screen,projection>@import url( /wikidoc/skins/monobook/main.css );
</STYLE>
<LINK media=print href="RCS - Wikidocs_files/commonPrint.css" type=text/css 
rel=stylesheet><!--[if lt IE 5.5000]><style type="text/css">@import "/wikidoc/skins/monobook/IE50Fixes.css";</style><![endif]--><!--[if IE 5.5000]><style type="text/css">@import "/wikidoc/skins/monobook/IE55Fixes.css";</style><![endif]--><!--[if IE 6]>
<STYLE type=text/css>@import url( /wikidoc/skins/monobook/IE60Fixes.css );
</STYLE>
<![endif]--><!--[if IE]>
<SCRIPT src="RCS - Wikidocs_files/IEFixes.js" type=text/javascript></SCRIPT>

<META http-equiv=imagetoolbar content=no><![endif]-->
<SCRIPT src="RCS - Wikidocs_files/index.php" type=text/javascript></SCRIPT>

<SCRIPT src="RCS - Wikidocs_files/wikibits.js" type=text/javascript></SCRIPT>

<STYLE type=text/css>@import url( /wikidoc/index.php?title=MediaWiki:Monobook.css&action=raw&ctype=text/css&smaxage=18000 );
@import url( /wikidoc/index.php?title=-&action=raw&gen=css );
</STYLE>

<META content="MSHTML 6.00.2900.2769" name=GENERATOR></HEAD>
<BODY class=ns-0>
<DIV id=globalWrapper>
<DIV id=column-content>
<DIV id=content><A id=contentTop name=top></A>
<H1 class=firstHeading>RCS</H1>
<DIV id=bodyContent>
<H3 id=siteSub>From Wikidocs</H3>
<DIV id=contentSub></DIV><!-- start content -->
<TABLE id=toc border=0>
  <TBODY>
  <TR id=toctitle>
    <TD align=middle><B>Table of contents</B>
      <SCRIPT type=text/javascript>showTocToggle("show","hide")</SCRIPT>
       </TD></TR>
  <TR id=tocinside>
    <TD>
      <DIV class=tocline><A 
      href="http://wikiserv/wikidoc/index.php?title=RCS#RCS_Overview">1 RCS 
      Overview</A><BR></DIV>
      <DIV class=tocline><A 
      href="http://wikiserv/wikidoc/index.php?title=RCS#Using_RCS">2 Using 
      RCS</A><BR></DIV>
      <DIV class=tocindent>
      <P><A href="http://wikiserv/wikidoc/index.php?title=RCS#Check-In">2.1 
      Check-In</A><BR><A 
      href="http://wikiserv/wikidoc/index.php?title=RCS#Check-Out">2.2 
      Check-Out</A><BR><A 
      href="http://wikiserv/wikidoc/index.php?title=RCS#Useful_RCS_Tools_.26_Features">2.3 
      Useful RCS Tools & Features</A><BR></P></DIV>
      <DIV class=tocline><A 
      href="http://wikiserv/wikidoc/index.php?title=RCS#Working_With_RCS_and_Source_Files_in_Bulk">3 
      Working With RCS and Source Files in Bulk</A><BR></DIV>
      <DIV class=tocindent>
      <P><A 
      href="http://wikiserv/wikidoc/index.php?title=RCS#Initial_Bulk_Check-in">3.1 
      Initial Bulk Check-in</A><BR><A 
      href="http://wikiserv/wikidoc/index.php?title=RCS#Bulk_Check-out">3.2 
      Bulk Check-out</A><BR><A 
      href="http://wikiserv/wikidoc/index.php?title=RCS#Bulk_Check-in">3.3 Bulk 
      Check-in</A><BR></P></DIV></TD></TR></TBODY></TABLE>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px"></DIV><A 
name=RCS_Overview></A>
<H2>RCS Overview</H2>
<P>RCS is the Revision Control System, a venerable (i.e. ancient) software 
solution for tracking modification of source files. Revision Control provides a 
log of changes to a file along with comments added when the file was modified. 
Tools are provided which will show specific changes between particular revisions 
or the entire history of a changes to a file. </P>
<P>Until we have time to properly implement CVS or Subversion with a nice 
distribution mechanism across all servers RCS will serve as a stop-gap for 
change control over our config files. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px"></DIV><A 
name=Using_RCS></A>
<H2>Using RCS</H2>
<P><A class=external title=http://www.linuxgazette.com/node/8416 
href="http://www.linuxgazette.com/node/8416" rel=nofollow>RCS: Managing System 
Config Files</A><SPAN 
class=urlexpansion> (<I>http://www.linuxgazette.com/node/8416 </I>)</SPAN> 
</P>
<P>Here we'll run through using RCS on a sample config file, but essentially 
it's pretty much what's described in the Linux Gazette article. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px"></DIV><A 
name=Check-In></A>
<H3>Check-In</H3>
<P>First you need to "check-in" your file. For neatness we should create an RCS 
sub-directory anywhere we want to have files under RCS's control. RCS will store 
the "vector" files in here, this reduces clutter in directories where lots of 
files will be checked-in. The vector files are ASCII stores containing diffs of 
changes made, timestamps and their associated comments. Lets see RCS in action. 
The stuff typed in is in <B>bold</B> everything else is output: </P><PRE>[wmcdonald@willspc ~]$ <B>pwd</B>
/home/wmcdonald
[wmcdonald@willspc ~]$ <B>mkdir conf</B>
[wmcdonald@willspc ~]$ <B>cd conf/</B>
[wmcdonald@willspc conf]$ <B>mkdir RCS</B>
[wmcdonald@willspc conf]$ <B>touch sample.conf</B>
[wmcdonald@willspc conf]$ <B>ls -l</B>
total 4
drwxrwxr-x  2 wmcdonald wmcdonald 4096 Jun 27 12:07 RCS
-rw-rw-r--  1 wmcdonald wmcdonald    0 Jun 27 12:07 sample.conf
[wmcdonald@willspc conf]$ <B>ci -u sample.conf</B>
RCS/sample.conf,v  <--  sample.conf
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> <B>initial check-in - WMCD</B>
>> <B>.</B>
initial revision: 1.1
done
[wmcdonald@willspc conf]$ <B>ls -l</B>
total 4
drwxrwxr-x  2 wmcdonald wmcdonald 4096 Jun 27 11:59 RCS
-r--r--r--  1 wmcdonald wmcdonald    0 Jun 27 11:59 sample.conf
[wmcdonald@willspc conf]$ <B>ls -l RCS</B>
total 4
-r--r--r--  1 wmcdonald wmcdonald 206 Jun 27 11:59 sample.conf,v
[wmcdonald@willspc conf]$
</PRE>
<P>Here I've created an empty file "sample.conf" and checked it in to RCS, this 
created an associated vector, "sample.conf,v". If you don't provide the -u 
option RCS checks the working file in without leaving a readable copy. For 
source code this is acceptable, for config files it's very bad. So we alway use 
-u when checking in config files. </P>
<P>Always try to give sensible input when prompted for comments/log detail. A 
brief description of the change and any reason for it which may be useful later. 
</P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px"></DIV><A 
name=Check-Out></A>
<H3>Check-Out</H3>
<P>Notice that the checking-in process has changed the permissions for the file 
to read-only, this is a simplistic mechanism to prevent inadvertant edits to the 
file without it first being checked out. </P>
<P>Should we need to edit our config we need to "check-out" the file from RCS. 
</P><PRE>[wmcdonald@willspc conf]$ <B>co -l sample.conf</B>
RCS/sample.conf,v  -->  sample.conf
revision 1.1 (locked)
done
[wmcdonald@willspc conf]$ <B>vi sample.conf</B>
</PRE>
<P>Here the file's been checked-out for editing, I've edited it and added the 
following sample text. </P><PRE># sample config file

option1=defalt
option2=default

</PRE>
<P>Now the file needs to be checked back in </P><PRE>[wmcdonald@willspc conf]$ <B>ci -u ./sample.conf</B>
./RCS/sample.conf,v  <--  ./sample.conf
new revision: 1.2; previous revision: 1.1
enter log message, terminated with single '.' or end of file:
>> <B>Initial edit. Added a comment and set some default options.</B>
>> <B>WMCD</B>
>> <B>.</B>
done
[wmcdonald@willspc conf]$
</PRE>
<P>Notice the revision has incremented. Now the process which reads this file is 
restarted and complains it can't read option1, simple typo, easily fixed. </P><PRE>[wmcdonald@willspc conf]$ <B>co -l sample.conf</B>
RCS/sample.conf,v  -->  sample.conf
revision 1.2 (locked)
done
[wmcdonald@willspc conf]$ <B>vi sample.conf</B>
[wmcdonald@willspc conf]$ <B>cat sample.conf</B>
# sample config file
#
# $Id$
 
option1=default
option2=default

[wmcdonald@willspc conf]$
</PRE>
<P>I've fixed the typo and added a comment including the <B>$Id$</B> string. 
This is a special string that RCS expands when the file is checked back in which 
provides some useful information on last edit time, file version and so on. So 
let's check it back in after the changes. </P><PRE>[wmcdonald@willspc conf]$ <B>ci -u sample.conf</B>
RCS/sample.conf,v  <--  sample.conf
new revision: 1.3; previous revision: 1.2
enter log message, terminated with single '.' or end of file:
>> <B>Fixed option1 typo. Added $Id$ for RCS.</B>
>> <B>WMCD</B>
>> <B>.</B>
done
[wmcdonald@willspc conf]$ <B>cat sample.conf</B>
# sample config file
#
# $Id: sample.conf,v 1.3 2005/06/27 11:18:38 wmcdonald Exp $

option1=default
option2=default

[wmcdonald@willspc conf]$
</PRE>
<P><BR>So, to summarise, for a new config file use ci -u to check in, co -l to 
check-out before editing and ci -u again to check back in once complete. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px"></DIV><A 
name=Useful_RCS_Tools_.26_Features></A>
<H3>Useful RCS Tools & Features</H3>
<P>rlog and rcsdiff and the remaining commands we need to be aware of. rlog 
provides a potted history of the file's modifications. </P>
<P><BR></P><PRE>[wmcdonald@willspc conf]$ <B>rlog ./sample.conf</B>

RCS file: ./RCS/sample.conf,v
Working file: ./sample.conf
head: 1.3
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;     selected revisions: 3
description:
initial check-in - WMCD
----------------------------
revision 1.3
date: 2005/06/27 11:18:38;  author: wmcdonald;  state: Exp;  lines: +3 -1
Fixed option1 typo. Added $Id$ for RCS.
WMCD
----------------------------
revision 1.2
date: 2005/06/27 11:16:05;  author: wmcdonald;  state: Exp;  lines: +5 -0
Initial edit. Added a comment and set some default options.
WMCD
----------------------------
revision 1.1
date: 2005/06/27 11:10:19;  author: wmcdonald;  state: Exp;
Initial revision
=============================================================================
[wmcdonald@willspc conf]$

</PRE>
<P>rcsdiff provides us with a detailed breakdown of the changes (i.e. a diff) 
between revisions of a file. </P><PRE>[wmcdonald@willspc conf]$ <B>rcsdiff -r1.2 -r1.3 ./sample.conf</B>
===================================================================
RCS file: ./RCS/sample.conf,v
retrieving revision 1.2
retrieving revision 1.3
diff -r1.2 -r1.3
1a2,3
> #
> # $Id: sample.conf,v 1.3 2005/06/27 11:18:38 wmcdonald Exp $
3c5
< option1=defalt
---
> option1=default
</PRE>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px"></DIV><A 
name=Working_With_RCS_and_Source_Files_in_Bulk></A>
<H2>Working With RCS and Source Files in Bulk</H2>
<P>RCS allows us to check-in and check-out entire directories (think whole 
projects) worth of files. As an example lets say that static content on webdev1 
for Managed $Project isn't under RCS control and we'd like it to be. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px"></DIV><A 
name=Initial_Bulk_Check-in></A>
<H3>Initial Bulk Check-in</H3>
<P>We want to check in all the HTML source, to save having to add individual 
descriptive text for each file (remember, the descriptive text tells us the 
file's purpose) we can assign a global description to all the files being 
checked-in in one fell swoop using the "-t-" option to ci. </P>
<P>Check which files we'll be checking-in and create the RCS subdirectory for 
the "vector" files: </P><PRE>[root@webdev1 public_html]# <B>cd /home/project.net/public_html/</B>
[root@webdev1 public_html]# <B>ls -l *.html</B>
-rw-r--r--  1 root root  121 Dec  1  2004 atmail.html
-rw-r--r--  1 root root 2251 Oct 17 11:04 cookie2test.html
-rw-r--r--  1 root root  730 Sep 25  2003 cookietest.html
-rw-r--r--  1 root root  660 Sep 25  2003 em_export.html
-rw-r--r--  1 root root  406 Sep 30 13:05 index1024.html
-rw-r--r--  1 root root  405 Sep 25  2003 index1152.html
-rw-r--r--  1 root root  406 Sep 25  2003 index640.html
-rw-r--r--  1 root root  406 Sep 30 13:07 index800.html
-rw-r--r--  1 root root 2727 Sep 25  2003 index.html
-rw-r--r--  1 root root 3619 Oct 10 15:32 logon.html
-rw-r--r--  1 root root 3574 Sep 25  2003 logontest.html
-rw-r--r--  1 root root 5451 Sep 25  2003 nmslogoff.html
-rw-r--r--  1 root root  310 Sep 25  2003 project.html
-rw-r--r--  1 root root  454 Dec 20  2004 ttrac_msg.html
[root@webdev1 public_html]# <B>mkdir RCS</B>
</PRE>
<P>Now we check-in all the HTML files. "<B>-i</B>" tells ci this is the initial 
check-in, files already checked in will be ignored. "<B>-u</B>" tells ci to 
leave a read-only working copy of the file in place. "<B>-t-</B>" tells ci to 
use the message which follows in quotes as the descriptive text. </P><PRE>[root@webdev1 public_html]# <B>ci -i -u -t-"Managed $Project (project.net) static pages" *.html</B>
RCS/atmail.html,v  <--  atmail.html
initial revision: 1.1
done
RCS/cookie2test.html,v  <--  cookie2test.html
initial revision: 1.1
done
RCS/cookietest.html,v  <--  cookietest.html
initial revision: 1.1
done
RCS/em_export.html,v  <--  em_export.html
initial revision: 1.1
done
RCS/index1024.html,v  <--  index1024.html
initial revision: 1.1
done
RCS/index1152.html,v  <--  index1152.html
initial revision: 1.1
done
RCS/index640.html,v  <--  index640.html
initial revision: 1.1
done
RCS/index800.html,v  <--  index800.html
initial revision: 1.1
done
RCS/index.html,v  <--  index.html
initial revision: 1.1
done
RCS/logon.html,v  <--  logon.html
initial revision: 1.1
done
RCS/logontest.html,v  <--  logontest.html
initial revision: 1.1
done
RCS/nmslogoff.html,v  <--  nmslogoff.html
initial revision: 1.1
done
RCS/project.html,v  <--  project.html
initial revision: 1.1
done
RCS/ttrac_msg.html,v  <--  ttrac_msg.html
initial revision: 1.1
done
</PRE>
<P>We can check the state of one of the newly checked in files using rlog. </P><PRE>[root@webdev1 public_html]# <B>rlog ./index.html</B>

RCS file: ./RCS/index.html,v
Working file: ./index.html
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;     selected revisions: 1
description:
<B>Managed $Project (project.net) static pages</B>
----------------------------
revision 1.1
date: 2005/10/19 14:49:45;  author: root;  state: Exp;
Initial revision
=============================================================================
</PRE>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px"></DIV><A 
name=Bulk_Check-out></A>
<H3>Bulk Check-out</H3>
<P>If we want to make changes across a few files at the same time we can 
check-out all HTML files, edit the ones we need then do a bulk check-in and only 
the files which have changed will have their "vector" files updated. </P><PRE>[root@webdev1 public_html]# <B>co -l *.html</B>
RCS/atmail.html,v  -->  atmail.html
revision 1.1 (locked)
done
RCS/cookie2test.html,v  -->  cookie2test.html
revision 1.1 (locked)
done
RCS/cookietest.html,v  -->  cookietest.html
revision 1.1 (locked)
done
RCS/em_export.html,v  -->  em_export.html
revision 1.1 (locked)
done
RCS/index1024.html,v  -->  index1024.html
revision 1.1 (locked)
done
RCS/index1152.html,v  -->  index1152.html
revision 1.1 (locked)
done
RCS/index640.html,v  -->  index640.html
revision 1.1 (locked)
done
RCS/index800.html,v  -->  index800.html
revision 1.1 (locked)
done
RCS/index.html,v  -->  index.html
revision 1.1 (locked)
done
RCS/logon.html,v  -->  logon.html
revision 1.1 (locked)
done
RCS/logontest.html,v  -->  logontest.html
revision 1.1 (locked)
done
RCS/nmslogoff.html,v  -->  nmslogoff.html
revision 1.1 (locked)
done
RCS/project.html,v  -->  project.html
revision 1.1 (locked)
done
RCS/ttrac_msg.html,v  -->  ttrac_msg.html
revision 1.1 (locked)
done
[root@webdev1 public_html]#
</PRE>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px"></DIV><A 
name=Bulk_Check-in></A>
<H3>Bulk Check-in</H3>
<P>Now I can add the RCS "<B>$Id$</B>" macro into a few of the files and perform 
a bulk check-in. I only need to enter the log message for the first edited file. 
Once entered and terminated with the '.' dot, holding down ENTER will simply 
re-use the previous log for all <B>changed</B> files. </P><PRE>[root@webdev1 public_html]# <B>vi index*</B>
5 files to edit
[root@webdev1 public_html]# <B>ci -u *.html</B>
RCS/atmail.html,v  <--  atmail.html
file is unchanged; reverting to previous revision 1.1
done
RCS/cookie2test.html,v  <--  cookie2test.html
file is unchanged; reverting to previous revision 1.1
done
RCS/cookietest.html,v  <--  cookietest.html
file is unchanged; reverting to previous revision 1.1
done
RCS/em_export.html,v  <--  em_export.html
file is unchanged; reverting to previous revision 1.1
done
RCS/index1024.html,v  <--  index1024.html
new revision: 1.2; previous revision: 1.1
enter log message, terminated with single '.' or end of file:
>> <B>Added $Id$ in comment for the index files by way of an</B>
>> <B>example for RCS docs.</B>
>> <B>wmcd</B>
>> <B>.</B>
done
RCS/index1152.html,v  <--  index1152.html
new revision: 1.2; previous revision: 1.1
reuse log message of previous file? [yn](y):
done
RCS/index640.html,v  <--  index640.html
new revision: 1.2; previous revision: 1.1
reuse log message of previous file? [yn](y):
done
RCS/index800.html,v  <--  index800.html
new revision: 1.2; previous revision: 1.1
reuse log message of previous file? [yn](y):
done
RCS/index.html,v  <--  index.html
new revision: 1.2; previous revision: 1.1
reuse log message of previous file? [yn](y):
done
RCS/logon.html,v  <--  logon.html
file is unchanged; reverting to previous revision 1.1
done
RCS/logontest.html,v  <--  logontest.html
file is unchanged; reverting to previous revision 1.1
done
RCS/nmslogoff.html,v  <--  nmslogoff.html
file is unchanged; reverting to previous revision 1.1
done
RCS/project.html,v  <--  project.html
file is unchanged; reverting to previous revision 1.1
done
RCS/ttrac_msg.html,v  <--  ttrac_msg.html
file is unchanged; reverting to previous revision 1.1
done
[root@webdev1 public_html]#
</PRE><!-- Saved in parser cache with key wikidb:pcache:idhash:965-1!1!0!1!0!1!!0!en and timestamp 20051117154141 -->
<DIV class=printfooter>Retrieved from "<A 
href="http://wikiserv/wikidoc/index.php?title=RCS">http://wikiserv/wikidoc/index.php?title=RCS</A>"</DIV><!-- end content -->
<DIV class=visualClear></DIV></DIV></DIV></DIV>
<DIV id=column-one>
<DIV class=portlet id=p-cactions>
  </LI></UL></DIV></DIV><!-- Served by wikiserv.project.net in 0.34 secs. --></BODY></HTML>