0

Using Subversion I have two different trunks that contains essentially the same content, but one is less frequently updated than the other. For simplicities sake, let's call them "old trunk" and "new trunk".

On a regular basis I want to replace everything that exists in "old trunk" with that in "new trunk". Essentially, what I want is to "copy" everything and replace what exists.

If I try to merge, I end up with some of the files that were deleted in "new trunk" as a pragmatic merge between the two trunks. This is not what I want.

Previously I've used to manually copy and replace each subfolder, starting by deleting any unwanted files in the old version. This is a painstaking process and should be replaced by a "overwrite merge" as it is called in Clearcase.

Is there a way to accomplish this without manually going through each and every folder?

Edit: This is not an ideal setup, but due to circumstances out of my control it is as it is. I'd still like to know the answer to my core question: is it possible to create an overwrite merge?

  • What's the point in having the old trunk, if whatever you do in it is overwritten periodically? Couldn't you simply remove the old trunk and recreate it by copying the new one? – JB Nizet Apr 19 '12 at 13:40
  • I probably could, but as I'm neither familiar with, nor allowed access to, the configuration between SVN and our build setup/deployment. – Mattias Zippert Apr 19 '12 at 17:24

2 Answers2

0

SVN is a centralized version control system. You should not have two trunks, that's not how it's meant to be used. You should use branches and tags. Your old trunk would be a branch, then you merge the trunk into that. If you want multiple repositories and synchronize between them you should use a distributed version control system like git.

jbat100
  • 16,470
  • 3
  • 40
  • 69
  • It is not my setup, I'm only using an existing one. There is (or perhaps more accurately, was) a purpose with the current setup. The initial purpose was not to have two identical trunks, but for practical reasons it has become like this. – Mattias Zippert Apr 19 '12 at 17:18
  • Albeit, you make a valid point. What is the (functional) difference between trunks and branches? – Mattias Zippert Apr 19 '12 at 17:23
  • The difference between trunk and branches in svn is conceptual http://stackoverflow.com/questions/16142/what-do-branch-tag-and-trunk-really-mean. I think you mean you have two repositories? If you only have one repository then you can use the svn merge functionality. – jbat100 Apr 20 '12 at 08:04
0

The answer is no, Subversion (1.6) does not provide any overwrite merge functionality. I am assuming also that you cannot change your configuration management procedures. If you can, then you should use Subversion as in the recommended practices. Release branches are a Good Thing(TM).

However, I have two crazy ideas for you:

  1. If you don't need to keep change or merge history of the target trunk, simply delete it and copy the source trunk into its place. It is like having a release branch, but you keep on recreating it all of the time. I don't think that this would be valuable.

  2. You could try to misuse the record only and reintegrate functionality. First, you would start by only recording (not actually merging) the target trunk back to your source trunk. This will have Subversion think that you have successfully merged the branch and it is up to date. Following that, you would regularly tell Subversion to reintegrate the source trunk into the target trunk. As a reintegrate only looks at the tip of each branch, this could work. If you try, do let us know the result!

For the second idea, please refer to the Advanced Merging section in the Subversion book.

David Pettersson
  • 358
  • 2
  • 11