The RCSDelta
interface supports operations on the individual deltas
of an RCS file.
INTERFACEAnRCSDelta ; IMPORT RCSDate, RCSError, RCSPhrases, RCSRevNum, RCSString; CONST Brand = "RCSDelta"; TYPE T <: Public; Public = OBJECT revision: RCSRevNum.T := NIL; date: RCSDate.T := NIL; author: TEXT := NIL; state: TEXT := NIL; END; Iterator = OBJECT METHODS next(VAR delta: T): BOOLEAN; END;
RCSDelta.T
, or delta, represents a single revision of an RCS
file. Do not create a delta explicitly; use RCSFile.AddDelta
instead.
An Iterator
is an object for iterating over a set of deltas.
PROCEDURE Compare(d1, d2: T): [-1..1];
Compare two deltas according to their revision numbers.
PROCEDURE Dead(delta: T; inAttic: BOOLEAN): BOOLEAN;
Return an indication of whether the given delta is dead, according to CVS rules.
PROCEDURE Equal(d1, d2: T): BOOLEAN;
Test whether two deltas have identical revision numbers.
PROCEDURE GetBranch(delta: T; revNum: RCSRevNum.T): T RAISES {RCSError.E};
Gets the first delta of the given branch. Raises the exception if the branch does not exist.
PROCEDURE GetLog(delta: T): RCSString.T RAISES {RCSError.E};
Return a string containing the log entry of the given revision.
PROCEDURE GetText(delta: T; diffBase: T := NIL): RCSString.Iterator RAISES {RCSError.E};
Return a string iterator for retrieving the revision's text, in full,
or as a diff relative to diffBase
.
With the default
diffBase
of NIL
, GetText
retrieves the full
text for delta
. Otherwise, GetText
attempts to calculate
the diffs required to transform the diffBase
delta into delta
.
It is not possible to do this in all cases, although in practice,
the important cases are covered. GetText
is able to reverse
an existing set of diffs, but it is not able to combine a
succession of diffs into one. Therefore, if delta
was originally
based upon diffBase
, or vice-versa, then the operation will
succeed.
PROCEDURE IterateBranches(delta: T): Iterator;
Return an iterator over the branches of the given delta, in their order of appearance in the RCS file.
PROCEDURE IterateBranchesReversed(delta: T): Iterator;
Return an iterator over the branches of the given delta, in reverse order from their sequence in the RCS file.
PROCEDURE IterateTextPhrases(delta: T): RCSPhrases.Iterator;
Iterate over all the newphrases
in the text section of the delta,
in their order of appearance.
PROCEDURE IterateTreePhrases(delta: T): RCSPhrases.Iterator;
Iterate over all the newphrases
in the tree section of the delta,
in their order of appearance.
PROCEDURE GetPrev(delta: T): T;
Returns the previous delta from the given one, i.e., moves toward the head delta.
PROCEDURE Predecessor(delta: T): T;
Return the delta on which delta
was based. This moves toward
lower revision numbers.
PROCEDURE ToText(delta : T) : TEXT;
Produce a readable representation for debugging purposes.
END RCSDelta.