Subversion merge info, how important is it?
Asked Answered
R

2

6

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?

Reta answered 23/3, 2012 at 7:27 Comment(0)
G
2

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).

Gameness answered 23/3, 2012 at 7:36 Comment(5)
Re the blog post, I don't think Bunny Hopping is necessary since SVN 1.5, which keeps track of this kind of stuff for you.Overtire
SVN 1.5 fixed some problems, but if you do a lot of merging and branching you'll get into trouble.Gameness
The bunny-hop is not required. It's a workaround for bad SVN practices. Why do people expect merging to be simple if they're going to do LOTS of changes to trunk AND a branch? (Particularly over the same code!)Debose
@exception: No, it's not required and you're right that it's a workaround for wrong usage. But bunny-hopping worked for large teams with members who don't really understand branching. It's just a pragmatic solution. The question contains a good example that there will happen mistakes sometimes, which are difficult to solve afterwards. Hopefully people will use Subversion >= 1.6 finally...Gameness
We have many working branches and use SVN due to company standards. I can confirm based on our team's experience that this approach to branching makes experience with SVN pretty much easier.Boorish
M
3

Merge info keeps track of this information:

  • The relations between branches (subbranch1 originated from branch1, which originated from trunk, 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.

Moses answered 23/3, 2012 at 7:27 Comment(0)
G
2

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).

Gameness answered 23/3, 2012 at 7:36 Comment(5)
Re the blog post, I don't think Bunny Hopping is necessary since SVN 1.5, which keeps track of this kind of stuff for you.Overtire
SVN 1.5 fixed some problems, but if you do a lot of merging and branching you'll get into trouble.Gameness
The bunny-hop is not required. It's a workaround for bad SVN practices. Why do people expect merging to be simple if they're going to do LOTS of changes to trunk AND a branch? (Particularly over the same code!)Debose
@exception: No, it's not required and you're right that it's a workaround for wrong usage. But bunny-hopping worked for large teams with members who don't really understand branching. It's just a pragmatic solution. The question contains a good example that there will happen mistakes sometimes, which are difficult to solve afterwards. Hopefully people will use Subversion >= 1.6 finally...Gameness
We have many working branches and use SVN due to company standards. I can confirm based on our team's experience that this approach to branching makes experience with SVN pretty much easier.Boorish

© 2022 - 2024 — McMap. All rights reserved.