Am Montag, 14. März 2011 schrieb Stefan Sperling:
> 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@rev+1 file:///path/to/rep/A/dirA@HEAD
> dirA or if you decided to rename:
> svn merge file:///path/to/rep/A/dirA@rev+1 file:///path/to/rep/A/dirA@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).


Hi,

thanks for your suggestion. But the commit that created dirA also created lots 
of other directories. I am only interessted in dirA. 

I wrote that I want to do this incrementally because I would like to replicate 
each change in directory dirA of repository A to directory dirB of repository 
B with a commit hook.

Apparently this does not work with the commit that creates dirA. It seems as 
if subversion is not able to do this. I will have to do this manually.

Unfortunately the automatic merging still does not work after fixing the 
creation of dirA. I describe it in another main.

Christoph

Reply via email to