bug-cvs
[Top][All Lists]
Advanced

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

Re: Issuezilla #175: Add new -F style option that only allows tag to mov


From: Derek Robert Price
Subject: Re: Issuezilla #175: Add new -F style option that only allows tag to move to newer revision
Date: Tue, 04 May 2004 15:20:51 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Geoffrey Lowney wrote:

> >But I am not sure how to check that one revision is a descendant of
> >another.  Does anyone know if there an existing function in the code
> >(similar to compare_revnums) that would work?  Or will I end up having
> >to implement a new is_descendant function to enforce this new rule?


You'll need a new function.  Put it in subr.c, probably.  Assuming
that rev1 & rev2 are already known to be valid revisions, something
like the following should suffice:

/* The following will return true if rev1 is an ancestor of rev2.  */
dotsrev1 = numdots (rev1);
dotsrev2 = numdots (rev2);
/* assert we were not passed any branches */
assert (dotsrev1 & 1);
assert (dotsrev2 & 1);
if (dotsrev1 == dotsrev2)
{
    p = strrchr (rev1, '.');
    *p++ = '\0';
    q = strrchr (rev2, '.');
    *q++ = '\0';
    return !strcmp (rev1, rev2) && strtol (p, NULL, 10) < strtol (q,
NULL, 10);
}
return strlen (rev1) < strlen (rev2) && strncmp (rev1, rev2, strlen
(rev1));



Not sure if you want to special-case vendor branches or not.
Unfortunately, in some cases it might be valid to move a tag from a
vendor branch to the trunk and in other cases it might not and the
difference won't be easily detectable,  I say leave it alone and let
the user use -F if they think they know what they are doing.

Derek
- --
                *8^)

Email: derek@ximbiot.com

Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAl+0SLD1OTBfyMaQRAgTCAKCQMZ7Hn8X1po6Kx0Vz0io+PGx+YgCg9LF/
wc/I3clSr3egLTtzuG8hQCU=
=r03j
-----END PGP SIGNATURE-----





reply via email to

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