svn branch merge tree conflict issue (using tortoise)

本文详细介绍了在使用SVN进行分支合并时遇到的冲突问题,并提供了通过记录合并修订来解决冲突的方法。同时,解释了如何在多次合并操作中避免重复合并导致的文件冲突。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://stackoverflow.com/questions/16367990/svn-branch-merge-tree-conflict-issue-using-tortoise

I have read a lot and lot on this but couldn't figure out what theissue is, and it's pretty weird. I am using version 1.7 for serverand latest tortoise version (1.7) for the client. Here's thescenario:

  1. I created a parent branch, and then created 1 child branch from it.So, PARENT_BRANCH -> CHILD_BRANCH
  2. Add a new directory in CHILD_BRANCH and commit.
  3. Using tortoise merge all changes from CHILD_BRANCH toPARENT_BRANCH. I used 'merge a range of revisions' option anddidn't specify any revisions in the option, so basically let svnidentify and manage the revisions to merge.
  4. After the merge, the new directory is created inPARENT_BRANCH.
  5. Merge back from PARENT_BRANCH -> CHILD_BRANCH.
  6. I get tree conflict on the new directory, with the error that thedirectory its trying to add is already there.

Well, of course the directory is there in child branch as that'swhere it originally came from. I though that svn 1.5+ tracks mergesusing merge-info, and should have known this is the branch fromwhere the directory came and should not throw the tree mergeerror.

Any idea what's going on and how can I fix this? The example I gaveis just for 1 directory, but in reality there are lots ofdirectories and files, so going one by one manually takeshours.



Answer:

The problem is that both CHILD and PARENT have different revisionswhich added the same folder. CHILD doesn't have any knowledge ofthe revision in your step 4.

Immediately after every merge from CHILD to PARENT (your step 4.)you need to record against CHILD that it has the revision of themerge from CHILD to PARENT. You do this by merging that revision inPARENT to CHILD and checking this flag in tortoisesvn:

enter image description here

Have a read of this post on subversionbranch reintegration.

Thanks forthe response. So if I understand it correctly, if let's say whilemerging from CHILD->PARENT, svn identifies r100-r200 will betaken and merged from CHILD. Post merge, when I commit, lets say itwas revision r201. So, now I have to tell CHILD to record r201 as"record only" so that when I merge back from PARENT->CHILD, thisparticular revision will be ignored and I should not get any treeconflicts arising because of CHILD->PARENT->CHILD merge. It'sreally strange, since svn should know that already as to whichbranch originated the create directory command in the firstplace.


注:1、实际情况:从branchmerge到trunk,一切正常。然后ranch改了点东西,再merge到trunk,很多文件都报treeconflict了。

2、Tomerge a branch topic intothe trunk repeatedly:Do the following onevery merge.

  1. svn merge --reintegrate , as you would normally.(=>rM)
  2. svn merge --record-only -c M ^/Notethe record-only option.

Step 2 essentially tells the topic branch to consider the mergecommit (revision M,from step 1) part of its history. This merge-revision is the onethat usually causes problems during reintegration; svn tries toundo rM whenintegrating topic asecond time.

So, repeated reintegration works, justnot automatically. :)

I eventually found this solution throughan enlighteningcommit message to the svn source and thematching test (searchfor "def multiple_reintegrates"). This is a "clever trick"discovered and used by svn-devs with the current releases. It'seven been added to morerecent documentation. The result is still not as good as aDVCS's merging properties, but it's at least functional.

The only broad downside (as per an openissue as of June 2, 2010) is that apparentlythe svnlog -goutput is messy. I guess this is the risk.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值