Subversion branch reintegration in v1.6 [duplicate

2019-01-12 20:20发布

问题:

This question already has an answer here:

  • Subversion branch reintegration 10 answers

Per this old question, using SVN 1.5, reintegrating a branch multiple times is problematic, and should be avoided.

There has been some rumbling to the effect that, "This is a known issue, and should be fixed in SVN 1.6." Was that the case? Is it fixed? Can I reintegrate multiple times?

回答1:

To merge a branch topic into the trunk repeatedly: Do the following on every merge.

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

Step 2 essentially tells the topic branch to consider the merge commit (revision M, from step 1) part of its history. This merge-revision is the one that usually causes problems during reintegration; svn tries to undo rM when integrating topic a second time.

So, repeated reintegration works, just not automatically. :)

I eventually found this solution through an enlightening commit message to the svn source and the matching test (search for "def multiple_reintegrates"). This is a "clever trick" discovered and used by svn-devs with the current releases. It's even been added to more recent documentation. The result is still not as good as a DVCS's merging properties, but it's at least functional.

The only broad downside (as per an open issue as of June 2, 2010) is that apparently the svn log -g output is messy. I guess this is the risk.



回答2:

While 1.6 did indeed fix issues with merge tracking, I don't think you can re-use an integrated branch.

But this is not an issue. Since the branch got fully integrated into the trunk, just delete it and create a new branch (with the same name) in its place.



回答3:

Yes, you can. The problem you ask about was solved in Subversion 1.8.

Beginning with SVN 1.8, --reintegrate option is deprecated and reintegrate merges are now performed automatically (or automagically :) ). See Subversion 1.8 Release Notes and read updated SVNBook 1.8 | Reintegrating a branch chapter:

If you choose not to delete your branch after reintegrating it to the trunk you may continue to perform sync merges from the trunk and then reintegrate the branch again. If you do this, only the changes made on your branch after the first reintegrate are merged to the trunk.

...

Only Subversion 1.8 supports this reuse of a feature branch. Earlier versions require some special handling before a feature branch can be reintegrated more than once. See the earlier version of this chapter for more information: http://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicmerging.html#svn.branchemerge.basicmerging.reintegrate

IMPORTANT: You should upgrade your Subversion client and server if you still use Subversion 1.7 or older. The current and best version of SVN is 1.9 as of year 2016. There is no real reason to be using very old Subversion releases such as 1.5, 1.6 or even 1.7. There were numerous improvements on client and server side since version 1.6!



标签: svn merge branch