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

Re: [PATCH] svn_wc_add3(): handles depth on add (was Re: [PATCH] Fix --depth behavior for svn add)

From: Rui, Guo <timmyguo_at_mail.ustc.edu.cn>
Date: Mon, 5 May 2008 21:17:15 +0800

On Mon, May 05, 2008 at 08:48:43PM +0800, Rui, Guo wrote:
> On Mon, May 05, 2008 at 11:55:55AM +0200, Stefan Sperling wrote:
> > >
> > > + /* default to depth_infinity if the value is invalid */ + if
> > > (!(depth >= svn_depth_empty + && depth <= svn_depth_infinity)) +
> > > depth = svn_depth_infinity; + /* Get the original entry for this path if
> > > one exists (perhaps this is actually a replacement of a previously
> > > deleted thing).
> >
> > Shouldn't this throw an error instead of silently overriding whatever the
> > caller passed in? Silently overriding the caller's value may produce
> > subtle bugs in client software that are difficult to track down for our
> > API consumers. I think it's better to let people know right away when they
> > did something wrong, by throwing an error at them. You could create a new
> > error code if no suitable one already eixsts, for example
> > SVN_ERR_WC_INVALID_DEPTH, or something like that.
>
> Well, I'll fix this. However, does this error fit in the wc category? After
> all, it's not the wc itself but the parameter that has problem.
>
I changed my mind. It should be OK to not check the depth value as other lib
functions do. Here is the updated svn_wc_add3 patch, the cleanup patch just
state the same.

Rui, Guo

[[[
Introduced a new svn_wc_add3() to handle depth correctly. This makes the
--depth option in 'svn add' works in the same way as ci, up etc.

* subversion/include/svn_wc.h
  (svn_wc_add3): New, accept depth parameters and ignore it for files.
  (svn_wc_add2): Now deprecated.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc_add3): New, accept depth parameters and ignore it for files.
    Obsolete comment deleted.
  (svn_wc_add2): Deprecated. Now calls svn_wc_add3 with a default
    svn_depth_infinity.

* subversion/libsvn_wc/copy.c
  (copy_added_file_administratively,
  copy_added_dir_administratively,
  copy_dir_administratively): Switch to svn_wc_add3, with a default
    svn_depth_infinity depth.

* subversion/libsvn_client/merge.c
  (merge_dir_added): Switch to svn_wc_add3, with a default svn_depth_infinity
    depth.

* subversion/libsvn_client/copy.c
  (repos_to_wc_copy_single): Switch to svn_wc_add3, with a default
    svn_depth_infinity depth.

* subversion/libsvn_client/add.c
  (add_file, add_dir_recursive,
  add, add_parent_dirs): Switch to svn_wc_add3, with a default
    svn_depth_infinity depth.
  (add): Pass all directory target to add_dir_recursive, otherwise adjustment
    will also be needed here.

* subversion/tests/cmdline/depth_tests.py
  (add_tree_with_depth_files): Renamed to add_tree_with_depth to reflect the
    new content: depth verified & new tests added for the --force & --parents
    situation
  (test_list): update according to the rename.
]]]

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-05-05 15:17:51 CEST

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