You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2012/09/29 02:45:10 UTC

svn commit: r1391707 - in /subversion/trunk/subversion/bindings/swig: perl/libsvn_swig_perl/swigutil_pl.c perl/libsvn_swig_perl/swigutil_pl.h perl/native/Client.pm perl/native/t/3client.t svn_wc.i

Author: breser
Date: Sat Sep 29 00:45:10 2012
New Revision: 1391707

URL: http://svn.apache.org/viewvc?rev=1391707&view=rev
Log:
Add status4 to swig-pl.

* subversion/bindings/swig/svn_wc.i
  (svn_wc_status_func3_t): Provide perl callback typemap.

* subversion/bindings/swig/perl/native/t/3client.t
  (status4): Add tests for this function.

* subversion/bindings/swig/perl/native/Client.pm
  (@_all_fns): Add status4 to the list of imported functions.
  (status3): Adjust documentation to just reference status4.
  (status4): Add documentation for status4.

* subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c
  subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h
  (svn_swig_pl_status_func3): Add thunk function.


Modified:
    subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c
    subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h
    subversion/trunk/subversion/bindings/swig/perl/native/Client.pm
    subversion/trunk/subversion/bindings/swig/perl/native/t/3client.t
    subversion/trunk/subversion/bindings/swig/svn_wc.i

Modified: subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c?rev=1391707&r1=1391706&r2=1391707&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c (original)
+++ subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c Sat Sep 29 00:45:10 2012
@@ -1304,6 +1304,38 @@ void svn_swig_pl_status_func2(void *bato
 
 }
 
+/* Thunked version of svn_wc_status_func2_t callback type. */
+svn_error_t *svn_swig_pl_status_func3(void *baton,
+                                      const char *path,
+                                      svn_wc_status2_t *status,
+                                      apr_pool_t *pool)
+{
+  SV *result;
+  svn_error_t *ret_val = SVN_NO_ERROR;
+
+  swig_type_info *statusinfo = _SWIG_TYPE("svn_wc_status2 _t *");
+
+  if (!SvOK((SV *)baton)) {
+    return;
+  }
+
+  svn_swig_pl_callback_thunk(CALL_SV, baton, &result, "sSS",
+                             path, status, statusinfo,
+                             pool, POOLINFO);
+
+  if (sv_derived_from(result, "_p_svn_error_t")) {
+    swig_type_info *errorinfo = _SWIG_TYPE("svn_error_t *");
+    if (SWIG_ConvertPtr(result, (void *)&ret_val, errorinfo, 0) < 0) {
+        SvREFCNT_dec(result);
+        croak("Unable to convert from SWIG Type");
+    }
+  }
+
+  SvREFCNT_dec(result);
+  return ret_val;
+}
+
+
 /* Thunked version of svn_client_blame_receiver_t callback type. */
 svn_error_t *svn_swig_pl_blame_func(void *baton,
                                     apr_int64_t line_no,

Modified: subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h?rev=1391707&r1=1391706&r2=1391707&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h (original)
+++ subversion/trunk/subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h Sat Sep 29 00:45:10 2012
@@ -235,6 +235,12 @@ void svn_swig_pl_status_func2(void *bato
                               const char *path,
                               svn_wc_status2_t *status);
 
+/* Thunked version of svn_wc_status_func2_t callback type. */
+svn_error_t *svn_swig_pl_status_func3(void *baton,
+                                      const char *path,
+                                      svn_wc_status2_t *status,
+                                      apr_pool_t *pool);
+
 /* Thunked version of svn_client_blame_receiver_t callback type. */
 svn_error_t *svn_swig_pl_blame_func(void *baton,
                                     apr_int64_t line_no,

Modified: subversion/trunk/subversion/bindings/swig/perl/native/Client.pm
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/perl/native/Client.pm?rev=1391707&r1=1391706&r2=1391707&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/perl/native/Client.pm (original)
+++ subversion/trunk/subversion/bindings/swig/perl/native/Client.pm Sat Sep 29 00:45:10 2012
@@ -12,7 +12,7 @@ BEGIN {
             checkout2 checkout update3 update2 update switch2 switch
             add4 add3 add2 add mkdir3 mkdir2 mkdir delete3 delete2
             delete import3 import2 import commit4 commit3 commit2
-            commit status3 status2 status log4 log3 log2 log blame4
+            commit status4 status3 status2 status log4 log3 log2 log blame4
             blame3 blame2 blame diff4 diff3 diff2 diff diff_peg4
             diff_peg3 diff_peg2 diff_peg diff_summarize2
             diff_summarize diff_summarize_peg2 diff_summarize_peg
@@ -740,6 +740,10 @@ Similar to $ctx-E<gt>status3(), but with
 
 =item $ctx-E<gt>status3($path, $revision, \&status_func, $depth, $get_all, $update, $no_ignore, $ignore_externals, $changelists, $pool);
 
+Similar to $ctx-E<gt>status4(), without the pool parameter to the callback and the return of the callback is ignored. 
+
+=item $ctx-E<gt>status4($path, $revision, \&status_func, $depth, $get_all, $update, $no_ignore, $ignore_externals, $changelists, $pool);
+
 Given $path to a working copy directory (or single file), call status_func()
 with a set of svn_wc_status2_t objects which describe the status of $path and
 its children.
@@ -763,12 +767,14 @@ $SVN::Wc::Notify::Action::status_complet
 $changelists is a reference to an array of changelist names, used as a restrictive filter on items whose statuses are reported; that is don't report status about any item unless it's a member of those changelists.  If changelists is empty (or altogether undef), no changelist filtering occurs.
 
 The status_func subroutine takes the following parameters:
-$path, $status
+$path, $status, $pool
 
 $path is the pathname of the file or directory which status is being
-reported.  $status is a svn_wc_status2_t object.
+reported.  $status is a svn_wc_status2_t object.  $pool is an apr_pool_t
+object which is cleaned beteween invocations to the callback.
 
-The return of the status_func subroutine is ignored.
+The return of the status_func subroutine can be a svn_error_t object created by
+SVN::Error::create in order to propogate an error up.
 
 =item $ctx-E<gt>info($path_or_url, $peg_revision, $revision, \&receiver, $recurse);
 

Modified: subversion/trunk/subversion/bindings/swig/perl/native/t/3client.t
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/perl/native/t/3client.t?rev=1391707&r1=1391706&r2=1391707&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/perl/native/t/3client.t (original)
+++ subversion/trunk/subversion/bindings/swig/perl/native/t/3client.t Sat Sep 29 00:45:10 2012
@@ -20,7 +20,7 @@
 #
 #
 
-use Test::More tests => 167;
+use Test::More tests => 188;
 use strict;
 
 # shut up about variables that are only used once.
@@ -543,6 +543,99 @@ is($ctx->status3($wcpath, undef, sub {
    $SVN::Core::INVALID_REVNUM,
    'status3 returns INVALID_REVNUM when run against a working copy');
 
+# No revnum for the working copy so we should get INVALID_REVNUM
+# TEST
+is($ctx->status4($wcpath, undef, sub {
+                                      my ($path,$wc_status, $pool) = @_;
+                                      # TEST
+                                      is($path,"$wcpath/dir1",
+                                         'path param to status4 callback');
+                                      # TEST
+                                      isa_ok($wc_status,'_p_svn_wc_status2_t',
+                                             'wc_stats param to the status4' .
+                                             ' callback');
+                                      # TEST
+                                      is($wc_status->text_status(),
+                                         $SVN::Wc::Status::normal,
+                                         'text_status param to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->prop_status(),
+                                         $SVN::Wc::Status::modified,
+                                         'prop_status param to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->locked(), 0,
+                                         'locked param to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->copied(), 0,
+                                         'copied param to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->switched(), 0,
+                                         'switched param to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->repos_text_status(),
+                                         $SVN::Wc::Status::none,
+                                         'repos_text_status param to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->repos_prop_status(),
+                                         $SVN::Wc::Status::none,
+                                         'repos_prop_status param to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->repos_lock(), undef,
+                                        'repos_lock param to status4 callback');
+                                      # TEST
+                                      is($wc_status->url(),"$reposurl/dir1",
+                                        'url param to status4 callback');
+                                      # TEST
+                                      is($wc_status->ood_last_cmt_rev(),
+                                         $SVN::Core::INVALID_REVNUM,
+                                         'ood_last_cmt_rev to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->ood_last_cmt_date(), 0,
+                                         'ood_last_cmt_date to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->ood_kind(),
+                                         $SVN::Node::none,
+                                         'ood_kind param to status4 callback');
+                                      # TEST
+                                      is($wc_status->ood_last_cmt_author(),
+                                         undef,
+                                         'ood_last_cmt_author to status4' .
+                                         ' callback');
+                                      # TEST
+                                      is($wc_status->tree_conflict(), undef,
+                                         'tree_conflict to status4 callback');
+                                      # TEST
+                                      is($wc_status->file_external(), 0,
+                                         'file_external to status4 callback');
+                                      # TEST
+                                      is($wc_status->pristine_text_status(),
+                                         $SVN::Wc::Status::normal,
+                                         'pristine_text_status param to' .
+                                         ' status4 callback');
+                                      # TEST
+                                      is($wc_status->pristine_prop_status(),
+                                         $SVN::Wc::Status::modified,
+                                         'pristine_prop_status param to' .
+                                         ' status4 callback');
+                                      # TEST
+                                      isa_ok($pool, '_p_apr_pool_t',
+                                             'pool param to status4' .
+                                             ' callback'); 
+                                    },
+                $SVN::Depth::infinity, 0, 0, 0, 0, undef),
+   $SVN::Core::INVALID_REVNUM,
+   'status4 returns INVALID_REVNUM when run against a working copy');
+
+
 my ($ci_commit2) = $ctx->commit($wcpath,0);
 # TEST
 isa_ok($ci_commit2,'_p_svn_client_commit_info_t',

Modified: subversion/trunk/subversion/bindings/swig/svn_wc.i
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/svn_wc.i?rev=1391707&r1=1391706&r2=1391707&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/svn_wc.i (original)
+++ subversion/trunk/subversion/bindings/swig/svn_wc.i Sat Sep 29 00:45:10 2012
@@ -160,6 +160,13 @@
                   svn_swig_pl_status_func2,
                   svn_swig_rb_wc_status_func)
 
+#ifdef SWIGPERL
+%callback_typemap(svn_wc_status_func3_t status_func, void *status_baton,
+                  ,
+                  svn_swig_pl_status_func3,
+                  ) 
+#endif
+
 #ifndef SWIGPERL
 %callback_typemap(const svn_wc_diff_callbacks2_t *callbacks,
                   void *callback_baton,