info-cvs
[Top][All Lists]
Advanced

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

Re: How to determine the previous revision number?


From: Eric Siegerman
Subject: Re: How to determine the previous revision number?
Date: Thu, 7 Aug 2003 21:27:57 -0400
User-agent: Mutt/1.2.5i

On Thu, Aug 07, 2003 at 06:42:43PM -0400, Dickson, Craig wrote:
> Or alternatively is there a known algorithm, that given a
> CVS revision number, can determine what the previous revision number was?

if the last component (the Z in 1.3.2.Z) is greater than 1
        decrement it
else if there are more than two components
        strip off the last two components
else
        // there are exactly two components, X.1
        this was the first revision; it has no predecessor

1.5 -> 1.4 -> 1.3 -> 1.2 -> 1.1
1.3.6.2.2.2 -> 1.3.6.2.2.1 -> 1.3.6.2 -> 1.3.6.1 -> 1.3 -> 1.2 -> 1.1

Notes:
  - For CVS, the first component is very likely to be 1; however,
    it *can* have a different value (especially in ,v files
    originally created with raw RCS)

  - If rev. 1.1.1.1 exists, it's a special case, with two
    subcases:
      - 1.1.1.1 is usually identical to rev. 1.1; in this case,
        consider 1.1.1.1 to be the first revision, and ignore 1.1
        entirely.

        This subcase arises when the ,v file was created by "cvs
        import".  That "wants" the first revision to be 1.1.1.1,
        but the RCS file format doesn't allow that (you can't
        have a branch with no root), so import creates rev. 1.1
        simply as a root to which to anchor 1.1.1.1.

      - If 1.1.1.1 differs from 1.1, don't ignore either of them.
        It's not clear what you *should* do here, since (the file
        format's logic notwithstanding) it's possible that
        neither rev. is really an ancestor of the other; they've
        probably descended from a common ancestor that isn't
        available in CVS!  (Kind of like humans and gorillas,
        whose common ancestor is long extinct.)

        This arises when the file was created locally via "cvs
        add; cvs commit", and someone subsequently did a "cvs
        import" of that file.

    Note that you can distinguish these two cases from the log
    output, by looking at the "+N -M" indicators on 1.1.1.1, so
    you don't have to "cvs diff" them.
    
--

|  | /\
|-_|/  >   Eric Siegerman, Toronto, Ont.        address@hidden
|  |  /
When I came back around from the dark side, there in front of me would
be the landing area where the crew was, and the Earth, all in the view
of my window. I couldn't help but think that there in front of me was
all of humanity, except me.
        - Michael Collins, Apollo 11 Command Module Pilot





reply via email to

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