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

Re: Confusing error: "Cannot replace a directory from within"

From: David Glasser <glasser_at_mit.edu>
Date: 2007-05-10 05:32:55 CEST

On 5/9/07, Peter Lundblad <plundblad@google.com> wrote:
> For svnserve, this adds three extra roundtrips just for the sanity check
> (not saying it is the wrong tradeoof if there's no other way) and
> reconnects twice if you're working against anolder server.
> Is there a cheaper way to do it? Is it possible to check for a specific
> error returned from the server?
> (I don't have the sources handy ATM, so that might be a too easy question
> to anser...)

The error is generated in libsvn_repos/reporter.c(drive):

  /* If the anchor is the operand, the source and target must be dirs.
     Check this before opening the root to avoid modifying the wc. */
  else if (!*b->s_operand && (!s_entry || s_entry->kind != svn_node_dir
                              || t_entry->kind != svn_node_dir))
    return svn_error_create(SVN_ERR_FS_PATH_SYNTAX, NULL,
                            _("Cannot replace a directory from within"));

The reporter code is invoked for much more than just switch, and this
particular error covers more cases than just the issue at hand. I
thought about making it return a more specific error based on exactly
what s_entry->kind and t_entry->kind was, but I'm not incredibly
familiar with the reporter code, and catching the invalid input as
soon as it occurs seemed to be less invasive.

(On the other hand, arguably this is never a useful error message. I
haven't quite figured out all the cases that it can occur yet.)

The reparents shouldn't be able to fail at least, right?

--dave

-- 
David Glasser | glasser_at_mit.edu | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu May 10 05:33:04 2007

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