SVN merge between two branches - "path not found"

14,449

Solution 1

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

Solution 2

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.

Solution 3

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.

Share:
14,449
mingxiao feng
Author by

mingxiao feng

Updated on June 27, 2022

Comments

  • mingxiao feng
    mingxiao feng almost 2 years

    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?

  • mingxiao feng
    mingxiao feng over 11 years
    Thanks but that doesn't work. You can't use --reintegrate and --ignore-ancestry at the same time and a merge without --reintegrate just creates a ton of conflicts because both branches have the same trunk
  • Francozen
    Francozen almost 6 years
    I like this solution, it got me out of trouble. To make that a bit more automatic, one could use: ` for i in $(svn log --stop-on-copy site/svn/branch -q | grep -v '\-\-' | awk '{ print $1 ;}' | perl -e 'print reverse <>' | sed -e 's/r//g' ); do svn merge -c $i site/svn/branch --accept postpone; done `
  • Tim Meyer
    Tim Meyer almost 6 years
    Note for TortoiseSVN users: You can open the log on the source branch (beaver/duck), select the revisions you want to merge and copy the revision numbers to the clip board using the context menu. That way you don't have to manually extract the numbers somewhere
  • Florian Winter
    Florian Winter over 5 years
    svn log --stop-on-copy will not give you all revisions if the branch has been copied (or branched) again after branching from trunk. In this case, you have no other option than to compare logs. See stackoverflow.com/a/51933172/2279059