views:

81

answers:

2

I have just done something without thinking it through. I have made a branch from working directory containing local modifications using TortoisSVN. I am assuming it did a copy and switch in one shot. Now the first version of my new branch is different from any version of the trunk. The question is, how do I reintegrate this branch back into the trunk? If I use the delta between the first and the last versions of the branch, that changeset will not contain the initial modifications that I had in my working directory.

If I had made a branch from the latest version of the trunk, and then committed my local changes, this would not have been a problem, because the first version of the branch would have been identical to the corresponding version of the trunk.

A: 

I suppose I can find the version of the trunk, just before I made the branch and use that as the starting point of the changeset. Seems awkward though. Is there a more elegant solution?

Edit: yes there is a more elegant solution. I was wrong. A branch, even a branch created from the working directory retains all the history of the trunk prior to the split. I am using TortoisSVN, so all I had to do was uncheck "Stop on copy/rename" in the log window to see the versions prior to the split. Then I simply used the version immediately before the creation of the branch as the start of my change set. There was no problem after all.

Dima
More elegant would be not to commit changes and create branch at the same step. Since you done that I guess there is little you can do to improve this process.
RaYell
A: 

This should help you.

I'm calling your new branch invalid to shorten things up a bit.

  1. Make a diff between invalid branch and trunk (use the revision just before creating new invalid branch - let's call this one invalid) - that will give you changes from your working copy that you commited when creating invalid branch and are not part of a trunk.
  2. Apply those changes to trunk.
  3. Reintegrate your invalid branch with trunk (initial changes are already there - step 2)
RaYell
In this case, why do I need two merges? Merging in the delta between the trunk version just before the branch was created and the HEAD of the invalid branch would produce the same result.
Dima