On Sun, Aug 10, 2008 at 05:55:50PM +0200, Stefan Sperling wrote:
> 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.
>
Well, it will not contribute to performance problem this time, since I only
add only one call in svn_client_copy/move().
Rui
---------------------------------------------------------------------
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 18:05:00 CEST