info-cvs
[Top][All Lists]
Advanced

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

Re: branches and merging


From: Arno Schuring
Subject: Re: branches and merging
Date: Wed, 11 May 2005 22:59:40 +0200


That was more response than I had even hoped for. This is a good candidate to become a sticky at my desk somewhere :)

Thank you!

Arno


I haven't done much merging myself lately, but I always believed a
branch-to-branch merge needed two states (tags) of the source branch,
and the current state of the target branch. Or is both possible?

If you are to continue doing branch merges in the future, it is usually
desirable to tag the source branch so that you will know where to start
the next time you do a merge to the destination branch (for purposes of
discussion call this tag the 'merge-point').

Some people find it desirable to create a tag on the destination branch
just before doing the merge to facilitate backing out all of the changes
should it be determined that the branch was ill done (for purposes of
discussion call this tag the 'pre-sync-point').

Some people find it desirable to create a tag on the destination branch
just after the merge is complete so that they may be able to compare the
tag on the source branch with the post-merge tag to determine the drift
between the two branches (for purposes of discussion call this tag the
'post-sync-tag').

My question more clearly: why tag the target branch instead of the
source branch? Does it really matter which one you choose?

Typically, when one creates a new (child) branch, one will also create a
branch-point tag (for purposts of discussion call this tag
'branch-point') on the parent branch.

Consider the following work...

It is time to create the child-branch from the parent-branch

cvs checkout -r parent-branch -d parent module
cvs tag child-branch-point
cvs tag -b child-branch
...

It is time to merge the changes of the parent into the child

cvs checkout -r parent-branch -d parent module
cd parent
cvs tag parent-merge-point-1

cvs checkout -r child-branch -d child module
cd child
cvs tag child-pre-sync-point
cvs update -jchild-branch-point -jparent-merge-point-1
...resolve conflicts
cvs commit
cvs tag child-post-sync-point

At some later time, if it is desirable to merge the changes
of the parent into the child again, one does:

cvs checkout -r parent-branch -d parent module
cd parent
cvs tag parent-merge-point-2

cvs checkout -r child-branch -d child module
cd child
cvs tag child-pre-sync-point-2
cvs update -jparent-merge-point-1 -jparent-merge-point-2
...resolve conflicts
cvs commit
cvs tag child-post-sync-point-2

If at this time it is desirable to move all of the changes developed on
the child-branch into the parent-branch, then something like:


cvs checkout -r child-branch -d child module
cd child
cvs tag child-merge-point-1

cvs checkout -r parent-branch -d parent module
cd parent
cvs tag parent-pre-sync-point-1
cvs update -jchild-merge-point-1

...the above command is the same as 'cvs update -jchild-branch-point
.. -jchild-merge-point-1'

...resolve conflicts...
cvs commit
cvs tag parent-pst-sync-point-1

In the general case, the pre-* and post-* tags are not necessary.

I urge you to one of the fine books on cvs (cf,
https://cvsbook.red-bean.com/) to help you understand the subtle points...





reply via email to

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