[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Merging from foreign repositories

From: Stefan Sperling <stsp_at_elego.de>
Date: Mon, 14 Mar 2011 16:53:47 +0100

On Mon, Mar 14, 2011 at 04:08:57PM +0100, Christoph Bartoschek wrote:
> Hi,
>
> I would like to merge all changes in a directory from repository A to a
> directory in repository B.
>
> My idea was to do a loop over all iterations and merge them to dirB:
>
> svn merge -c rev file:///path/to/rep/A/dirA dirB
>
> My problem is that for the revision where dirA is created in repositoryA
> nothing is done.

> You see that the first command does nothing although dirA and lots of subdirs
> were created in revision 1.

The addition of dirA is a change on the *parent* of dirA.

So merge the parent folder into the target's parent folder first,
preferrably using a two-URL merge (Last time I tried this, with TortoiseSVN,
it would only work with a two-URL merge. I'm not sure if the CLI client
has the same requirement. But since both use the same libraries that is not
unlikely):

svn merge file:///path/to/rep/A/@rev-1 file:///path/to/rep/A/@rev parent-dir

This will add dirA into parent-dir. Commit this.

Next, you could experiment with renaming dirA to dirB.
But if you ever merge at a higher level in the tree, so that changes
made upstream in dirA appear as part of the diff, you will get tree
conflicts since dirA won't be found at your end.
So not renaming it might save you some headaches later.
I'd recommend keeping the name.

Now, the following revs can apply cleanly.
There is no need to loop over the revs, you can apply the entire
range at once, giving you single commit that contains all the changes
made upstream.

svn merge file:///path/to/rep/A/dirA_at_rev+1 file:///path/to/rep/A/dirA_at_HEAD dirA
or if you decided to rename:
svn merge file:///path/to/rep/A/dirA_at_rev+1 file:///path/to/rep/A/dirA_at_HEAD dirB

If you have a real need to cherry-pick individual changes merged from
the foreign repository to branches in your own repository, you will
need to loop over all the revs, of course, and merge them individually.

Note that there is no merge tracking with foreign repos merges,
so make sure to note which revisions have already been merged from
the foreign repository (e.g. in the log message).
Received on 2011-03-14 16:54:28 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.