Reintegrate can only be used if revisions X through Y were previously merged from <URL> to reintegrate the source, but this is not the case

﹥>﹥吖頭↗ 提交于 2019-11-27 16:52:11
Paul Whipp

If you are working on a branch and have been keeping it up to date with others work you might be bemused when you create a working copy of the trunk and attempt to reintegrate your branch if you get a message something like this:

$ svn merge --reintegrate https://server.blah/source/orb/branches/bronze_services
svn: Reintegrate can only be used if revisions 650 through 694 were previously merged from
     https://server.blah/source/orb/trunk to the reintegrate source, but this is not the
     case:
  branches/bronze_services/occl
    Missing ranges: /trunk/occl:650-693

I've seen a number of workarounds on Google but they made me nervous as 'hacks'. To address it I decided to do just what subversion is hinting at in the message. I went back to my branch and explicitly merged the specified revisions:

$ svn merge -r 650:693 https://server.blah/source/orb/trunk
$ svn commit -m 'merged revisions 650:693 from trunk'
    Sending        occl
Committed revision 695.

Once I did this, I was able to return to the working copy of trunk and reintegrate the branch without any problems.

I hope this helps

[[ Although my solution has worked for me in the past, it can lead to improper results with modern SVN clients. In our case the merge errors seemed to be byproducts of automations that were confusing our SVN history and not real activity. I'm leaving this here for posterity but please consider the accepted answer instead. ]]

The solution for me was to remove any svn:mergeinfo properties that somehow get attached to individual files in the hierarchy.

svn merge --reintegrate svn+ssh://svn/usr/local/svn/repos/all/trunk 
svn: Reintegrate can only be used if revisions 18765 through 18921 were
    previously merged from svn+ssh://svn/usr/local/svn/repos/all/trunk to the
    reintegrate source, but this is not the case:
trunk/proj/src/main/java/com/foo/furniture.java
Missing ranges: /trunk/proj/src/main/java/com/foo/furniture.java:18765-18920

To find the files with mergeinfo information you can do:

cd ~/svn/branches/2.7
svn propget -R svn:mergeinfo .

Then you can remove the mergeinfo properties:

svn propdel svn:mergeinfo proj/src/main/java/com/foo/furniture.java ...
svn commit -m 'removed mergeinfo' proj/src/main/java/com/foo/furniture.java ...

After I completed this, my merge executed fine.

Iain Samuel McLean Elder

If you try to reintegrate your branch to trunk and you see errors like this from TortoiseSVN:

Click on the error text and press CTRL + A, CTRL + C to copy all the text.

Paste the text into the here-string of this PowerShell script:

@"
Command: Reintegrate merge http://svn.cloudcorp.com/branches/myproject into C:\Users\iain\Documents\Repositories\CloudCorp\trunk  
Error: Reintegrate can only be used if revisions 18089 through 18612 were previously  
Error:  merged from http://svn.corp.skyscanner.local/svn/SkyScannerDatabase/trunk to  
Error:  the reintegrate source, but this is not the case:  
Error:    
Error:  branches/myproject/userdata/usermanagementservice  
Error:   
Error:     Missing ranges:  
Error:  /trunk/userdata/usermanagementservice:18365,18404  
Error:    
Error:  branches/myproject/userdata/auto_create_db.sql  
Error:   
Error:     Missing ranges:  
Error:  /trunk/userdata/auto_create_db.sql:18406  
Error:   
Error:    
Error:  branches/myproject/userdata/create_audit_tables_triggers_uds.sql  
Error:   
Error:     Missing ranges:  
Error:  /trunk/userdata/create_audit_tables_triggers_uds.sql:18406  
"@ -split "`n" |
? { $_ -match ('Error: +branches') } |
% { $_.Substring($_.IndexOf('userdata')) } |
% { "svn propdel svn:mergeinfo $_" }

The script extracts the relative paths of files with problem mergeinfo and outputs a list of commands to fix each one.

You may have to change the 'userdata' value to suit your repository structure.

Execute the script to output the commands you need to remove the problem mergeinfos.

In this example, the script would produce this output:

svn propdel svn:mergeinfo userdata/usermanagementservice  
svn propdel svn:mergeinfo userdata/auto_create_db.sql  
svn propdel svn:mergeinfo userdata/create_audit_tables_triggers_uds.sql  

At the command prompt you can navigate to the branch base (myproject) and execute the commands to delete the problem mergeinfos.

You should see output like this:

property 'svn:mergeinfo' deleted from 'userdata\usermanagementservice'.
property 'svn:mergeinfo' deleted from 'userdata\auto_create_db.sql'.
property 'svn:mergeinfo' deleted from 'userdata\create_audit_tables_triggers_uds.sql'.

As in Gray's answer, now you should commit the changes to the branch and try to reintegrate again. This time it should work!

Actually I fixed it using the "merge two different branches" option to merge the trunk and the branch into my working copy. Then I committed that to the trunk.

Marvellous

Something that worked for me in tortoise SVN: instead of merging all revisions from branch, choose specific range and manually select all your revisions from the branch.

Just do as SVN is telling you.

  1. Merge the branch from the Reversion that SVN is telling you
  2. Reintegrate from Branch to trunk
dewtell

See also my answer here for my experience with a similar case. I'm not sure if this is the source of your problem, but it does look like Subversion 1.8 has problems with the mergeinfo when two changes cancel each other.

I ran into this issue. I did an SVN log on my branch to find were I had merged trunk to my branch.

I noted all the revisions.

I then did the merge of my branch to trunk by specifying the revisions manually. I specified all ranges to exclude the revisions were I merged trunk. I manage to get my branch merged.

I had to do some reverts on mergeinfo, but I got my code merged.

I immediately deleted my branch.

I got this error after using a partial checkout of a branch. I was keeping the branch up to date with the trunk but the trunk revisions for parts of the branch that were not checked out were of course not being updated. The fix was to do a full checkout of the branch and then merge in all of the trunk changes. After committing these to the branch I could merge the branch to the trunk successfully.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!