views:

71

answers:

1

This post might be a bit long, but if you think you can help, please read it because it would in literal terms be a lifesaver.

Here's the scenario. I am working on a project [for KDE], whose trunk is hosted at, lets say: http://ubersvn.org/home/uber/trunk/myapp. Also, I'm working on a branch, lets say: http://ubersvn.org/home/uber/branches/work/myapp-mod. This is what I've been doing:

After creating a branch, I worked throughout on my local working copy of the branch, and I frequently used to pull changes from the trunk. I was told that it would help in preventing a load of conflicts when it came to finally merging back to the trunk. So, quite frequently, I used to do:

svnmerge.py merge
svn commit -F svnmerge-commit-message.txt

After the work was done, it was time to merge the branch back to the trunk. I first checked out a working copy of the trunk:

svn co svn+ssh://ubersvn.org/home/uber/trunk/myapp
cd myapp

Then, I followed the documentation for merging back:

svnmerge init svn+ssh://ubersvn.org/home/uber/branches/work/myapp-mod

And to merge back and forth:

svnmerge merge --bidirectional -S svn+ssh://ubersvn.org/home/uber/branches/work/myapp-mod

And here is where the problem starts. Firstly, from the looks of it, it is merging every single revision since I branched. If it is doing this, I don't see the point in me frequently pulling from trunk and keeping my branch up to date. However, I'm just assuming svnmerge somehow uses it to resolve conflicts throughout the merge. So far, so good.

Secondly, it ended abruptly with an error that sounded something like:

Attempt to add tree conflict that already exists

A little search online told me the problem could be solved by:

svn resolve --accept working -R .

And then it shows that some resolves were cleared and all. However, now when I do this:

svnmerge merge --bidirectional -S [BRANCH_URL]

it says, 'no svnmerge info found'. I tried using svnmerge init BRANCH_URL, but it says that '.' has local modifications. It must be clean.

So, now the problems I am facing are:

  • I cannot pull from my branch since there are local modifications
  • To make my working copy clean, I must commit, which is not an option since the merging is only halfway and it would definitely break trunk.
  • My files are completely inconsistent. I don't know how the revisions were merged, there are files which include 'mylittleapp.h', but 'mylittleapp.h' was created in a later revision.
  • **There are a huge number of conflicts** for **EVERY** new file that was added in my branch. I **absolutely** do not understand this. I was the ONLY developer working on those files, those files were not able in the trunk at any point of time. Why are there so many conflicts in those files?
  • There are a huge number of files called `mybigapp.h.merge-(right|left).r[0-9]+`, and `mybigapp.h.working`. `mybigapp.h` itself is FULL of conflicts. So many conflicts that it is humanly impossible to resolve.
  • Since half the files assume the existence of a file which is actually not present, I cant test or do anything till I get the file. And I just cannot get any later revisions after the `attempt to add tree conflict` error.

So, how do I proceed from here? One solution seems to be to just diff from the branch, apply to the trunk and then commit. But according to the policies of the organization I work for, it is not acceptable. Any help is greatly appreciated and I'd be really grateful.

Thanks, rohan

+1  A: 

I don't really have a solution for you but I hope this helps.

Before merging your branch back to trunk your branch needs to have every commit from trunk from the time you created your branch. This is important because otherwise merging your changes back to trunk would erase other peoples changes from the trunk.

rev 5: created my-branch
rev 6: change 1 in my-branch
rev 7: change somefile.h in trunk
rev 8: change 2 in my-branch

Now if you just merge my-branch back to trunk, the change from rev 7 will be lost! This is why you need to update your branch with all changes from the trunk. Whenever you merge changes SVN adds a mergeinfo property (SVN 1.5) to the top-level directory (the one that you are doing the merge on). This looks something like this:

svn:mergeinfo /trunk:7, 10-13, 14 (it means that you have merged these revisions from trunk to your branch)

The message about tree conflict is usually related to file and directory moves and renames. If you deleted a file but didn't use svn delete, or somefile.h was changed in trunk but this file is moved somewhere else in your branch.

Here's what I would try:

  1. Checkout new trunk
  2. Checkout new branch
  3. Make sure that branch contains every change from the trunk (you can check mergeinfo property on top-level branch directory, if you're using svn 1.5)
  4. Read everything about merging http://svnbook.red-bean.com/en/1.5/index.html (it won't take you too long and you'll know exactly what you're doing)
  5. Try to merge your branch back to trunk

I can't help you with the command line since I'm not using a command line client. What you're trying to do is something people using SVN do every day, it must work.

Nikola Smiljanić