# Revision Control System (rcs) for System Administration
#
# Hands on by Frank Becker <fb@alien8.de>
#
# Chaos Computer Club Dresden presents
# Themenabend: Versionskontrollsysteme
#
# http://www.c3d2.de/?id=ta14
#
# Fri Apr 22

## Basic Usage
# Create file named file1
vi file1

# check in file1
ci file1

# look for file1
ls -l file1

# ok, check out file1
co file1
ls -l file1

# hmm, only read-only
# need to lock file
rcs -l file1 # or better
ci -l file1

# make dir RCS
mkdir RCS
mv file1,v RCS

# change the file
cat >> file1 << EOF
Tack
EOF

# check in again
ci -l file1
ls -la

# want to see log
rlog file1

# want to see diff r1.1 and r1.2
rcsdiff -r1.1 -r1.2 ./file1

# has the file changed?
rcsdiff file1

# add another version
vi file1

# check in again
ci -l file1

# delete old revision
rcs -o1.1:1.1 ./file1

# check out version 1.2
co -l -r1.2 file1

# check out version b4 date
co -d"2005-04-22 16:00:00+02" ./file1

# Marker
# add $Id$ $Log$ $Author$ and $Date$ to file1
vi file1
ci -l file1
head -n 7 file1
# Id stands for
# filename revision date time author state [lock owner]

## Locking
# Only the one who has the lock can check in.
# Is the file locked?
rlog -l ./file1

# get the lock
rcs -l file1

# don't send an e-mail to the locker
rcs -l -M file1

# unlock the file
co -u file1

## Reverse change of version 1.3 to version 1.4
rcsdiff -r1.4 -r1.3 file1 > file1.patch
patch file1 file1.patch

# or
rcsmerge  -r1.4  -r1.3  file

## Name set of config files (symbolic names)
# give a set of files a sybolic revision name
rcs -nals_es_noch_ging: RCS/*,v
#		      ^<- very important

# check out all files with the symbolic revision name
co -l -rals_es_noch_ging RCS/*,v

# remove symbolic revision name
rcs -nals_es_noch_ging RCS/*,v

## Environment
RCSINIT="-l"

# now do
man rcs
man co
man ci
man rcsdiff
man rlog
man rcsclean
man rcsmerge
