[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Merge Branch to Trunk - Not Deleting Lines in Trunk
From: |
Jim.Hyslop |
Subject: |
RE: Merge Branch to Trunk - Not Deleting Lines in Trunk |
Date: |
Thu, 24 Jun 2004 11:01:32 -0400 |
work wrote:
> When I merge from the file on the branch to the file on the
> trunk, and the file on the branch has deleted lines, the
> lines are not deleted from the file on the trunk.
>
> I'm in the local sandbox for the trunk and using the cvs
> update -j latest_branch_tag -j latest_trunk_tag and the
> output says that the file already contains the differences,
> but it really doesn't because the lines don't exist in the
> branch, but do in the trunk.
As Todd pointed out, you have your tags reversed. BUT!! Be careful here -
make sure the command is doing what you want. This will not *merge* the
files, this will make the head of the trunk exactly like revision
latest_trunk_tag - which may or may not be what you intended.
'cvs update -jX -jY' means "take the delta from X to Y and apply it to the
working directory." Algebraically, if W is the working directory, and Y-X is
the delta from X to Y:
W = W + Y - X
Since W = X, then W = X + Y - X
which simplifies to W = Y
For a proper merge, you want to use two tags that are from the same branch
in the 'update' command.
Suppose, for example, the branch tree looks something like:
1.1 --- 1.2 --- 1.3
\
\-- 1.1.2.1 --- 1.1.2.2
and you have the tags:
branch_point: 1.1
latest_trunk_tag: 1.3
first_branch_tag: 1.1.2.2
If this is the first merge, you want to specify:
cvs update -A
cvs update -jbranch_point -jfirst_branch_tag
Now suppose you commit two more changes to the branch, and apply another tag
second_branch_tag (this will be revision 1.1.2.4). The next merge would be:
cvs update -jfirst_branch_tag -jsecond_branch_tag
This is where a floating tag, such as [branch name]_last_merge would come in
handy. The command sequence would be:
# prepare to branch
cvs tag thebranch_base
cvs tag -b thebranch
cvs tag thebranch_last_merge
# branch!
cvs update -r thebranch
[modify modify modify commit modify some more commit etc.]
#prepare to merge
cvs tag thebranch_merge_head
cvs update -A
#merge!
cvs up -jthebranch_last_merge -jthebranch_merge_head
cvs tag -F -rthebranch_merge_head thebranch_last_merge
[fix up any conflicts and commit]
("What's with all this prepare s**t? Just do it!" -- Spaceballs)
--
Jim Hyslop
Senior Software Designer
Leitch Technology International Inc. (http://www.leitch.com)
Columnist, C/C++ Users Journal (http://www.cuj.com/experts)