Doesn't reintegrating a branch with TortoiseSVN require synchronising branch and trunk first?

1k views Asked by At

I thought I understood how to use the TortoiseSVN merge options. I thought that if you hadn't updated from trunk since the branch was created you could use merge a range of revisions, but if you had updated branch from trunk at some point then you had to synchronise branch and trunk then use either reintegrate a branch (or merge two different trees).

I also thought the corollary was that if you hadn't updated branch from trunk and you tried to use reintegrate a branch then you would lose changes to trunk since the branch was created - that is, if you didn't want to synchronise the two then you had to use merge a range of revisions.

However a colleague of mine says he uses reintegrate a branch in all cirstumstances without losing anything. So I've run a few tests, and I have to agree that you don't appear to lose changes to trunk committed after the creation of the branch when you merge using TortoiseSVN 'reintegrate a branch' from the branch to the working copy of trunk, even if you haven't merged the trunk revisions into your branch first. Is this right? What is the explanation for the advice in the manual then?

1

There are 1 answers

0
Steve Goykovich On

In the TortoiseSVN documentation, in the part about the "Reintegrate a branch" merge option, it says:

All trunk changes have been ported to the feature branch, week by week, and now the feature is complete you want to merge it back into the trunk. Because you have kept the feature branch synchronized with the trunk, the latest versions of branch and trunk will be absolutely identical except for your branch changes

I believe this is the part that is causing the confusion (it confused me for a while too), but then it says:

It uses the merge-tracking features of Subversion to calculate the correct revision ranges to use, and perform additional checks which ensure that the branch has been fully updated with trunk changes. This ensures that you don't accidentally undo work that others have committed to trunk since you last synchronized changes.

Based on this second snippet from the document, and my own experience, I believe it is safe to use the "reintegrate a branch" merge option. We use this method for reintegrating our branches, and our branches are very rarely updated with trunk changes (only if a fix in the trunk fixes a blocking issue in the branch).

For updating our branches with trunk changes, we always use "merge a range of revisions".