开发者

Why do I get conflicts when Merging a branch to the Trunk and then merging it back to the branch?

开发者 https://www.devze.com 2023-01-02 10:14 出处:网络
Lets say I have a feature branch named \"branches/BigFeature\".I want to push those changes to the Trunk, make som开发者_JAVA技巧e changes to Trunk and merge back it all back into the \"BigFeature\" b

Lets say I have a feature branch named "branches/BigFeature". I want to push those changes to the Trunk, make som开发者_JAVA技巧e changes to Trunk and merge back it all back into the "BigFeature" branch so development can continue.

My steps were to:

  1. Merge the latest changes in Trunk to branches/BigFeature. (Tortoise SVN -> Merge a range of revisions)

  2. Merge the changes in branches/BigFeature to Trunk. (Tortoise SVN -> Reintegrate a branch)

  3. Make some changes to Trunk.

  4. Merge the changes in Trunk to branches/BigFeatures. (Tortoise SVN -> Merge a range of revisions)

The problem arises in step 4. When I merge back to BigFeature I get all kinds of conflicts. It seems to have a problem with files that were originally added in branches/BigFeature but were merged to the Trunk.

The message it gives me is "The last merge operation tried to add the file 'blah' but it was already added locally.

This kinda makes sense because the file was originally added in the branches/BigFeature branch and then merged to Trunk. But why can't the merge operation realize this? Why is it coming up as a conflict?

The same kind of error happens for deleted files.

The last merge operation tried to delete/move/rename the directory 'blah', but it was deleted, moved or renamed locally.

Thanks for you help.


Unfortunately it is a deficiency of svn, the way it is built.

The steps in svn must look like this:

1. (not modified) Merge the latest changes in Trunk to branches/BigFeature. (Tortoise SVN -> Merge a range of revisions)
2. (not modified) Merge the changes in branches/BigFeature to Trunk. (Tortoise SVN -> Reintegrate a branch)

2a. Delete branch branches/BigFeature
2b. Create branch branches/BigFeature from current trunk

3. (not modified) Make some changes to Trunk.
4. (not modified) Merge the changes in Trunk to branches/BigFeatures. (Tortoise SVN -> Merge a range of revisions)

SVN branch is no longer usable after a reintegrate operation.

Update: there is a second way, instead of deleting the branch.

2a. on branch: 
    $ svn update
    Updated to revision X
    $ svn merge --record-only -c X ^/trunk
    $ svn commit -m "Block revision X from being merged into the branch."

I did not know this trick, I learned it thanks to your question :D

0

精彩评论

暂无评论...
验证码 换一张
取 消