2

I have made a branch to do some cleanup and structural changes on a website. The contents of trunk were simply the website files, like so (abbreviated for brevity):

/trunk/css/
/trunk/images/
/trunk/js/
/trunk/index.html

After branching, I moved the contents down one level and created another directory for non-website content (mostly PSD files) that I nonetheless need to keep and work with. The structure is now:

/branches/cleanup/www/css/
/branches/cleanup/www/images/
/branches/cleanup/www/js/
/branches/cleanup/www/index.html
/branches/cleanup/support/psd/

How do I cleanly merge this back into the trunk without a ton of tree conflicts? I'm sure I've done this before. Problem is, I can't for the life of me remember how.

I made a number of trunk changes since the branch was created, so I am flooded with tree conflicts.

I'm happy to accept a less-than-ideal solution at this point, so my backup plan is to forget merging and instead perform an svn move on the trunk to something like /branches/old-trunk/, then svn move the cleanup branch into /trunk/ and go from there.

Will there be any nasty side-effects of doing this, besides having to manually apply the trunk changes to the cleanup branch?

2
  • You shouldn't get any conflicts if the trunk hasn't changed since you branched. Commented Mar 23, 2015 at 20:58
  • I forgot to mention that there have been trunk changes. Unfortunately they are minor changes that were applied to most of the files. I have outlined a Plan B in my question, which before tyring I would greatly appreciate feedback.
    – md4
    Commented Mar 25, 2015 at 2:51

2 Answers 2

3

If there were no changes to the files in trunk, you will not get any conflicts.

If you changed any of the files inside trunk, that were also moved within the branch, there is no way to resolve this within Subversion without getting tree conflicts.

Update

If you move your branch to use it as the new trunk, it will break the automatic merge resolution for any other branches you might have. Other than that, there should be no issues with this move, since trunk is in no way "special" or different from any other directory when svn is concerned.

1
  • I had feared this was the case. I have updated my question with a Plan B approach on which I'd greatly appreciate some feedback before I try it.
    – md4
    Commented Mar 25, 2015 at 2:52
1

If you're willing to throw away the changes you made to trunk since making your branch, you can use the --accept option to svn merge to specify that you always want to use the branch version in case of conflict:

svn checkout TRUNK_URL WC_PATH
svn merge --accept theirs-full BRANCH_URL WC_PATH

You could also try theirs-conflict instead of theirs-full to only take the conflicted regions of files from the branch, instead of each file in its entirety. In your case, since you moved everything into a separate directory, I don't think there will be any difference, but I would try both and compare.

Ultimately, though, you probably made those changes to trunk for a reason. I would just bite the bullet and resolve the conflicts instead of tossing your work in the trash. There are other possible workarounds that could make the process less painful, like moving things in your branch back into the same directory structure as trunk, doing the merge, re-branching, and just changing the directory structure, but then you're introducing extra complication.

As an aside, this is why you should merge often. The introduction of automatic merge tracking in SVN 1.5 makes the process a lot less painful than it used to be.

2
  • I was not so much willing to throw the changes away as to accept the likelihood of having to re-apply them manually post-merge.
    – md4
    Commented Mar 30, 2015 at 10:47
  • In hindsight, I think I went about this wrong. I should have restructured the project folders in the trunk, then branched to do the actual cleanup work.
    – md4
    Commented Mar 30, 2015 at 10:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.