Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
216 views
in Technique[技术] by (71.8m points)

SVN - unable to merge branch back into trunk - numerous tree-conflicts

I have what I thought was a simple scenario - using TortoiseSVN:

1) I made a branch (B2) of an application (to work on implementing image sprites & JAWR).

2) Testing & development went on as normal on the trunk.

3) I re-based the branch a couple of times over the last few days by:

3.1) Merged trunk (by range of revisions) to my branch-b2 working copy, resolving conflicts during the merge.

3.2) (after testing branch-b2), I commit the re-based branch-b2.

This all worked as I expected. But merging the branch back into the trunk is having its way with me:

4) After all updates committed in branch-b2; I make sure I do an SVN Update on trunk and branch-b2.

5) Then, I try to merge (range of revisions) from branch-b2 into the trunk. However, for any new file that had been added to the trunk, and subsequently added to branch-b2 when I rebased it, I get a tree-conflict. I'm not sure what the proper way is to resolve these conflicts.

The most typical advice I've seen is to either delete the tree-conflict files from the trunk, then merge the branch over; or delete the entire trunk, copy the branch files over, and then commit them as a new version in the trunk. Neither of those options seems like a good idea- first one is a pain, and both seem like they would lose file revision histories.

What'd I do wrong, and how do I fix it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sounds like you're using the pre-1.5 merge style and trying to reintegrate the branch into trunk. In that case, what you want to do is first ensure all the trunk changes have been merged in to the branch, and then instead of range-merging the branch to a working copy that points to the trunk, you want to merge "FROM trunk@HEAD TO branch@HEAD" with the working copy pointing to trunk. In essence:

"Give me all the changes I'd need to make trunk identical to branch".

This works if you've already merged all the trunk changes to the branch, because then the only difference between trunk and branch are the changes made in the branch.

Make sense? :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...