[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: Rui, Guo <timmyguo_at_mail.ustc.edu.cn>
Date: Wed, 13 Aug 2008 00:27:16 +0800

On Tue, Aug 12, 2008 at 12:40:38PM +0200, Stefan Sperling wrote:
> On Tue, Aug 12, 2008 at 02:56:38PM +0800, Rui, Guo wrote:
> > My solution is to prevent the second call to setup_copy() in
> > svn_client_copy4() and failed to make it work for all cases. I think I should
> > combine a call to svn_path_is_url() with the svn_io_check_path().
> >
> > Your solution sounds good. But I suspect that we won't be able to go this far
> > -- the svn_wc_adm_open() will raise a error for the desitination before we can
> > go into svn_wc_copy2().
>
> Oh, OK. That might be the case, I haven't checked.
>
> But in that case, we could catch the case inside of setup_copy(), right?
> I think it's better to do it there than outside of setup_copy() anyway.
>
> Because setup_copy() already does things like checking whether the
> source is a URL, it seems more suitable to modify setup_copy()
> instead of its caller.

I tried to do it in setup_copy() and resulted in a version copy2.diff. In this
way, I can easily tell if the destination is wc or URL. However, I can not
easily tell if the wc destination is within a missing/hidden versioned path.
Many of the code added in the patch is used to check the situation.

copy2.diff
[[[
Handles the situation of existing destination directory better for copy/move.

* subversion/libsvn_wc/copy.c
  (copy_file_administratively): Check the existence of target directory.

* subversion/libsvn_client/copy.c
  (setup_copy): Raise an informative error if the destination is within
   a missing/hidden versioned path.
]]]

I also provide a version that do the check in svn_client_copy/move() function.
The pro of this way is that calling svn_path_is_url() is more trivial than
checking for the entry in the adm-area. The con is that the modification has
to be duplicated for both copy and move functions.

copy3.diff
[[[
Handles the situation of existing destination directory better for copy/move.

* subversion/libsvn_wc/copy.c
  (copy_file_administratively): Check the existence of target directory.

* subversion/libsvn_client/copy.c
  (svn_client_copy4, svn_client_move5): Don't copy/move as child if the
   destination is a missing/hidden versioned wc directory. Raise an
   informative error for this situation.

]]]

Choose either one you think better. :-)
Thanks

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-12 18:27:36 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.