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

Re: [PATCH] copy file to existing directory.

From: Stefan Sperling <stsp_at_elego.de>
Date: Sun, 10 Aug 2008 17:55:50 +0200

On Sun, Aug 10, 2008 at 11:20:36PM +0800, Rui, Guo wrote:
> > If you need to tell the two cases apart, you can use svn_io_check_path()
> > and compare the dst_kind return value against svn_node_none, like
> > the first bit I quoted does.
> >
> > Or you could invent a new error code and create svn_wc_copy3(), which
> > returns different errors for these cases. Make sure not to break
> > existing callers of svn_wc_copy2() if you decide to do that.
> > svn_wc_copy2() should call svn_wc_copy3() (so that the code is not
> > duplicated), but return SVN_ERR_ENTRY_EXISTS instead if svn_wc_copy3()
> > returns your new error code.
> >
> > Hope this helps,
>
> It really helps very much!

Great :)

> I did not aware of this misunderstanding until you
> pointed it out. I'll use svn_io_check_path() solution since it is good enough.

Yes, it's good enough, but note that adding a new error code will
probably perform slightly better. svn_io_check_path() does a stat()
system call on the path. Control flow has to switch into the operating
system kernel and back each time we call svn_io_check_path().

Using a different error code does not have have this overhead.

But we're calling svn_io_check_path() in way too many places already
anyway, so feel free to pick the solution you find easier to implement.
In general, it's better to get code working correctly first before
optimising it. We can always optimise it later.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-08-10 17:56:23 CEST

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

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