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

Re: svn commit: r26006 - in trunk/subversion/bindings/swig: include ruby/libsvn_swig_ruby ruby/svn

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2007-08-11 06:19:07 CEST

Hi kou,

On 8/8/07, joeswatosh@tigris.org <joeswatosh@tigris.org> wrote:
> Author: joeswatosh
> Date: Wed Aug 8 19:51:31 2007
> New Revision: 26006
>
> Log:
> Added support for the svn_wc_conflict_resolver_func_t conflict_func, and
> void *conflict_baton arguments added to svn_wc_get_update_editor3.
>
> * subversion\bindings\swig\include\svn_types.swg new in and argout typemaps
> for svn_wc_conflict_resolver_func_t.
>
> * subversion\bindings\swig\ruby\libsvn_swig_ruby\swigutil_rb.h
> (svn_swig_rb_conflict_resolver_func) new function
>
> * subversion\bindings\swig\ruby\libsvn_swig_ruby\swigutil_rb.c
> (svn_swig_rb_conflict_resolver_func) new function
>
> * subversion\bindings\swig\ruby\svn\wc.rb (Svn::Wc::AdmAccess#update_editor)
> added new conflict_func argument, defaulted to nil.
>
>
> Modified:
> trunk/subversion/bindings/swig/include/svn_types.swg
> trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c
> trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h
> trunk/subversion/bindings/swig/ruby/svn/wc.rb
>
> Modified: trunk/subversion/bindings/swig/include/svn_types.swg
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/include/svn_types.swg?pathrev=26006&r1=26005&r2=26006
> ==============================================================================
> --- trunk/subversion/bindings/swig/include/svn_types.swg (original)
> +++ trunk/subversion/bindings/swig/include/svn_types.swg Wed Aug 8 19:51:31 2007
> @@ -801,6 +801,18 @@
> };
> #endif
>
> +#ifdef SWIGRUBY
> +%typemap(in) (svn_wc_conflict_resolver_func_t conflict_func, void *conflict_baton)
> +{
> + $1 = svn_swig_rb_conflict_resolver_func;
> + $2 = (void *)svn_swig_rb_make_baton($input, _global_svn_swig_rb_pool);
> +}
> +
> +%typemap(argout) (svn_wc_conflict_resolver_func_t conflict_func, void *conflict_baton)
> +{
> + svn_swig_rb_set_baton($result, (VALUE)$2);
> +};
> +#endif
>
> /* -----------------------------------------------------------------------
> Callback: svn_info_receiver_t
>
> Modified: trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c?pathrev=26006&r1=26005&r2=26006
> ==============================================================================
> --- trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c (original)
> +++ trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c Wed Aug 8 19:51:31 2007
> @@ -2150,6 +2150,34 @@
> }
>
> svn_error_t *
> +svn_swig_rb_conflict_resolver_func(svn_wc_conflict_result_t *result,
> + const svn_wc_conflict_description_t *description,
> + void *baton,
> + apr_pool_t *pool)
> +{
> + svn_error_t *err = SVN_NO_ERROR;
> + VALUE proc, rb_pool, rb_result;
> +
> + *result = svn_wc_conflict_result_conflicted;
> +
> + svn_swig_rb_from_baton((VALUE)baton, &proc, &rb_pool);
> +
> + if (!NIL_P(proc)) {
> + callback_baton_t cbb;
> +
> + cbb.receiver = proc;
> + cbb.message = id_call;
> + cbb.args = rb_ary_new3(1,
> + c2r_swig_type((void *)description,
> + (void *)"const svn_wc_conflict_description_t *"));
> + rb_result = invoke_callback_handle_error((VALUE)(&cbb), rb_pool, &err);
> + r2c_swig_type2(rb_result, "svn_wc_conflict_result_t *", &result);
> + }
> +
> + return err;
> +}
> +
> +svn_error_t *
> svn_swig_rb_commit_callback(svn_revnum_t new_revision,
> const char *date,
> const char *author,
>
> Modified: trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h?pathrev=26006&r1=26005&r2=26006
> ==============================================================================
> --- trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h (original)
> +++ trunk/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h Wed Aug 8 19:51:31 2007
> @@ -214,6 +214,13 @@
> apr_pool_t *pool);
>
> SVN_RB_SWIG_SWIGUTIL_EXPORT
> +svn_error_t * svn_swig_rb_conflict_resolver_func(
> + svn_wc_conflict_result_t *result,
> + const svn_wc_conflict_description_t *description,
> + void *baton,
> + apr_pool_t *pool);
> +
> +SVN_RB_SWIG_SWIGUTIL_EXPORT
> svn_error_t *svn_swig_rb_commit_callback(svn_revnum_t new_revision,
> const char *date,
> const char *author,
>
> Modified: trunk/subversion/bindings/swig/ruby/svn/wc.rb
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/ruby/svn/wc.rb?pathrev=26006&r1=26005&r2=26006
> ==============================================================================
> --- trunk/subversion/bindings/swig/ruby/svn/wc.rb (original)
> +++ trunk/subversion/bindings/swig/ruby/svn/wc.rb Wed Aug 8 19:51:31 2007
> @@ -298,13 +298,13 @@
> def update_editor(target_revision, target, use_commit_times=true,
> depth=nil, allow_unver_obstruction=false, diff3_cmd=nil,
> notify_func=nil, cancel_func=nil, traversal_info=nil,
> - preserved_exts=nil)
> + preserved_exts=nil, conflict_func=nil)
> preserved_exts ||= []
> traversal_info ||= _traversal_info
> results = Wc.get_update_editor3(target_revision, self, target,
> use_commit_times, depth,
> allow_unver_obstruction,
> - notify_func, cancel_func, diff3_cmd,
> + notify_func, cancel_func, conflict_func, diff3_cmd,
> preserved_exts, traversal_info)
> target_revision_address, editor, editor_baton = results
> editor.__send__(:target_revision_address=, target_revision_address)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
>
>

David has already fixed my poorly formatted log message, so that part
is better.

However, I'm still unhappy with the svn_swig_rb_conflict_resolver_func
function itself. It feels like it should return the
svn_wc_conflict_result_t, but I wasn't sure how to make that happen.
Not to mention that there is no test for any of this (I've no idea how
I could tie this together).

Now that you've let me get started complaining, I'm not nuts about all
the default arguments to Svn::Wc::AdmAccess#update_editor and
switch_editor. Is it time to start considering a hash? How about (DO
NOT COMMIT!):

Index: subversion/bindings/swig/ruby/svn/wc.rb
===================================================================
--- subversion/bindings/swig/ruby/svn/wc.rb (revision 26006)
+++ subversion/bindings/swig/ruby/svn/wc.rb (working copy)
@@ -295,17 +295,28 @@
         Wc.is_wc_root(path, self)
       end

- def update_editor(target_revision, target, use_commit_times=true,
- depth=nil, allow_unver_obstruction=false,
diff3_cmd=nil,
- notify_func=nil, cancel_func=nil, traversal_info=nil,
- preserved_exts=nil, conflict_func=nil)
- preserved_exts ||= []
- traversal_info ||= _traversal_info
+ def update_editor(target_revision, target, options={})
+ options = {
+ :use_commit_times => true,
+ :depth => nil,
+ :allow_unver_obstruction => false,
+ :notify_func => nil,
+ :cancel_func => nil,
+ :conflict_func => nil,
+ :diff3_cmd => nil,
+ :preserved_exts => [],
+ :traversal_info => _traversal_info,
+ }.merge options
         results = Wc.get_update_editor3(target_revision, self, target,
- use_commit_times, depth,
- allow_unver_obstruction,
- notify_func, cancel_func,
conflict_func, diff3_cmd,
- preserved_exts, traversal_info)
+ options[:use_commit_times],
+ options[:depth],
+ options[:allow_unver_obstruction],
+ options[:notify_func],
+ options[:cancel_func],
+ options[:conflict_func],
+ options[:diff3_cmd],
+ options[:preserved_exts],
+ options[:traversal_info])
         target_revision_address, editor, editor_baton = results
         editor.__send__(:target_revision_address=, target_revision_address)
         editor.baton = editor_baton

???
It looks like we've broken compatibility with 1.4.x for that function
already. That may have to be a different discussion.

Sorry to unload all at once, thanks for your consideration.

--
Joe
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Aug 11 06:17:12 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.