Most of the products we tested use an RCS-style system for file storage. But what is RCS, or Revision Control System? In a nutshell, RCS is a rudimentary VCS (version-control system) that lends the file format it uses to store data and revision information to many other, more sophisticated systems. Although RCS can handle binary data, it is a chore to set up and therefore is generally used only for text-based files.
An RCS file starts with revision information -- the head revision, branches, authors and dates -- and moves on to the real meat that describes the current revision and "diff" information for previous revisions.
For example, let's say you had two versions of a text file (line numbers added for clarity):
| First version (1.1): | Second version (1.2): |
| 1. #include <stdio.h> | 1. #include <stdio.h> |
| 2. void main() { | 2. void main() { |
| 3. | 3. |
| 4. printf("Coolness\n"); | 4. printf("Coolness\n"); |
| 5. } | 5. printf("c ya later!\n"); |
| 6. } | 6. |
The RCS file would contain a listing of version 1.2 (the newest revision) with some added information on how to get back to version 1.1:
1.1
log
@Initial revision
@
text
@d5 1
@
The d5 1 tells us that to get from version 1.2 to version 1.1 all we need to do is delete one line starting at Line 5. If we reversed the versions, our file would contain the following info:
1.1
log
@Initial revision
@
text
@a5 1
printf("c ya later!\n");
@
This indicates that to get from version 1.2 to version 1.1, we should add the text at Line 5. Every addition or deletion of text can be described by this format. This is a much better solution than storing complete versions.
The only problem with this particular format is that if you lose the single file that stores the information, you're toast. So, as always, back up early and often.