You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Joe Swatosh <jo...@gmail.com> on 2007/08/23 05:52:09 UTC

[PATCH] Ruby bindings follow on to r26229

[[[
Follow on to r26229 which added support for non-inheritable
mergeinfo revision ranges.

* subversion\bindings\swig\core.i
  (svn_swig_rb_mergeinfo_merge and svn_swig_rb_rangelist_merge)
  added new svn_merge_range_inheritance_t argument and forwarded to
  svn_mergeinfo_merge and svn_rangelist_merge respectively

* subversion\bindings\swig\ruby\svn\core.rb
  (Svn::Core::MergeInfo#diff, Svn::Core::MergeInfo#merge,
  Svn::Core::RangeList#diff, Svn::Core::RangeList#merge,
  Svn::Core::RangeList#remove) each got a new argument consider_inheritance
  which is defaulted to RANGELIST_IGNORE_INHERITANCE.

* subversion\bindings\swig\ruby\test\test_core.rb
 (SvnCoreTest#test_merge_info_to_s) now has to include the 'non-inheritable'
  suffix.
]]]

Re: [PATCH] Ruby bindings follow on to r26229

Posted by Joe Swatosh <jo...@gmail.com>.
Hi

On 8/25/07, Kouhei Sutou <ko...@cozmixng.org> wrote:
> Hi,
>
> In <ae...@mail.gmail.com>
>  "Re: [PATCH] Ruby bindings follow on to r26229" on Sat, 25 Aug 2007 19:49:36 -0700,
>  "Joe Swatosh" <jo...@gmail.com> wrote:
>
> > > > I have no idea how to do this.  I'm interested to see how you accomplish it.
> > >
> > > Here is my idea (not tested):
> >
> >
> > > And here is my feature idea (pseudo code):
> > >
> >
> > Ah, pretty obvious once you spelled it out for me.  I took what you presented
> > here and implemented it more like svn_depth_t.  Here we go:
>
> Thanks. :)
> Please commit.
>
> --
> kou
>
> > [[[
> >
> > Follow on to r26229 which added support for non-inheritable mergeinfo revision
> > ranges.
> >
> > * subversion\bindings\swig\core.i
> >   (svn_swig_rb_mergeinfo_merge and svn_swig_rb_rangelist_merge): added new
> >   svn_merge_range_inheritance_t argument and forwarded to svn_mergeinfo_merge
> >   and svn_rangelist_merge respectively.
> >
> > * subversion/bindings/swig/include/svn_types.swg
> >   (%typemap(in) svn_merge_range_inheritance_t): New typemap.
> >
> > * subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c,
> >   subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h
> >   (svn_swig_rb_to_merge_range_inheritance): New conversion function.
> >
> > * subversion\bindings\swig\ruby\svn\core.rb
> >   (Svn::Core::MergeInfo#diff, Svn::Core::MergeInfo#merge,
> >   Svn::Core::RangeList#diff, Svn::Core::RangeList#merge,
> >   Svn::Core::RangeList#remove) each got a new argument consider_inheritance
> >   which is defaulted to nil.
> >
> > * subversion\bindings\swig\ruby\test\test_core.rb
> >   (SvnCoreTest#test_merge_info_to_s)
> >
> > ]]]
>

Done in r26329
--
Joe

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Ruby bindings follow on to r26229

Posted by Kouhei Sutou <ko...@cozmixng.org>.
Hi,

In <ae...@mail.gmail.com>
  "Re: [PATCH] Ruby bindings follow on to r26229" on Sat, 25 Aug 2007 19:49:36 -0700,
  "Joe Swatosh" <jo...@gmail.com> wrote:

> > > I have no idea how to do this.  I'm interested to see how you accomplish it.
> >
> > Here is my idea (not tested):
> 
> 
> > And here is my feature idea (pseudo code):
> >
> 
> Ah, pretty obvious once you spelled it out for me.  I took what you presented
> here and implemented it more like svn_depth_t.  Here we go:

Thanks. :)
Please commit.

--
kou

> [[[
> 
> Follow on to r26229 which added support for non-inheritable mergeinfo revision
> ranges.
> 
> * subversion\bindings\swig\core.i
>   (svn_swig_rb_mergeinfo_merge and svn_swig_rb_rangelist_merge): added new
>   svn_merge_range_inheritance_t argument and forwarded to svn_mergeinfo_merge
>   and svn_rangelist_merge respectively.
> 
> * subversion/bindings/swig/include/svn_types.swg
>   (%typemap(in) svn_merge_range_inheritance_t): New typemap.
> 
> * subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c,
>   subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h
>   (svn_swig_rb_to_merge_range_inheritance): New conversion function.
> 
> * subversion\bindings\swig\ruby\svn\core.rb
>   (Svn::Core::MergeInfo#diff, Svn::Core::MergeInfo#merge,
>   Svn::Core::RangeList#diff, Svn::Core::RangeList#merge,
>   Svn::Core::RangeList#remove) each got a new argument consider_inheritance
>   which is defaulted to nil.
> 
> * subversion\bindings\swig\ruby\test\test_core.rb
>   (SvnCoreTest#test_merge_info_to_s)
> 
> ]]]

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Ruby bindings follow on to r26229

Posted by Joe Swatosh <jo...@gmail.com>.
Hi,

Second try.

On 8/24/07, Kouhei Sutou <ko...@cozmixng.org> wrote:
> Hi,
>
> In <ae...@mail.gmail.com>
>  "Re: [PATCH] Ruby bindings follow on to r26229" on Thu, 23 Aug 2007 21:57:54 -0700,
>  "Joe Swatosh" <jo...@gmail.com> wrote:
>
> > > >

> >
> > I have no idea how to do this.  I'm interested to see how you accomplish it.
>
> Here is my idea (not tested):


> And here is my feature idea (pseudo code):
>

Ah, pretty obvious once you spelled it out for me.  I took what you presented
here and implemented it more like svn_depth_t.  Here we go:

[[[

Follow on to r26229 which added support for non-inheritable mergeinfo revision
ranges.

* subversion\bindings\swig\core.i
  (svn_swig_rb_mergeinfo_merge and svn_swig_rb_rangelist_merge): added new
  svn_merge_range_inheritance_t argument and forwarded to svn_mergeinfo_merge
  and svn_rangelist_merge respectively.

* subversion/bindings/swig/include/svn_types.swg
  (%typemap(in) svn_merge_range_inheritance_t): New typemap.

* subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c,
  subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h
  (svn_swig_rb_to_merge_range_inheritance): New conversion function.

* subversion\bindings\swig\ruby\svn\core.rb
  (Svn::Core::MergeInfo#diff, Svn::Core::MergeInfo#merge,
  Svn::Core::RangeList#diff, Svn::Core::RangeList#merge,
  Svn::Core::RangeList#remove) each got a new argument consider_inheritance
  which is defaulted to nil.

* subversion\bindings\swig\ruby\test\test_core.rb
  (SvnCoreTest#test_merge_info_to_s)

]]]

--
Joe

Re: [PATCH] Ruby bindings follow on to r26229

Posted by Kouhei Sutou <ko...@cozmixng.org>.
Hi,

In <ae...@mail.gmail.com>
  "Re: [PATCH] Ruby bindings follow on to r26229" on Thu, 23 Aug 2007 21:57:54 -0700,
  "Joe Swatosh" <jo...@gmail.com> wrote:

> > > Index: subversion/bindings/swig/ruby/svn/core.rb
> > > ===================================================================
> > > --- subversion/bindings/swig/ruby/svn/core.rb (revision 26229)
> > > +++ subversion/bindings/swig/ruby/svn/core.rb (working copy)
> > > @@ -624,14 +624,16 @@
> > >          end
> > >        end
> > >
> > > -      def diff(to)
> > > -        Core.mergeinfo_diff(self, to).collect do |result|
> > > +      def diff(to, consider_inheritance=nil)
> > > +        consider_inheritance ||= RANGELIST_IGNORE_INHERITANCE
> > > +        Core.mergeinfo_diff(self, to, consider_inheritance).collect do |result|
> >
> > I think we can use svn_depth_t like approach: We can set
> > default value by SWIG not Ruby. %typemap(in) svn_depth_t
> > typemap in include/svn_types.swg will help you.
> >
> > In the feature, I want to support another way to specify
> > constant value. Currently, we use SOME_CONSTANT
> > (e.g. RANGELIST_IGNORE_INHERITANCE) to specify constant
> > value but I want to support :constant_name
> > (e.g. :inheritance). I think we can do this in SWIG layer.
> >
> 
> I have no idea how to do this.  I'm interested to see how you accomplish it.

Here is my idea (not tested):

#ifdef SWIGRUBY
%typemap(in) svn_merge_range_inheritance_t {
  if (NIL_P($input)) {
    $1 = svn_rangelist_ignore_inheritance;
  else {
    $1 = NUM2INT($input);
  }
}
#endif

And here is my feature idea (pseudo code):

#ifdef SWIGRUBY
%typemap(in) svn_merge_range_inheritance_t {
  if (NIL_P($input)) {
    $1 = svn_rangelist_ignore_inheritance;
  else if (RTEST(rb_obj_is_kind_of($input, rb_cNumeric))) {
    $1 = NUM2INT($input);
  } else {
    VALUE const_name;
    const_name = rb_str_new2("RANGELIST_");
    rb_str_concat(const_name,
                  rb_funcall(rb_funcall($input, rb_intern("to_s"), 0),
                             rb_intern("upcase"), 0));
    $1 = rb_const_get(cSvnCore, rb_intern(StringValuePtr(rb_str_concat)));
  }
}
#endif


> >
> > > Index: subversion/bindings/swig/ruby/test/test_core.rb
> > > ===================================================================
> > > --- subversion/bindings/swig/ruby/test/test_core.rb   (revision 26229)
> > > +++ subversion/bindings/swig/ruby/test/test_core.rb   (working copy)
> > > @@ -746,7 +746,7 @@
> > >
> > >    def test_merge_info_to_s
> > >      info = Svn::Core::MergeInfo.parse("/trunk: 5,7,9-13")
> > > -    assert_equal("/trunk:5,7,9-13", info.to_s)
> > > +    assert_equal("/trunk:5*,7*,9-13*", info.to_s)
> > >      assert_not_equal("/trunk:5,7,9-13", info.inspect)
> >
> > Does we need to update the above assert_not_equal line too?
> >
> 
> What are we asserting?  Should the line be
> 
>   assert_not_equal(info.to_s, info.inspect)
> 
> perhaps?

Ah, yes. You're right. I customized to_s and inspect.


Thanks,
--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Ruby bindings follow on to r26229

Posted by Joe Swatosh <jo...@gmail.com>.
Hi kou,

On 8/23/07, Kouhei Sutou <ko...@cozmixng.org> wrote:
> Hi,
>
> In <ae...@mail.gmail.com>
>  "[PATCH] Ruby bindings follow on to r26229" on Wed, 22 Aug 2007 22:52:09 -0700,
>  "Joe Swatosh" <jo...@gmail.com> wrote:
>
> > [[[
> > Follow on to r26229 which added support for non-inheritable
> > mergeinfo revision ranges.
> >
> > * subversion\bindings\swig\core.i
> >   (svn_swig_rb_mergeinfo_merge and svn_swig_rb_rangelist_merge)
> >   added new svn_merge_range_inheritance_t argument and forwarded to
> >   svn_mergeinfo_merge and svn_rangelist_merge respectively
> >
> > * subversion\bindings\swig\ruby\svn\core.rb
> >   (Svn::Core::MergeInfo#diff, Svn::Core::MergeInfo#merge,
> >   Svn::Core::RangeList#diff, Svn::Core::RangeList#merge,
> >   Svn::Core::RangeList#remove) each got a new argument consider_inheritance
> >   which is defaulted to RANGELIST_IGNORE_INHERITANCE.
> >
> > * subversion\bindings\swig\ruby\test\test_core.rb
> >  (SvnCoreTest#test_merge_info_to_s) now has to include the 'non-inheritable'
> >   suffix.
> > ]]]
>
>
> > Index: subversion/bindings/swig/ruby/svn/core.rb
> > ===================================================================
> > --- subversion/bindings/swig/ruby/svn/core.rb (revision 26229)
> > +++ subversion/bindings/swig/ruby/svn/core.rb (working copy)
> > @@ -624,14 +624,16 @@
> >          end
> >        end
> >
> > -      def diff(to)
> > -        Core.mergeinfo_diff(self, to).collect do |result|
> > +      def diff(to, consider_inheritance=nil)
> > +        consider_inheritance ||= RANGELIST_IGNORE_INHERITANCE
> > +        Core.mergeinfo_diff(self, to, consider_inheritance).collect do |result|
>
> I think we can use svn_depth_t like approach: We can set
> default value by SWIG not Ruby. %typemap(in) svn_depth_t
> typemap in include/svn_types.swg will help you.
>
> In the feature, I want to support another way to specify
> constant value. Currently, we use SOME_CONSTANT
> (e.g. RANGELIST_IGNORE_INHERITANCE) to specify constant
> value but I want to support :constant_name
> (e.g. :inheritance). I think we can do this in SWIG layer.
>

I have no idea how to do this.  I'm interested to see how you accomplish it.

>
> > Index: subversion/bindings/swig/ruby/test/test_core.rb
> > ===================================================================
> > --- subversion/bindings/swig/ruby/test/test_core.rb   (revision 26229)
> > +++ subversion/bindings/swig/ruby/test/test_core.rb   (working copy)
> > @@ -746,7 +746,7 @@
> >
> >    def test_merge_info_to_s
> >      info = Svn::Core::MergeInfo.parse("/trunk: 5,7,9-13")
> > -    assert_equal("/trunk:5,7,9-13", info.to_s)
> > +    assert_equal("/trunk:5*,7*,9-13*", info.to_s)
> >      assert_not_equal("/trunk:5,7,9-13", info.inspect)
>
> Does we need to update the above assert_not_equal line too?
>

What are we asserting?  Should the line be

  assert_not_equal(info.to_s, info.inspect)

perhaps?

--
Joe

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Ruby bindings follow on to r26229

Posted by Kouhei Sutou <ko...@cozmixng.org>.
Hi,

In <ae...@mail.gmail.com>
  "[PATCH] Ruby bindings follow on to r26229" on Wed, 22 Aug 2007 22:52:09 -0700,
  "Joe Swatosh" <jo...@gmail.com> wrote:

> [[[
> Follow on to r26229 which added support for non-inheritable
> mergeinfo revision ranges.
> 
> * subversion\bindings\swig\core.i
>   (svn_swig_rb_mergeinfo_merge and svn_swig_rb_rangelist_merge)
>   added new svn_merge_range_inheritance_t argument and forwarded to
>   svn_mergeinfo_merge and svn_rangelist_merge respectively
> 
> * subversion\bindings\swig\ruby\svn\core.rb
>   (Svn::Core::MergeInfo#diff, Svn::Core::MergeInfo#merge,
>   Svn::Core::RangeList#diff, Svn::Core::RangeList#merge,
>   Svn::Core::RangeList#remove) each got a new argument consider_inheritance
>   which is defaulted to RANGELIST_IGNORE_INHERITANCE.
> 
> * subversion\bindings\swig\ruby\test\test_core.rb
>  (SvnCoreTest#test_merge_info_to_s) now has to include the 'non-inheritable'
>   suffix.
> ]]]


> Index: subversion/bindings/swig/ruby/svn/core.rb
> ===================================================================
> --- subversion/bindings/swig/ruby/svn/core.rb	(revision 26229)
> +++ subversion/bindings/swig/ruby/svn/core.rb	(working copy)
> @@ -624,14 +624,16 @@
>          end
>        end
>  
> -      def diff(to)
> -        Core.mergeinfo_diff(self, to).collect do |result|
> +      def diff(to, consider_inheritance=nil)
> +        consider_inheritance ||= RANGELIST_IGNORE_INHERITANCE
> +        Core.mergeinfo_diff(self, to, consider_inheritance).collect do |result|

I think we can use svn_depth_t like approach: We can set
default value by SWIG not Ruby. %typemap(in) svn_depth_t
typemap in include/svn_types.swg will help you.

In the feature, I want to support another way to specify
constant value. Currently, we use SOME_CONSTANT
(e.g. RANGELIST_IGNORE_INHERITANCE) to specify constant
value but I want to support :constant_name
(e.g. :inheritance). I think we can do this in SWIG layer.


> Index: subversion/bindings/swig/ruby/test/test_core.rb
> ===================================================================
> --- subversion/bindings/swig/ruby/test/test_core.rb	(revision 26229)
> +++ subversion/bindings/swig/ruby/test/test_core.rb	(working copy)
> @@ -746,7 +746,7 @@
>  
>    def test_merge_info_to_s
>      info = Svn::Core::MergeInfo.parse("/trunk: 5,7,9-13")
> -    assert_equal("/trunk:5,7,9-13", info.to_s)
> +    assert_equal("/trunk:5*,7*,9-13*", info.to_s)
>      assert_not_equal("/trunk:5,7,9-13", info.inspect)

Does we need to update the above assert_not_equal line too?


Thanks,
--
kou

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org