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

Re: [patch] Use hash for optional args with long argument list in Ruby bindings

From: Kouhei Sutou <kou_at_cozmixng.org>
Date: 2007-11-18 07:03:58 CET

Hi,

In <ae6cb1100711172107g2e3b6d57ufac1aa0723dc97d8@mail.gmail.com>
  "Re: [patch] Use hash for optional args with long argument list in Ruby bindings" on Sat, 17 Nov 2007 21:07:30 -0800,
  "Joe Swatosh" <joe.swatosh@gmail.com> wrote:

> > > Okay, I committed in r27900. What about the :target_revision
> > > argument? Couldn't
> > > it reasonably be defaulted to zero?
> >
> > I think :target_revision isn't needed because it seems that
> > :target_revision is for output. We should remove
> > :target_revision from argument list.
>
> When I tried to do this the test_switch_editor started failing
>
> test_switch_editor(SvnWcTest)
> D:/SVN/src-trunk/subversion/bindings/swig/ruby/test\test_wc.rb:879:in
> `test_switch_editor'
> D:/SVN/src-trunk/subversion/bindings/swig/ruby/svn/wc.rb:125:in `_open'
> D:/SVN/src-trunk/subversion/bindings/swig/ruby/svn/wc.rb:115:in `open_anchor'
> D:/SVN/src-trunk/subversion/bindings/swig/ruby/test\test_wc.rb:876:in
> `test_switch_editor':
> <2> expected but was
> <0>.
>
> So maybe its not such a great idea.

OK. I misunderstood.

Anyway, the 1.4 codes has bugs (I passed wrong arguments to
get_update_editor2) and I fixed in r24302.

For now, update_editor codes is based on 1.4 and has the
bugs. We need to fix the bugs like I did in r24302. I'll
attach a patch for update_editor. switch_editor will need to
be fixed.

Thanks,

--
kou

Index: subversion/bindings/swig/ruby/svn/wc.rb
===================================================================
--- subversion/bindings/swig/ruby/svn/wc.rb (revision 27906)
+++ subversion/bindings/swig/ruby/svn/wc.rb (working copy)
@@ -299,7 +299,7 @@ module Svn
       def update_editor(target, use_commit_times=true, recurse=true,
                         diff3_cmd=nil, notify_func=nil, cancel_func=nil,
                         traversal_info=nil)
- editor, editor_baton = Wc.get_update_editor2(target, self,
+ editor, editor_baton = Wc.get_update_editor2(nil, self, target,
                                                      use_commit_times, recurse,
                                                      notify_func, cancel_func,
                                                      diff3_cmd, traversal_info)
@@ -307,9 +307,10 @@ module Svn
         editor
       end
 
- UPDATE_EDITOR2_REQUIRED_ARGUMENTS_KEYS = [:target_revision, :target]
+ UPDATE_EDITOR2_REQUIRED_ARGUMENTS_KEYS = [:target]
       def update_editor2(arguments={})
         optional_arguments_defaults = {
+ :target_revision => nil,
             :use_commit_times => true,
             :depth => nil,
             :allow_unver_obstruction => false,
Index: subversion/bindings/swig/svn_wc.i
===================================================================
--- subversion/bindings/swig/svn_wc.i (revision 27906)
+++ subversion/bindings/swig/svn_wc.i (working copy)
@@ -197,7 +197,11 @@
 %typemap(in) svn_revnum_t *target_revision
 {
   $1 = apr_palloc(_global_pool, sizeof(svn_revnum_t));
- *$1 = NUM2LONG($input);
+ if (NIL_P($input)) {
+ *$1 = SVN_INVALID_REVNUM;
+ } else {
+ *$1 = NUM2LONG($input);
+ }
 }
 
 %typemap(argout) svn_revnum_t *target_revision

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Nov 18 07:04:24 2007

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