Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use the new SVN merge-tracking?

In my existing (Pre-SVN 1.5) merge strategy, we create a copy of the Trunk (called BasePoint) at the moment of branch-creation for referencing later during the merge.

When we need to merge a branch back into the trunk, we perform 2 operations.

  1. Merge from BasePoint to LatestTrunk (Trunk has likely moved on since the original branch) into Working copy of Branch and then commit.

    At this point we typically check that the merge into the branch has not damaged anything

  2. Merge from LatestTrunk to LatestBranch back into Working copy of trunk and then commit.

Documentation suggests that I use the new reintegrate merge on the Trunk and Merge from the Branch.

Do I need to merge from the trunk into the dev branch first or is this included in the new reintegrate option?

To put it another way, does the new merge --reintegrate functionality represent 'each of my previous merges' or 'the whole operation' ?

(FWIW I am using TortoiseSVN 1.5.1)

like image 890
Rory Becker Avatar asked Oct 06 '08 11:10

Rory Becker


People also ask

What is merge tracking?

Merge tracking is a facility offered by some version control systems. It is the ability of a version control system to "remember" which changes have been merged from one line (branch) of development to another and act accordingly.

What is a sync merge SVN?

Sync merge is used when you want to fetch all of the latest changes made on your parent branch (e.g. trunk). Using this will keep your feature branch up-to-date with the parent branch.


Video Answer


2 Answers

The short answer is, You still have to do both steps.

The SVN book explains the process for merging as:

  1. svn merge http://trunk/path while in a branch working copy
  2. svn merge --reintegrate http://branch/path while in a trunk working copy

Notice the lack of revision numbers. This probably doesn't feel like a huge win. The new coolness is the ability to re-run the merge as you are coding in your branch, allowing you to keep the branch up to date with changes in trunk (without recording revision numbers by hand!). SVN keeps track of what needs to be merged in from trunk and what changes are unique to the branch. When you are done with the branch, --reintegrate uses that data to automatically merge only the branch changes back to trunk.

like image 125
Nate Green Avatar answered Sep 19 '22 12:09

Nate Green


I believe reintegrate does not actually do the two operations, but instead is used to merge back into trunk from an updated branch. You will still need to do the first set of merge/commit operations to update the branch first.

Here is a link to the Subversion Book. It is possible to get this book in dead tree format.

From the link, it sounds like using --reintegrate handles some weird cases, probably like merge usually does compared to just using straight patches (read the section "Why Not Use Patches Instead?").

like image 39
Phillip Whelan Avatar answered Sep 23 '22 12:09

Phillip Whelan