Subversion/Merging with TortoiseSVN

From ReactOS Wiki
Jump to: navigation, search

Sometimes you might be working on a branch. After some time you might want to sync your changes into trunk. Or as code gets committed to trunk your branch slowly gets out of sync and to prevent working on too old code, you might want to sync trunk commits into your branch. In this tutorial we sync the trunk changes into a branch, but the other direction is the same.


Before you start to sync, you need a clean (without local changes) checkout of the destination branch, in this case ros-amd64-bringup. Update it to the head revision.

Getting the revision range

You need to know the revision range that you want to merge. The range typically starts with the first revision since the last merge was performed. Note that when using the command line client, the starting revision is the same as the last revision that was merged into the branch / into trunk. For example, if you are merging revisions in chunks, the method shown in the subversion book will have you merge 100-200 this time and 200-300 next time. With TortoiseSVN you would merge 100-200 this time and 201-300 next time.

This should be noted in the commit log of the last sync. In this example it is 36700. If no sync has been done yet, choose the branching revision. The ending revision would normally be the head revision of the source branch/trunk. In this example we choose revision 36800.

TortoiseSVN SVN-Merge ShowLog.png

TortoiseSVN SVN-Merge LogMsgSync.png

Open the merge dialog

Right click on the destination branch in explorer, select "TortoiseSVN", then "Merge...".

TortoiseSVN SVN-Merge MergeMenu.png

Select merge type

Normally you will use the "Merge a range of revisions". Select this and click "Next".

TortoiseSVN SVN-Merge MergeDialog1.png

Select source branch and revision range

In this example we want to sync from trunk into the branch, so in the "URL to merge from" field we select trunk, or more exactly the reactos subfolder of trunk, because in this case the local copy is the reactos subfolder of the ros-amd64-bringup branch and we don't care for the other subfolders.

TortoiseSVN SVN-Merge MergeRev.png

If it's not already selected in the "from" field, click on the "..." right to the text field and select it from the repository.

TortoiseSVN SVN-Merge SelectBranch.png

We have already found the revision range above, so just enter it into the Revision field. Remember that when using Tortoise SVN, the revision range begins with the last revision that has not been merged. It normally ends with the head revision, but in this case we choose a lower revision (36800) first. Then click on "Next"

Merge Options

In this last dialog, choose the "merge depth", that is what parts of your local copy are to be changed. Normally you would want to apply the changes to the full "working copy", so choose this. You should select "Compare whitespaces", unless you want to ignore these changes (not recommended).

TortoiseSVN SVN-Merge MergeDialog.png

Optional test run

If you want to avoid problems, first click on "Test merge". This will emulate the merging process and show you the result log, but it won't change your local copy. When it's done, you will see the result log. If you get lots of errors and almost no real merge, then you have probably chosen the wrong source folder or starting revision. In this case correct your settings and try again. A few conflicts are normal and will have to be resolved by hand later.

TortoiseSVN SVN-Merge DryRunResults.png

Do the merge

If the test run was successful, do the real merge, by clicking on "merge". Now the selected revision range will be merged into your local copy.

Resolve Conflicts


Commit changes

See Subversion/Using TortoiseSVN