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

Update Problem (with partial Solution) - Cannot replace a directory from within

From: Rob Hubbard <rob.hubbard_at_softel.co.uk>
Date: Wed, 25 Feb 2009 15:05:59 -0000

Hello,
 

I had a working copy that I was trying to update, but SVN (Subversion)
just produced a slightly cryptic (Zen-like) message:
 
    $ svn up MyProject/
    svn: Cannot replace a directory from within

I've found out a little about why this happened, and what to do about
it, but have some remaining questions...
 
--------
 
Firstly, here's what I've found so far, in case this is of help to
anyone else.
 
Suppose that you have a working copy mapped to a fairly old location in
the repository:
 
    $ svn info MyProject
    Path: MyProject
    URL: http://svr/svn/MyProject/Trunk <http://svr/svn/MyProject/Trunk>

    Repository Root: http://svr/svn <http://svr/svn>
    Revision: 9000
    Node Kind: directory
 
Note that a later revision in the repository is a rename:
 
    $ svn log http://svr/svn/ <http://svr/svn/> -vr9877
 
------------------------------------------------------------------------
    r9877 | somebody | 2009-02-30 12:34:56 +0000
    Changed paths:
       D /MyProject/Trunk
       A /MyProject/trunk (from /MyProject/Trunk:9876)
 
------------------------------------------------------------------------
 
Here, the case of the "Trunk" directory has changed. That's not
important; it could be any kind of rename; the same problem would occur
with a rename from "Trunk" to "Elephant" (yes I know; that's the wrong
kind of trunk).
 
SVN (as at version 1.5) still deals with renames as an add followed by a
delete.
 
What SVN was saying was that the directory you're trying to update has
been deleted, and it can't delete in-place, at the "top level".
 
The solution is to help SVN by switching across to the new directory
(effectively a branch):
 
    $ svn switch http://svr/svn/MyProject/trunk
<http://svr/svn/MyProject/trunk> -r9877 MyProject/
    At revision 9877.
 
    $ svn up MyProject/
      (...)
    At revision 10099.
 
The switch also performs an update to the HEAD unless you specify a
revision. Thus the above could simply have been performed in a single,
simpler operation:
 
    $ svn switch http://svr/svn/MyProject/trunk
<http://svr/svn/MyProject/trunk> MyProject/
      (...)
    At revision 10099.
 
Now you should be able to continue as usual.
 
Normally, looking backwards through the revisions past the rename should
not present any difficulties, as SVN traverses the copy/add-with-history
transparently. Sometimes, however, you might need to "peg" the revision
(see the SVN book
<http://svnbook.red-bean.com/en/1.5/svn.advanced.pegrevs.html
<http://svnbook.red-bean.com/en/1.5/svn.advanced.pegrevs.html> > for
details).
 
--------
 
So why is this only a partial solution?
 
Well, the problem I still have is that finding the revision where the
project was deleted is not obvious to me. That revision is required
because its log contains the new path name.
 
If you try
    $ svn log MyProject/
then that's equivalent to
    $ svn log -r1:BASE MyProject/
which doesn't help, as it shows no "future history".
 
The command
    $ svn st -v MyProject/
doesn't help either.
 
Attempts to use HEAD in conjunction with peg revisions, such as
    $ svn log -rBASE:HEAD MyProject/
    $ svn log -rBASE:HEAD MyProject/@9000 <mailto:MyProject/@9000>
    $ svn log -rBASE:HEAD http://svr/svn/MyProject/Trunk@9000
<http://svr/svn/MyProject/Trunk@9000>
    $ svn log -rHEAD:BASE --limit 1 MyProject/
just produce a message which is something like
    svn: '/svn/!svn/bc/10099/MyProject/Trunk' path not found
and thus don't work either.
 
(These work fine *after* the switch/update, looking backwards through
the rename, which works due to the fact that the copy has a pointer to
the path and revision copied from.)
 
So the question is: how is it possible to generate a log message
including a point just before, or just at, such a deletion without
having to resort to either a manual or scripted binary search, or to
using something like TortoiseSVN's repository browser (on Windoze).
Preferably, the log should contain just that point, but anything is
better than nothing.
 
Less importantly, what does the "/!svn/bc/10099/" in the path mean?
Clearly the "/10099/" refers to the HEAD revision of the repository, but
what does the "/!svn/bc/" mean? (In the documentation, I also see
"/!svn/wrk/<UUID?>/", "/!svn/vcc/<protocol?>/", "/!svn/bln/..." and
"/!svn/act/...".)
 
Thanks,
Rob.

 
Rob Hubbard

________________________________________________________________
This message has been independently scanned for the Softel Group and cleared of containing viruses and other malicious data.

Powering Television Beyond the Video (TM)

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1227190

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-02-25 16:07:02 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.