[Top][All Lists]

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

Re: Merging from one branch to another

From: Eric Siegerman
Subject: Re: Merging from one branch to another
Date: Fri, 20 Apr 2001 14:38:56 -0400
User-agent: Mutt/1.2.5i

On Fri, Apr 20, 2001 at 02:48:58AM -0400, Chris Sherman wrote:
> I'm getting a very
> weird merge error,

I don't know where this is coming from, but I see another
possible problem.

Most of what you're doing seems fine to me, except for this bit:

> # merge in the changes on Branch_2
> cvs update -j Branch_2_last_merge_w_Branch_1 -j Branch_2
> # and if I don't get conflicts, which to Branch_2 and mark
> cvs update -r Branch_2
> cvs tag -F Branch_2_last_merge_w_Branch_1 

There's a race condition here.  If someone commits a revision to
Branch_2 between the "cvs update -j" and the "cvs tag", it'll get
"lost" -- it'll be there in the repo as it should be, but will
never be merged into Branch_1.

Better might be something like this.  (I've captilized my new tag
name because it's otherwise too similar to yours, which would
make the example harder to follow; I'm NOT suggesting you do the
same :-)
        cvs update -r Branch_2
        cvs tag -F BRANCH_2_NEXT_MERGE_W_BRANCH_1 
        cvs update -r Branch_1
        cvs update -j Branch_2_last_merge_w_Branch_1 -j 

        # then, if everything's cool...
        cvs update -r Branch_2
        cvs tag -F -r BRANCH_2_NEXT_MERGE_W_BRANCH_1 
The last "tag" command says, "apply tag Branch_2_last_merge_w_Branch_1
to whichever revision already has tag BRANCH_2_NEXT_MERGE_W_BRANCH_1".

Of course you can save a bunch of slow "cvs update -r"s by
keeping two sandboxes, one permanently on each branch.

I'm a bit leery of floating tags in general, mostly because
moving one throws away data that may occasionally prove useful
(say some hard-to-isolate bug creeps in, and you really *really*
want to get back the code base as of three merges ago to help
track it down).  In a situation like yours, I'd probably just
keep adding tags, not moving them, like this (the last merge was
on Apr 18; we're doing this one on the 20th):
        cvs update -r Branch_2
        cvs tag -F Branch_2_merge_w_Branch_1-20010420
        cvs update -r Branch_1
        cvs update -j Branch_2_merge_w_Branch_1-20010418 -j 

        # then, if everything's cool...
        # well, not worry about it; there's nothing more to do.

(Add a letter suffix if you do more than one merge a day: 20010420a.)


|  | /\
|-_|/  >   Eric Siegerman, Toronto, Ont.        address@hidden
|  |  /
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea.
        - RFC 1925 (quoting an unnamed source)

reply via email to

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