views:

1547

answers:

5

I have two repositories which live on separate servers, call them repo-1 and repo-2.

To start both "trunks" were equal:

repo-1/trunk == repo-2/trunk

Meanwhile changes were being commited to repo-1/trunk and I was working on and commiting changes to repo-2/trunk.

Now I need to merge changes from repo-1/trunk into repo-2/trunk.

I thought I would copy repo-1/trunk into repo-2/tags/r1_20090224, then merge that tag into my local working copy of repo-2/trunk (i.e. c:\dev\repo2-trunk).

Any suggestions on how to do this? I'm trying to use TortoiseSVN and performing "Merge two different trees", I used the following settings:

From: repo-2/trunk To: repo-2/tags/r1_20090224 Working Copy: c:\dev\repo2-trunk

I also tried swapping the "from" and "to"...but no luck. By trying either of those two merge options I either end up with the following outcome:

  1. If I merge from trunk to tag (into my local copy of repo-2/trunk) I lose my trunk changes and get the tag changes.

  2. If I merge from tag to trunk (into my local copy of repo-2/trunk) I lose my tag changes and keep my trunk changes.

Any suggestions on to do this??

+1  A: 

First figure out the revision where the trees were the same. Then merge that from that revision to HEAD of the repo-1 repository to your repo-2 working copy.

Using the commandline client it's similar to this, if you want to merge changes between r123 and r456

svn merge http://domain.tld/repos1@123 http://domain.tld/repos1@456 repos2-workingcopy
Sander Rijken
A: 

SVK might be able to help if you find yourself constantly managing multiple repositories over time that need to be synced every once in a while.

Assaf Lavie
+1  A: 

It's not entirely clear, but you need to merge from the base of the two trees, i.e. the point at which the two trunks were the same.

Sander beat me to it, so credit to him, but here are a couple more tips:

  1. Get these two repositories joined up into one as soon as possible; Subversion wasn't really designed to work like this. Or alternatively move to a DVCS like git or bazaar or ...
  2. If you stick with Subversion, conventionally this kind of stuff is done with branches, not tags. Tags are normally used as marker points, and are not committed to.
Brent.Longborough
+1  A: 

If svn merge were to fail you across the two sites/servers:

svn: Unusable URI: it does not refer to this repository

Then use the following approach:

  1. identify the revision level at which repo-2 started diverge from repo-1, say 123, then:
  2. svn co http://server1/repo-1/trunk
  3. svn diff -r123:HEAD http://server2/repo-2/trunk >repo2.patches
  4. patch -p0 -i repo2.patches
  5. screen for any conflicts and resolve them
  6. svn ci --message "merged from repo-2"

Cheers, V.

vladr
So the two repo's don't share any history. For example, repo-1/trunk existed for some time.then repo-2/trunk was created by doing the following: 1. export repo-1/trunk and burned to a CD 2. CD is taken to repo-2 server and merely "added" as repo-2/trunk
codecraig
Help me. Thanks
uriDium
A: 

So the two repo's don't share any history.

For example, repo-1/trunk existed for some time and repo-2 also existed for some time. Then at some point a copy of repo-1/trunk was copied into repo-2/trunk (there previusly hadn't been a trunk directory there).

codecraig