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

Re: [ruby bindings] nil as value for depth parameters

From: Daniel Rall <dlr_at_collab.net>
Date: 2007-10-01 20:52:02 CEST

On Mon, 01 Oct 2007, Joe Swatosh wrote:

> Hi Day,
>
> On 10/1/07, Daniel Rall <dlr@collab.net> wrote:
> > Why is 'nil' a valid value for the depth parameter? Is it
> > automatically converted to svn_depth_empty (0) somewhere? I noticed
> > that client.status() (and many other Ruby client APIs) use it as a
> > default value.
> >
>
> I think what you are looking for is svn_swig_rb_to_depth.

Thanks Joe! From
subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c:

svn_depth_t
svn_swig_rb_to_depth(VALUE value)
{
  if (NIL_P(value)) {
    return svn_depth_infinity;
  } else if (value == Qtrue) {
    return SVN_DEPTH_FROM_RECURSE(TRUE);
  } else if (value == Qfalse) {
    return SVN_DEPTH_FROM_RECURSE(FALSE);
  } else if (RTEST(rb_obj_is_kind_of(value, rb_cString)) ||
             RTEST(rb_obj_is_kind_of(value, rb_cSymbol))) {
    value = rb_funcall(value, id_to_s, 0);
    return svn_depth_from_word(StringValueCStr(value));
  } else if (RTEST(rb_obj_is_kind_of(value, rb_cInteger))) {
    return NUM2INT(value);
  } else {
    rb_raise(rb_eArgError,
             "'%s' must be DEPTH_STRING (e.g. \"infinity\" or :infinity) "
             "or Svn::Core::DEPTH_*",
             r2c_inspect(value));
  }
}

This seems to fall victim to issue #2951, [sparse-directories] Fix
non-recursive mode of compat APIs to use depth empty instead of files.

Also, it defaults some APIs (e.g. client.proplist) to
svn_depth_infinity, when I'd more intuitively expect them to use depth
empty (as per their behavior from the command-line client).

  • application/pgp-signature attachment: stored
Received on Mon Oct 1 20:52:11 2007

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.