Tag Archives: svn merge

Versions and svn merge

We had a project that included extern links to many subprojects. (They were subprojects because we use them across several projects.) The subjects had a iPhone 3.0 branch created for them, and developed against the new SDK. Out of laziness, we redirected the extern links to the 3.0 branch when it was desired.

In reality, we should have created a 2.x branch, and forced existing apps to change what they were looking at or use the new 3.0 code. But we didn’t.

Now, it was time to merge the 3.0 branch back into the trunk of our development. Version provides a realy nice GUI to most of your day-to-day svn needs. But a major merge is not an everyday need, and needs some human interaction. (Though I do think they could supply a “merge repository branch X into workarea branch Y, and let me handle it from there”.)

The first thing to do is change the external settings to where you want them to be pointing when you’re done, trunk in our case.  You can do this from Versions in the externals part of the inspector.  Then re synchronize the project.  At this point it likely won’t build.  We need to move the code from the branch repository into our trunk work area.

One trick before merging is determining at what point the branch split from the trunk or was last copied from the trunk.  I have a work area with the entire subproject branching structure sync’ed to it and you can select each of the two and show their history, and compare the commits.  The last common commit is what you are interested in.  Mine was 158.

so, you’ve changed directory to the trunk work area, the money command is:

svn merge -r 158:HEAD <branch-workarea-path> --username <remoteuserid>

it will ask your password more than once, keep giving it,

it may ask you a merge question, i always postpone, it provides standard in-file diffs you need to handle,

Select: (p) postpone, (df) diff-full, (e) edit,
(h) help for more options: p

After handling the diffs, check it in.