info-cvs
[Top][All Lists]
Advanced

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

RE: Merge question


From: Jim.Hyslop
Subject: RE: Merge question
Date: Wed, 26 Jan 2005 12:17:32 -0500

Chris Fouts wrote:
> When merging 2 branches, say HEAD to branchB, where
> branchB contains files NOT YET in HEAD, the branchA
> files get "deleted." Any way to prevent this?
> 
>       > cvs up <options???> -j branchA -j HEAD proj
This tells CVS "Take the difference between the tip of branchA and the tip
of the trunk, and apply them to the current directory." That is most likely
*not* what you want - this will make the current directory identical to the
trunk (which is why your files keep disappearing ;-)

> IOW, what options do I need?
You have all the options you need, you just need to get the right ones and
in the right order.

I'm not clear on exactly what you're trying to do - don't think of this as
"merging two branches", but rather as "merging the changes from one branch
into another." So, with that in mind, I will assume you meant "merging the
changes from the HEAD into the branch". The command is simply:

cvs update -j HEAD

Note that if you plan to do more than one merge, then you really need to
apply a tag at the last merge point:

cvs update -j HEAD
cvs tag -r HEAD last-head-merge

Then, the next time you update, you use that tag and HEAD:

cvs update -j last-head-merge -j HEAD
cvs tag -F -r HEAD last-head-merge

Now, you may have noticed a small race condition: if someone checks
something into HEAD between the 'update' and the 'tag' commands, then the
version you merged will *not* be the version you just tagged. To avoid that
problem, use a temporary tag; the complete sequence, each time you merge, is
now:

cvs tag -rHEAD tmp-tag-head-merge
cvs up -j last-head-merge -j tmp-tag-head-merge
cvs tag -F -r tmp-tag-head-merge last-head-merge
cvs tag -d tmp-tag-head-merge

Note: prior to the first merge, you'll have to apply the tag last-head-merge
to the branch point.

Merging from the branch to the trunk is handled similarly - just change all
occurrences of 'head' or 'HEAD' to the branch tag.

-- 
Jim Hyslop
Senior Software Designer
Leitch Technology International Inc. ( http://www.leitch.com )
Columnist, C/C++ Users Journal ( http://www.cuj.com/experts )




reply via email to

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