info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parsing rcs file ? (branches)


From: Larry Jones
Subject: Re: parsing rcs file ? (branches)
Date: Tue, 8 Apr 2003 17:57:31 -0400 (EDT)

Ronald Petty writes:
> 
> I am about to start parsing rcs files (cvs) so I can make my webpage
> list the revisions and you click on a certain one and it is created and
> shown.  However I believe I have figured it out for one branch (the main
> branch in this case).  I assume there is no conflicts since I am using
> the repository, just a guess here.  If I click a file that has a merge
> between branches in the past how do I build up my file?  Do I follow all
> branches forwards until my file is recreated for the selected revision? 
> I suppose as long as I do this in order it will be ok?  Am I
> correct/wrong?

I'm not sure what you're asking -- are you asking how to apply the
deltas from the RCS file to reconstruct an arbitrary revision?  If so,
the answer is that you start with the revision pointed to by head in the
admin data.  That's the most recent revision on the trunk and the
deltatext for that node contains the entire contents of the file.  Then
you work backwards along the trunk, following the next field in the
delta data and applying the diffs specified in the corresponding
deltatext until you get to the ultimate ancestor of the revision you
want.  You then consult the branches field to find the next revision
along the branch you want and work forwards along that branch using the
same process until you get to the next branch point.

As an example, say you want to retrieve revision 1.2.4.3.2.5.  The
ultimate ancestor is revision 1.2 (just the first two components of the
revision number).  So, you start with the head which is, say, revision
1.10.  You extract that file and then follow next to 1.9 and apply it's
delta.  You follow next again to 1.3 (1.4, 1.5, 1.6, 1.7, and 1.8 were
all deleted) and apply that delta, follow again to 1.2 and apply that
delta.  Now, since you're at the ancestor, you look at the branches and
find the one whose first three components are 1.2.4 and follow it to,
say, 1.2.4.2 (because 1.2.4.1 was deleted) and apply its delta.  That's
not the next branch point, 1.2.4.3 is, so you again follow next and
apply the delta.  Now you are at an ancestor, so you again consult
branches, this time looking for the first revision on the 1.2.4.3.2
branch.  And so it goes.

-Larry Jones

At times like these, all Mom can think of is how long she was in
labor with me. -- Calvin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]