问题
I am a bit curious on how the merge info in Subversion is used, and what kind of problems one can run into if the merge info is incorrect?
For example, I have branched branch1
and branch2
from trunk
. I also have a subbranch1
and a subbranch2
originating from branch1
. Consider I've done some development in branch2
, and then reintegrated it back to trunk using svn merge --reintegrate ^/branch2
. I then wanted to add these changes to subbranch1
as well (pulling them from trunk
) and mistakenly used command, svn merge --reintegrate ^/trunk
(thus adding the --reintegrate
flag to the merge command here too, even though subbranch1
is not an immediate ancestor of trunk
).
What problems can this cause in the future?
回答1:
This answer is deprecated. Please use Subversion >= 1.6.
You're branching approach is dangerous in general, but because of the accident it's even worse.
You'll get much problems when reintraging all the branches.
- changes made by branch2 might look like deletions to subversion.
- deletions made by you might look like additions to subversion.
- the three-way-comparsion might give you odd results (putting the same piece of code twice into the file for example)
You cannot trust the three-way-comparsion anymore, you have to check each change manually!
See What mother never told you about svn branching and merging for more information.
P.S. I had to fix something like this once. Since then we use bunny hopping (see link).
回答2:
Merge info keeps track of this information:
- The relations between branches (
subbranch1
originated frombranch1
, which originated fromtrunk
, etc.) - Which revisions have been already merged
If the merge info is missing or incorrect, you would have to track merges manually, and this could be error prone. By using merge info, you just let Subversion keep track of all this information.
来源:https://stackoverflow.com/questions/9835488/subversion-merge-info-how-important-is-it