- RCS maintains files in ,v archive files in current or
RCS directory
[honeydew]/vallino/csc173>mkdir RCS
- Edit initial version of file, create RCS archive. rcs
command performs many administrative operations on the arcive files.
[honeydew]/vallino/csc173>emacs rcsprog.cc
[1] 20206
[honeydew]/vallino/csc173>rcs -i -L rcsprog.cc
RCS file: RCS/rcsprog.cc,v
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> This is a test program for the RCS lab session.
>> .
done
- ci (check-in) command puts a file back into RCS
[honeydew]/vallino/csc173>ci rcsprog.cc
RCS/rcsprog.cc,v <-- rcsprog.cc
initial revision: 1.1
done
- rlog tells you information about a file under RCS control
[honeydew]/vallino/csc173>rlog rcsprog.cc
RCS file: RCS/rcsprog.cc,v
Working file: rcsprog.cc
head: 1.1
branch:
locks: strict
access list:
symbolic names:
comment leader: "// "
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
This is a test program for the RCS lab session.
----------------------------
revision 1.1
date: 1994/10/14 16:45:21; author: vallino; state: Exp;
Initial revision
=========================================================
- co (check-out) will request a copy of a file from RCS.
The default is an unlocked copy of the latest revision of the file.
[honeydew]/vallino/csc173>co rcsprog.cc
RCS/rcsprog.cc,v --> rcsprog.cc
revision 1.1
done
[honeydew]/vallino/csc173>ls -l rcsprog.cc
-r--r--r-- 1 vallino 260 Oct 14 12:45 rcsprog.cc
- To edit a file you must request a lock on the revision via -l
[honeydew]/vallino/csc173>co -l rcsprog.cc
RCS/rcsprog.cc,v --> rcsprog.cc
revision 1.1 (locked)
done
[honeydew]/vallino/csc173>ls -l rcsprog.cc
-rw-r--r-- 1 vallino 268 Oct 14 12:46 rcsprog.cc
- A writable version of a file will not be destroyed
[honeydew]/vallino/csc173>co -l rcsprog.cc
RCS/rcsprog.cc,v --> rcsprog.cc
revision 1.1 (locked)
writable rcsprog.cc exists; remove it? [ny](n): n
co error: checkout aborted
- Only one lock per revision allowed
[honeydew]/vallino/csc173>co -l rcsprog2.cc
RCS/rcsprog2.cc,v --> rcsprog2.cc
co error: revision 1.1 already locked by salgian
- rcs -u can break a lock if needed
[honeydew]/vallino/csc173>rcs -u rcsprog2.cc
RCS file: RCS/rcsprog2.cc,v
Revision 1.1 is already locked by salgian.
Do you want to break the lock? [ny](n): y
State the reason for breaking the lock:
(terminate with single '.' or end of file)
>> Garbis,
>> I need to make changes to rcsprog2.cc. I'm stealing the lock.
>> We can merge our changes later.
>> Jim
>> .
1.1 unlocked
done
[honeydew]/vallino/csc173>co -l rcsprog2.cc
RCS/rcsprog2.cc,v --> rcsprog2.cc
revision 1.1 (locked)
done
- RCS maintains a log of changes to a file by requesting a
description of the changes.
[honeydew]/vallino/csc173>emacs rcsprog.cc
[1] 20399
[honeydew]/vallino/csc173>ci -u rcsprog.cc
RCS/rcsprog.cc,v <-- rcsprog.cc
new revision: 1.2; previous revision: 1.1
enter log message, terminated with single '.' or end of file:
>> Just changed what is printed.
>> .
done
- Use $Log: $ and $Id: $ keywords to provide RCS
information within source
files. Place Log keyword inside of comments.
Id may be part of character string in .cc and .c files.
// $Log: $
/* $Log: $
*/
// $Id: $
static char rcs_id[] = {_$Id: $_};
- Keywords are automatically expanded by RCS
[honeydew]/vallino/csc173>cat rcsprog.cc
// A test program to show working with RCS
// $Id: rcsprog.cc,v 1.2 1994/10/14 17:07:38 vallino Exp $
// $Log: rcsprog.cc,v $
// Revision 1.2 1994/10/14 17:07:38 vallino
// Just changed what is printed.
//
// Revision 1.1 1994/10/14 16:45:21 vallino
// Initial revision
//
#include
...
- rlog also shows revision comments and locking information
[honeydew]/vallino/csc173>rlog rcsprog.cc
RCS file: RCS/rcsprog.cc,v
Working file: rcsprog.cc
head: 1.2
branch:
locks: strict
access list:
symbolic names:
comment leader: "// "
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
This is a test program for the RCS lab session.
----------------------------
revision 1.2
date: 1994/10/14 17:07:38; author: vallino; state: Exp; lines: +6 -3
Just changed what is printed.
----------------------------
revision 1.1
date: 1994/10/14 16:45:21; author: vallino; state: Exp;
Initial revision
=========================================================
- rcsdiff can tell you the difference between two revisions
of a file
[honeydew]/vallino/csc173>rcsdiff rcsprog.cc
=========================================================
RCS file: RCS/rcsprog.cc,v
retrieving revision 1.1
diff -r1.1 rcsprog.cc
14c14
< cout << "Hello, world\n";
---
> cout << "Really just hello, csc173";
- Other useful RCS features
- Symbolic names
- Branches
- Access lists
- Merging - rcsmerge