Reintegrate a branch vs merge a range of revision
Asked Answered
B

3

33

In subversion I made a branch now I want to merge it back into trunk. Which option should I use?

Reintegrate a branch

or

merge a range of revision

I was using Merge a range of revisions, but I was getting all sorts of tree conflict errors. Any idea what the difference is between these two?

Banditry answered 18/11, 2009 at 18:58 Comment(1)
possible duplicate of SVN Merge a range of revisions vs. reintegrateTreachery
C
37

When working with a branch, you should periodically merge ranges of revisions from the trunk into the branch to keep the branch in sync. if you don't pass any version numbers to svn merge and your svn server version is 1.5 or newer, it will track the merges you've previously done and automatically merge only newer revisions.

When the branch is finished, you should merge changes into it one last time, then reintegrate it back into the trunk.

Curnin answered 18/11, 2009 at 19:17 Comment(0)
K
6

Here are the steps I usually follow for merges.

1.

svn log -v --stop-on-copy http://mysvnrepo/mybranch

This will give you the repo revision when you first created the branch. Say it is AAAA.

2.

svn log -v -rAAAA:HEAD http://myrepo/trunk

This will give you the changes made in the trunk after you took out the branch. This is not essential but I use this to get an idea of what I should expect to merge presently.

3.

In case step2. reported trunk changes, go to the branch workspace and run

svn merge --dry-run -rAAAA:HEAD http://myrepo/trunk .

This will report all the changes made in trunk ever since you branched into mybranch - look through and re-run the command without the --dry-run option to perform the actual merge.

4.

Commit the branch workspace post-merge with a relevant comment. (for eg., "Merged changes from the trunk version AAAA through XXXX" - where XXXX is the current HEAD version)This brings up the HEAD to say version YYYY.

5.

Next in the trunk workspace, type

svn merge --dry-run -rAAAA:HEAD http://myrepo/branch .

This should report on the changes made in the branch after it was created up until now. Look through the report to verify what is getting merged/conflicted, etc., and then run the command without the --dry-run option, to actually perform the merge.

6.

Resolve conflicts if any by hand, run svn resolved to tell the repo that your conflicts are all now resolved, and then perform the commit with a relevant message, for example "Merging from mybranch to trunk - changes included from revision AAAA through YYYY". This helps the next time you run a log and then you can simply do the next merge from YYYY to the HEAD at that point.

Karmen answered 19/11, 2009 at 3:26 Comment(0)
D
4

Tortoise SVN Merge vs Reintegrate explanation:

TortoiseSVN Documentation

Demount answered 18/11, 2009 at 19:7 Comment(4)
zachary never mentioned using Tortoise, so I wouldn't necessarily consider this "straight from the source".Curnin
I'll edit my post; but you're being a bit pedantic, aren't you? Tortoise is a SVN client. How would Merge vs. Reintegrate differ if I was using SVN command line, Tortoise, SVNCOM, or WebSVN?Demount
I'll be brutally honest: Tortoise's Merge a range of revisions option is a lot stupider than the svn command-line client's merge, because of the behavior that happens when you leave the revision list blank.Curnin
Recent changes to TortoiseSVN (namely, the removal of the "Reintegrate" option) resulted in changes to the document you linked to, so that it no longer discusses the difference between Merge & Reintegrate. Here is a link to the document as it existed when this answer was originally posted.Harv

© 2022 - 2024 — McMap. All rights reserved.