[Top][All Lists]

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

Re: Explicit revision numbers

From: Mark D. Baushke
Subject: Re: Explicit revision numbers
Date: Thu, 21 Sep 2006 10:24:07 -0700

Hash: SHA1

Holger <address@hidden> writes:

> As stated in an earlier topic on this list "How do I diff from 'add' to
> rev 1.1?" ...
> I've created a little python script to produce patches from log
> messages - i.e.:
> patchmaker "Bug 123"
> In this script I parse the logs and I need to find out what previous
> rev each new rev is based on. I do that like this:
>     def calcPrevRev(self):
>         # todo: get this from CVS instead of guessing
>         self.prevrev = "0"
>         ver = self.rev.split(".")
>         n = int(ver.pop()) - 1
>         while len(ver) >= 1:
>             if n >= 1:
>                 ver.append(str(n))
>                 self.prevrev = ".".join(ver)
>                 break
>             else:
>                 if len(ver) <= 1: # prevrev is null
>                     break
>                 ver.pop() # throw this away
>                 n = int(ver.pop())

If someone has done a 'cvs admin -o1.23' after revision 1.24 exists,
then your script will do the wrong thing as the predecessor revision
will be 1.22 rather than 1.23. This of course is concerned with finding
the predecessor of revisions that already exist in the repository.

> My question:
> IRC I've read somewhere that you are able to explicitely specify new
> revision number - e.g bump the major number - when checking in. Is this
> still true?

Probably, but do not use it. CVS revision numbers are for use by CVS
internals and it is entirely possible to break fundamental assumptions
when you try to do tricky things with them.

> Is there a better way than the above to figure prevrev out?

Better? I suppose that depends on what you mean. You could process

  cvs rlog -N -r:1.24 module/subdir/filename

to get the log messages for the 1.24 and previous revisions on the same
branch and then process the log messages produced.

You will probably also be interested in the work that Frank Hemer was
proposing to extend the syntax for tags to have a .prev suffix to
identify the previous revision. I have not heard from Frank in a long
time, so I do not know the state of things with regard to that set of

        -- Mark
Version: GnuPG v1.4.4 (FreeBSD)


reply via email to

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