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

Re: Annoyance merging: "Cannot replace a directory from within"

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2005-03-19 04:49:47 CET

On Mar 18, 2005, at 9:23 PM, Greg Ward wrote:
> r437 2004-10-26 copy "/trunk" to "/tags/optik-1.5a2"
> r464 2004-11-11 doc fixes/additions in /trunk/doc/reference.txt
> r490 2005-03-08 more doc additions
> r491 2005-03-16 more doc additions
> r495 2005-03-16 more doc additions
> r496 2005-03-16 copy "/tags/optik-1.5a2" to "/branches/python-2.4"
> r497 2005-03-18 more doc additions
> r499 2005-03-18 more doc additions
> r500 2005-03-18 tweak doc-generating script (/trunk/mkpydoc)

All of these changes were made to trunk.

You want to apply them to the branch.

> What I want to do is merge all of the above doc changes from the trunk
> to /branches/python-2.4, since these are the doc changes that I want to
> get into Python 2.4.1. As a rough approximation, I'd be happy to merge
> all changes on the trunk from r437 to HEAD to doc/reference.txt on
> /branches/python-2.4, and then edit the file to remove text that
> describes new features and therefore does not belong in Python 2.4.1.
> My first attempt was this (you can play along at home, since this is a
> public repository):
> $ svn co svn://starship.python.net/optik/branches/python-2.4 \
> optik-python-2.4
> [...]
> $ cd optik-python-2.4
> $ svn merge -r437:HEAD \
> svn://starship.python.net/optik/trunk/doc/reference.txt
> svn: Cannot replace a directory from within
> Huh? Like others before me, I have google'd for that error message,
> and
> not been terribly enlightened by what I found. After much screwing
> around, I hit upon something that works:
> $ cd doc
> $ svn merge -r437:HEAD \
> svn://starship.python.net/optik/trunk/doc/reference.txt
> U reference.txt

So you need to compare apples with apples.

Remember that 'svn merge' compares two trees, and applies the
differences to a working-copy tree. That means all 3 trees need to
"line up" semantically.

In your case, you should be comparing two snapshots of trunk, and
applying them to a working copy of the branch. (One of your mistakes
above is asking merge to compare two snapshots of *one file*. That's
way too narrow a comparison, unless you're really only interested
merging changes from/to exactly one file -- but that's not what you
asked for.)

The syntax for merge is:

      svn merge URL1@X URL2@Y working-copy

or, a shorter form, if the URLs are the same:

      svn merge -rX:Y URL working-copy

So you're making mistakes on multiple levels. First of all, the reason
nothing works until you "cd" into a directory is because you're not
specifying the working copy argument -- which means it's defaulting to
'.', the current working dir. (Your first merge attempt was asking svn
to compare two files, and apply the differences to '.' -- that's
guaranteed to make no sense. The difference between two files can only
be applied to another file!)

What you want to do is

   $ cd branch-working-copy
   $ svn merge -r437:HEAD URL-of-trunk

or, if you don't want to cd into the working copy,

   $ svn merge -r437:HEAD URL-of-trunk branch-working-copy

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Mar 19 04:52:18 2005

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.