Using rcs


  1. Basic Operations
  2. Hacky History-Searching
  3. See Also
    1. Documentation

Basic Operations

      Command                   Does what
      co -l file                checks-out file with a lock
      co -r#.# file             checks-out revision #.# of file
      ci -u file                checks-in file and removes existing lock (also prompts for a commit message)
      rcsdiff file              shows diff existing between the current copy of file and file when it was last checked-in
      rcsdiff -r#.# -r#.# file  shows diff between revision #.# and #.# (rcsdiff -r1.19 -r1.25 file)
      rlog -b file              shows the commit logs for changes of file

Useful Information

Hacky History-Searching

I recently had an issue at work where I needed to find when a particular DNS entry was added/removed from the zone file. This was on an older system and was using RCS. A System Administrator had re-added the entry in revision 3.9614. We were currently on revision 3.9616. I needed to know when/why it was removed.

To not bother production, I copyied my file & file,v to /tmp/. Then I confirm when it was added back by manually looping through each revision and checking it out until the entry was not present:

        NUM=9616 # current revision
        while true; do co -r3.${NUM} 2> /dev/null; grep missinghostname > /dev/null || break; NUM=$(( $NUM - 1 )); done
        echo "missinghostname NOT found on revision 3.${NUM}"

As expected, this returns "Not found on revision 3.9613". This was the revision before the Administrator re-added it, so this makes sense.

Next, I did a very similar loop - except checking for where the host is present again - to find when it still existed:

        while true; do co -r3.${NUM} 2> /dev/null; grep missinghostname > /dev/null && break; NUM=$(( $NUM - 1 )); done
        echo "missinghostname Found on revision 3.${NUM}"

This returns "Found on revision 3.8723". That means it was removed in revision 3.8724. I can then use rlog -r3.824 to find the commit/reasoning/date of removal.

See Also