nicely done
On Tue, 20 Sep 2005, clkao@tigris.org wrote:
> Author: clkao
> Date: Tue Sep 20 06:26:06 2005
> New Revision: 16168
>
> Added:
> trunk/subversion/bindings/swig/perl/native/t/5delta-compat.t
> - copied unchanged from r10441, /trunk/subversion/bindings/swig/perl/native/t/5delta.t
> Modified:
> trunk/subversion/bindings/swig/perl/native/Delta.pm
> trunk/subversion/bindings/swig/perl/native/t/5delta.t
>
> Log:
> Add the compatibiltiy layer in SVN::TxDelta::apply for the old API usage.
>
> * native/Delta.pm:
> (TxDelta::apply): Don't just use the plainly wrapped one, but
> inspect @_ first.
>
> * native/t/5delta.t: New.
>
> * native/t/5delta-compat.t: Copied from 5delta.t.
>
>
> Modified: trunk/subversion/bindings/swig/perl/native/Delta.pm
> Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/bindings/swig/perl/native/Delta.pm?rev=16168&p1=trunk/subversion/bindings/swig/perl/native/Delta.pm&p2=trunk/subversion/bindings/swig/perl/native/Delta.pm&r1=16167&r2=16168
> ==============================================================================
> --- trunk/subversion/bindings/swig/perl/native/Delta.pm (original)
> +++ trunk/subversion/bindings/swig/perl/native/Delta.pm Tue Sep 20 06:26:06 2005
> @@ -95,9 +95,23 @@
> =cut
>
> package SVN::TxDelta;
> -use SVN::Base qw(Delta svn_txdelta_);
> +use SVN::Base qw(Delta svn_txdelta_ apply);
>
> *new = *SVN::_Delta::svn_txdelta;
> +
> +# special case for backward compatibility. When called with an additional
> +# argument "md5", it's the old style and don't return the md5.
> +# Note that since the returned m5 is to be populated upon the last window
> +# sent to the handler, it's not currently working to magically change things
> +# in Perl land.
> +sub apply {
> + if (@_ == 5 || (@_ == 4 && ref($_[-1]) ne 'SVN::Pool' && ref($_[-1]) ne '_p_apr_pool_t')) {
> + splice(@_, 3, 1);
> + my @ret = SVN::_Delta::svn_txdelta_apply(@_);
> + return @ret[1,2];
> + }
> + goto &SVN::_Delta::svn_txdelta_apply;
> +}
>
> package _p_svn_txdelta_op_t;
> use SVN::Base qw(Delta svn_txdelta_op_t_);
>
> Modified: trunk/subversion/bindings/swig/perl/native/t/5delta.t
> Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/bindings/swig/perl/native/t/5delta.t?rev=16168&p1=trunk/subversion/bindings/swig/perl/native/t/5delta.t&p2=trunk/subversion/bindings/swig/perl/native/t/5delta.t&r1=16167&r2=16168
> ==============================================================================
> --- trunk/subversion/bindings/swig/perl/native/t/5delta.t (original)
> +++ trunk/subversion/bindings/swig/perl/native/t/5delta.t Tue Sep 20 06:26:06 2005
> @@ -1,6 +1,6 @@
> #!/usr/bin/perl
> use strict;
> -use Test::More tests => 2;
> +use Test::More tests => 3;
> require SVN::Core;
> require SVN::Delta;
>
> @@ -14,9 +14,13 @@
>
> isa_ok ($txstream, '_p_svn_txdelta_stream_t');
> open my $asource, '<', \$srctext;
> -my $handle = [SVN::TxDelta::apply ($asource, $aresult, undef, undef)];
> +my ($md5, @handle) = SVN::TxDelta::apply ($asource, $aresult, undef);
>
> -SVN::TxDelta::send_txstream ($txstream, @$handle);
> +SVN::TxDelta::send_txstream ($txstream, @handle);
>
> is ($result, $tgttext, 'delta self test');
>
> +TODO: {
> +local $TODO = 'md5 to be populated.';
> +is($md5, 'a22b3dadcbddac48d2f1eae3ec5fb86a', 'md5 matched');
> +}
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Sep 20 21:01:30 2005