Contributed by dhartmei on from the opencvs dept.
There has been quite a bit of interest from the user community in the
OpenCVS project over the past
while, and I have been thinking about writing some sort of blog entry
on the subject for some time. I guess Marco's incessant blogging has
finally gotten to me and inspired me to try to write something myself!
Since I have been hacking on the RCS parser lately, I thought
I'd write a short article about this file format which sits at the core of CVS.
head 1.3; access; symbols; locks niallo:1.3; strict; comment @# @;Following this section comes the deltas. Each entry in this section basically describes a particular revision of the file being tracked. It contains the date and time of the revision, the author, the state, sometimes branch information and a pointer to the previous revision. E.g.:
1.3 date 2006.02.27.17.07.13; author niallo; state Exp; branches; next 1.2; 1.2 date 2006.02.27.17.06.38; author niallo; state Exp; branches; next 1.1;Finally, there is the deltatext section. These contain the data corresponding to the file contents and associated commit log message at each revision. Typically, the HEAD deltatext (usually the first appearing in the file) is the complete contents of the file. All previous deltatexts contain diffs against this deltatext in a sort of reverse ed(1) format. E.g.:
d1 1 a1 1 $Id$ d3 1This deltatext demonstrates the two operations patches perform: delete, and addition. "d1 1" translates to "at line one, delete one line worth of text". Conversely, "a1 1" following by its line of data translates to "at line one, insert the following single line of text". In order to retrieve a particular revision, you typically first retrieve the HEAD revision, then calculate the final data by reverse-applying the diffs in the deltatexts up to the desired revision. Well, that's it for my short introduction to the RCS file format. Hopefully, this should illustrate why certain things can be tricky or slow in CVS/RCS, namely:
- Dealing with binary files.
- Retrieving an arbitrary revision requires parsing all previous deltas and deltatexts, thus it is not at all a random access operation.
(Comments are closed)