How to merge cherry revisions between feature branches and trunk

I have two feature branches derived from the mainline, including a big refactoring of the code in different Feature-A and Feature-B modules. Both are synchronized with the trunk; the connecting line must be stable.

Halfway through Feature-B, I realize that a change to the shared library recently implemented in Feature-A would greatly benefit Feature-B. I don't want to push this change into the torso yet, and I cannot fully merge the branches because the rest of the code in Feature-A is unstable.

So, do a merge between branches, cherry changes from A to B to merge this functionality:

svn merge -r 1786: 1795 ^ / proj / branches / Feature-A.

I can't figure out if I will succeed later when I merge the branches again. I expect Feature-B to be completed much earlier than Feature-A. At this point, our normal procedure was to re-integrate function-B in the torso and then combine the trunk into function-A to synchronize them. It's hard for me to figure out in advance if this would cause a conflict after seeing that A was merged with B and now those changes are merged back again, but in a workaround through the torso.

In the book

svn mentions that an additional merge with -record-only after re-integrating the branch into the trunk if I want to work with the branch again. I suspect I might need something like this in this situation, but I can't seem to work it out if needed.

+3


source to share


2 answers


I personally don't use --reintegrate

with long feature branches.

In your case, you can merge Feature-B branch back to normal channel, and then, before merging Feature-B back into trunk, execute --record-only

to the problematic version:

Suppose the command is:

svn merge -r 1786:1795 ^/proj/branches/Feature-A .

      

created version 2000 (under Feature-B).



Then, before changing Feature-B to torso, you must:

svn merge -c2000 --record-only ^/proj/branches/Feature-B .

      

The last step is to completely merge the Feature-B branch into trunk:

svn merge -r <begin>:<end> ^/proj/branches/Feature-B .

      

0


source


This will really cause problems.

If the changes you merge from A to B include additional files, then when you reintegrate B, those files will be added to the backbone. But if you try to merge from trunk to A (which you will need to do before reintegrating A), then the merge will try to re-add those files to A that already exist in A, causing a tree conflict.



An A-record merge is used to block re-merging of specific versions in order to preserve the feature branch after reintegration. So if you reintegrate B into trunk, creating revision 100, then you are reintegrating a 100 write-only relay to B, that means when you do a merge sync to B from trunk (svn merge ^ / Project1 / trunk), version 100 will be skipped and not returned back to B. This avoids a potential conflict and allows you to continue using the feature and re-sync with the trunk after reintegration.

Unfortunately, I don't think the -record-only merge can help you avoid conflict in your situation, because merge reintegration does not consider the individual changes in the branch that need to be merged, it just makes a difference between the current state of the branch and the trunk and applies this is to the working copy of the connecting line.

0


source







All Articles