Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What am I doing wrong with SVN merging?

When SVN with merge tracking works, it's really nice, I love it. But it keeps getting twisted up. We are using TortoiseSVN. We continuously get the following message:

Error: Reintegrate can only be used if revisions 1234 through 2345 were previously merged from /Trunk to the reintegrate source, but this is not the case

For reference, this is the method we are using:

  1. Create a Branch
  2. Develop in the branch
  3. Occasionally Merge a range of revisions from the Trunk to the Branch
  4. When branch is stable, Reintegrate a branch from the branch to the trunk
  5. Delete the branch

I Merge a range of revisions from the trunk to the branch (leaving the range blank, so it should be all revisions) just prior to the reintegrate operation, so the branch should be properly synced with the trunk.

Right now, the Trunk has multiple SVN merge tracking properties associated with it. Should it? Or should a Reintegrate not add any merge tracking info?

Is there something wrong with our process? This is making SVN unusable - 1 out of every 3 reintegrates forces me to dive in and hack at the merge tracking info.

like image 295
RandomUsername Avatar asked May 12 '10 15:05

RandomUsername


1 Answers

This problem sometimes happens when a parial merge has been done from trunk to branch in the past. A partial merge is when you perform a merge on the whole tree but only commit part of it. This will give you files in your tree that have mergeinfo data that is out of sync with the rest of the tree.

The --reintegrate error message above should list the files that svn is having a problem with (at least it does in svn 1.6).

You can either:

  1. Merge the problem files manually from trunk to branch, using the range from the error message. Note: you must subtract 1 from the start of the range, so the command you'd run would be:

    cd <directory of problem file in branch working copy>
    svn merge -r1233:2345 <url of file in trunk>
    svn commit
    

    or

  2. If you're certain that the contents of the files in your branch are correct and you just want to mark the files as merged, you could use the --record-only flag to svn merge:

    cd <directory of problem file in branch working copy>
    svn merge --record-only -r1233:2345 <url of file in trunk>
    svn commit
    

(I think you can use --record-only on the entire tree, but I haven't tried it and you'd have to be absolutely sure that there are no real merges that need to come from trunk)

like image 113
Gruff Avatar answered Oct 20 '22 05:10

Gruff