Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN merge between two branches - "path not found"

I've got two branches (children of trunk) that need to be merged into one branch for testing, but they can't go into trunk. Both branches are up-to-date with trunk@HEAD. So I want to go from this:

__________________trunk
  \___duck   \
              \___beaver

to this:

__________________________trunk
  \
   \______________platypus

I created the branch platypus from the latest version of trunk, and am trying to merge duck and beaver into this new copy of trunk:

svn copy ^/trunk ^/branches/platypus;
svn switch ^/branches/platypus;
svn merge --reintegrate ^/branches/duck;
svn merge --reintegrate ^/branches/beaver;

but the merge ops fail

svn: '/blah/!svn/bc/12047/repo/branches/duck' path not found

If I try to --reintegrate duck (or beaver) into trunk it works fine. What am I missing here?

like image 949
Mathew Avatar asked Oct 03 '12 05:10

Mathew


People also ask

How do I merge two svn branches in eclipse?

Merging means creating a version by blending different revisions of resources. To start merging click 'Team>Merge...' menu item of the resource pop-up menu, 'Merge...' menu item of the SVN main menu group or on the 'Merge...' button on the 'SVN Toolbar'.

Does svn merge delete the branch?

If you merge a branch into trunk using "svn merge --reintegrate", you are recommended to delete the branch. If you want to do further development in that branch, you should "re-branch", effectively create a new branch with the same name, but rooted at the same revision as you merged the branch into trunk.


3 Answers

I had the same error and was able to solve it by manually specifying all of the revision numbers I wanted to merge rather than letting SVN decide. This allowed the merge to continue and prompted me for merge conflicts, as expected.

I was using TortoiseSVN to pick the revisions by hand but I presume using the SVN command line it would be something like:

svn log --stop-on-copy https://svn.blah/svn/proj1/branches/xyz

Then note down all the revision numbers and merge them all in one go, e.g.:

svn merge -c123,124,156,159 https://svn.blah/svn/proj1/branches/xyz
like image 135
wardies Avatar answered Sep 30 '22 10:09

wardies


I had a similar problem reintegrating a branch which had been merged from another branch (itself now reintegrated). Like this:

-----------------------------r7------------------
  \                         /             /ERROR !svn/bc/4/repo/branches/duck' path not found
   r1----dinosaur--r5-------             /
                    \---duck------------r9

It doesn't seem to be possible to reintegrate duck, the path not found error complained about r4 - but i could merge specific revisions (r5-r9) from duck back to trunk.

like image 25
andrew lorien Avatar answered Sep 30 '22 12:09

andrew lorien


This happens because SVN doesn't know which revisions to merge, probably because merge information is missing or corrupted.

Find the common ancestor (common commit with highest revision X) between both branches by comparing the logs:

svn log duck > dlog.txt
svn log beaver > blog.txt

Merge all changes from that revision X to the current head:

svn switch duck    # if you are not already on it
svn merge -r X:HEAD beaver
# Merge conflicts
svn commit

NOTE: The accepted answer suggests using --stop-on-copy to find the common ancestor. While this may sometimes find the correct revision (e.g., where the branches duck and beaver were branched from trunk, it doesn't give you a common ancestor if there have been any svn copy operations in any of the branches AFTER they were created. If you know this never happened, then you can use --stop-on-copy.

like image 33
Florian Winter Avatar answered Sep 30 '22 11:09

Florian Winter