[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
RE: Issuezilla #175: Add new -F style option that only allows tag to move to newer revision
Tue, 4 May 2004 12:33:51 -0700
That's awesome Derek.
Question: The function checks that r1 is an ancestor of r2, or it checks
that r2 is a descendant of r1, depending on your point of view. Given
this, and any CVS coding standards that may apply, would this be more
properly named is_ancestor() or is_decendant()?
Now I just need to get the latest cvs code from cvs...
Geoffrey A. Lowney
Senior Software Development Engineer
Recreational Equipment, Inc.
Phone 253-395-8164 Fax 253-437-7291
Pager 206-625-8477 email@example.com
> -----Original Message-----
> From: Derek Robert Price [mailto:firstname.lastname@example.org]
> Sent: Tuesday, May 04, 2004 12:21 PM
> To: Geoffrey Lowney
> Cc: Mark D. Baushke; email@example.com
> Subject: Re: Issuezilla #175: Add new -F style option that only allows
> to move to newer revision
> -----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
> > >(similar to compare_revnums) that would work? Or will I end up
> > >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
> 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.
> - --
> Email: firstname.lastname@example.org
> 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
> -----END PGP SIGNATURE-----