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

Re: API proposal - issue 2188 - svn_client_copy/move

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-11-04 16:22:39 CET

Madan U Sreenivasan wrote:
>
> The pain area as of now is
> - The inability to return error when the destination folder already
> exists

> I propose a simple extra parameter - on_dir_exists to the copy and
> move API that dictates how to handle the situation of the directory
> existing
[...]
> svn_make_sub_dir_if_dir_exists - does exactly that

This is the behaviour we should never have had. It is unreasonable for a
caller not to care where the item goes, so I don't want a
"make_sub_dir_if_dir_exists" option. The only reason such an ambiguous command
is usable at the command line is because users have out-of-band knowledge of
whether the destination directory already exists.

I am working on an alternative proposal. (Basically it has the option: "If
target exists, overwrite it or error?")

Garrett Rooney wrote:
> There's no way to say "copy this to location /foo, but if another
> directory shows up there in the meantime error out", and even if we
> had that, you still couldn't implement the "replace /tags/foo with a
> copy of /trunk" all in one commit, it would have to be split into two
> commits, and the second could potentially fail due to a race
> condition..

It's fair enough to aim to provide very simple but non-primitive operations
atomically, and I would allow replacement as one such. In fact, I'll
explicitly keep it in mind as a requirement for this API.

We shouldn't aim in the API to provide more complex operations such as the
above-mentioned existing behaviour "if the destination is a directory, copy
INTO it, otherwise copy TO it". There are endless possible variations that
could be wanted, and our client-level APIs are just not designed for doing them
atomically. One would have to use a transaction-oriented API
(start-transaction, do-this, do-that, end-transaction) instead.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Nov 4 16:23:56 2005

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