bug-cvs
[Top][All Lists]
Advanced

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

RE: Documentation suggested to clearer state restrictions to merg ing


From: Cameron, Steve
Subject: RE: Documentation suggested to clearer state restrictions to merg ing removed files
Date: Thu, 7 Dec 2000 14:16:58 -0600

Derek Price wrote:

> "Cameron, Steve" wrote:
> 
         [...] 

> >         It also allows ".trunk.origin", which will give you the oldest
> > revision
> >         on the trunk, but I'm not sure allowing that was a good idea
> because
> >         as files are added to the trunk, ".trunk.origin" will give back
> > different
> >         results over time.   If files added to the trunk were added as
> > "dead"
> >         revisions first, that problem would go away I think...,
> >         (but then ".trunk.origin" would probably return the empty set,
> how
> >         useful is that?  Perhaps the combination of ".trunk" and
> ".origin"
> >         is just senseless.
> 
> Hmm.  Yeah, and cvs co -r1.1 would do the same thing.  The only thing
> meaningful I can think of for .trunk.origin would be to retreive the
> earliest
> incarnation of the vendor branch, if present.
        [smc]  unless somebody has (accidentally) done cvs commit -r 2.0 or
something dumb
        like that, or, if you have a repository that's been "converted" from
RCS
        by simply copying the *,v files.   (I've had this conversation
before).

> Does branch_name.origin retreive the branchpoint from the parent branch or
> from
> the trunk?
        [smc]  the parent branch, if I get your meaning.  Basically
whichever revision is 
        the start of that branch, as if you had created a static tag
"branch_name.origin" 
        prior to creating the branch. (Of course "." is not normally a valid
char...)

        As if branch_tag.origin already existed as a static tag and you had
done:
        cvs rtag -b -r branch_tag.origin branch_tag everything

        The part of the patch relevant to your question is this part I
think, 
        which is largely taken from another function that already existed, 
        (I forget now just which one...) Now that I'm looking at this again,

        it's not exactly crystal clear, it was like 6 months ago I first did
this...

        + char *
        + RCS_getbranchoriginrev (rcs, branch)
        +     RCSNode *rcs;
        +     char *branch;
        + {
        +     char * version;
        + 
        +     char *cur_rev = NULL;
        +     char *cp;
        +     char *xbranch, *xrev;
        +     Node *p;
        +     char *at_least_one_dot;
        +     RCSVers *vers;
        + 
        +     version = RCS_whatbranch(rcs, branch);
        +     if (version == NULL) return (NULL);
        + 
        +     /* look up the first revision on the branch */
        +     xrev = xstrdup (version);
        +     cp = strrchr (xrev, '.');
        +     if (cp == NULL)
        +     {
        +       /* what exactly is this case? No dots? */
        +       /* maybe we should retrun RCS_trunkorigin */
        + 
        +       free (xrev);
        +       return (NULL);
        +     }
        +     *cp = '\0';                               /* turn it into a
revision */
        + 
        +     assert (rcs != NULL);
        + 
        +     if (rcs->flags & PARTIAL)
        +       RCS_reparsercsfile (rcs, (FILE **) NULL, (struct rcsbuffer
*) NULL);
        + 
        +     at_least_one_dot = strchr(xrev, '.');
        +     if (at_least_one_dot == NULL)  /* no dots left, we are on the
trunk */
        +     {
        +       free(xrev);
        +       return RCS_trunkorigin(rcs); /* find the origin of the trunk
*/
        +     }
        + 
        +     p = findnode (rcs->versions, xrev);
        +     free (xrev);
        +     if (p == NULL)
        +       return (NULL);
        +     vers = (RCSVers *) p->data;
        + 
        +     /* Tentatively use this revision */
        +     cur_rev = vers->version;
        + 
        +     /* If no branches list, return now.  This is what happens if
the branch
        +        is a (magic) branch with no revisions yet.  */
        +     if (vers->branches == NULL)
        +       return xstrdup (cur_rev);
        + 
        +     /* walk the branches list looking for the branch number */
        +     xbranch = xmalloc (strlen (branch) + 1 + 1); /* +1 for the
extra dot */
        +     (void) strcpy (xbranch, branch);
        +     (void) strcat (xbranch, ".");
        +     for (p = vers->branches->list->next; p !=
vers->branches->list; p = p->next)
        +       if (strncmp (p->key, xbranch, strlen (xbranch)) == 0)
        +           break;
        +     free (xbranch);
        +     if (p == vers->branches->list)
        +     {
        +       /* This is what happens if the branch is a (magic) branch
with
        +          no revisions yet.  Similar to the case where
vers->branches ==
        +          NULL, except here there was a another branch off the same
        +          branchpoint.  */
        +       return xstrdup (cur_rev);
        +     }
        + 
        +     /* if we get here, it means that somehow */
        +     /* we didn't find our branch.  I'm not sure _how_ we can get
here... */
        + 
        +     return(NULL);
        + 
        + }
         

        -- steve 



reply via email to

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