Author: breser
Date: Tue Oct 16 18:23:22 2012
New Revision: 1398913
URL: http://svn.apache.org/viewvc?rev=1398913&view=rev
Log:
swig-pl: Add support and tests for mkdir2, mkdir3, and mkdir4.
This will actually probably make all of the commit functions added in 1.7 with
commit callbacks work, but I haven't specifically tested them and they may have
other issues. Those tests will be forthcoming in a future commit.
* subversion/bindings/swig/include/svn_types.swg
(svn_commit_callback2_t): Add typemaps for both the callback function and
baton tuple used in the RA/Repos and the Client library.
* subversion/bindings/swig/perl/native/t/3client.t
(mkdir2, mkdir3, mkdir4): Add tests for these functions.
(update): Adjust the mkdir ahead of the update test to avoid conflict.
* subversion/bindings/swig/perl/native/Core.pm
(svn_commit_info_t): Add package for and documentation.
* subversion/bindings/swig/perl/native/Client.pm
(@_all_fns): Add mkdir4.
(mkdir): Adjust documentation to reference mkdir2.
(mkdir2,mkdir3): Add documentation.
(mkdir4): Steal the original mkdir documentation and adjust it to apply.
* subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c
subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h
(svn_swig_pl_thunk_commit_callback2): New thunk.
Modified:
subversion/trunk/subversion/bindings/swig/include/svn_types.swg
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/Core.pm
subversion/trunk/subversion/bindings/swig/perl/native/t/3client.t
Modified: subversion/trunk/subversion/bindings/swig/include/svn_types.swg
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_types.swg?rev=1398913&r1=1398912&r2=1398913&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/svn_types.swg (original)
+++ subversion/trunk/subversion/bindings/swig/include/svn_types.swg Tue Oct 16
18:23:22 2012
@@ -795,6 +795,14 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
svn_repos_get_commit_editor4()
*/
+#ifdef SWIGPERL
+%typemap(in) (svn_commit_callback2_t callback, void *callback_baton) {
+ $1 = svn_swig_pl_thunk_commit_callback2;
+ $2 = (void *)$input;
+ svn_swig_pl_hold_ref_in_pool (_global_pool, $input);
+};
+#endif
+
#ifdef SWIGRUBY
%typemap(in) (svn_commit_callback2_t callback, void *callback_baton)
{
@@ -817,6 +825,29 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
#endif
/* -----------------------------------------------------------------------
+ Callback: svn_commit_callback2_t
+ svn_client_mkdir4()
+ svn_client_delete4()
+ svn_client_import4()
+ svn_client_commit5()
+ svn_client_copy6()
+ svn_client_move6()
+ svn_client_propset_remote()
+
+ A separate typemap is needed here because we used different variable names
+ in the client library functions than we used in the ra/repos library
+ functions.
+*/
+
+#ifdef SWIGPERL
+%typemap(in) (svn_commit_callback2_t commit_callback, void *commit_baton) {
+ $1 = svn_swig_pl_thunk_commit_callback2;
+ $2 = (void *)$input;
+ svn_swig_pl_hold_ref_in_pool (_global_pool, $input);
+};
+#endif
+
+/* -----------------------------------------------------------------------
Callback: svn_cancel_func_t
*/
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=1398913&r1=1398912&r2=1398913&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
Tue Oct 16 18:23:22 2012
@@ -919,6 +919,22 @@ svn_error_t *svn_swig_pl_thunk_commit_ca
return SVN_NO_ERROR;
}
+svn_error_t *svn_swig_pl_thunk_commit_callback2(const svn_commit_info_t
*commit_info,
+ void *baton,
+ apr_pool_t *pool)
+{
+ if (!SvOK((SV *)baton))
+ return SVN_NO_ERROR;
+
+ svn_swig_pl_callback_thunk(CALL_SV, baton, NULL,
+ "SS",
+ commit_info, _SWIG_TYPE("svn_commit_info_t *"),
+ pool, POOLINFO);
+
+ return SVN_NO_ERROR;
+}
+
+
/* Wrap RA */
static svn_error_t * thunk_open_tmp_file(apr_file_t **fp,
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=1398913&r1=1398912&r2=1398913&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
Tue Oct 16 18:23:22 2012
@@ -127,6 +127,11 @@ svn_error_t *svn_swig_pl_thunk_commit_ca
const char *author,
void *baton);
+/* thunked commit editor callback2. */
+svn_error_t *svn_swig_pl_thunk_commit_callback2(const svn_commit_info_t
*commit_info,
+ void *baton,
+ apr_pool_t *pool);
+
/* thunked repos_history callback. */
svn_error_t *svn_swig_pl_thunk_history_func(void *baton,
const char *path,
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=1398913&r1=1398912&r2=1398913&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/perl/native/Client.pm (original)
+++ subversion/trunk/subversion/bindings/swig/perl/native/Client.pm Tue Oct 16
18:23:22 2012
@@ -10,7 +10,7 @@ BEGIN {
@_all_fns =
qw( version diff_summarize_dup create_context checkout3
checkout2 checkout update4 update3 update2 update switch2 switch
- add4 add3 add2 add mkdir3 mkdir2 mkdir delete3 delete2
+ add4 add3 add2 add mkdir4 mkdir3 mkdir2 mkdir delete3 delete2
delete import3 import2 import commit4 commit3 commit2
commit status4 status3 status2 status log4 log3 log2 log blame4
blame3 blame2 blame diff4 diff3 diff2 diff diff_peg4
@@ -628,6 +628,21 @@ Has no return.
=item $ctx-E<gt>mkdir($targets, $pool);
+Similar to $ctx-E<gt>mkdir2() except it returns an svn_client_commit_info_t
+object instead of a svn_commit_info_t object.
+
+=item $ctx-E<gt>mkdir2($targets, $pool);
+
+Similar to $ctx-E<gt>mkdir3(), but with $make_parents always FALSE, and
+$revprop_hash always undef.
+
+=item $ctx-E<gt>mkdir3($targets, $make_parents, $revprop_hash, $pool);
+
+Similar to $ctx-E<gt>mkdir4(), but returns a svn_commit_info_t object rather
+than through a callback function.
+
+=item $ctx-E<gt>mkdir4($targets, $make_parents, $revprop_hash,
\&commit_callback, $pool);
+
Create a directory, either in a repository or a working copy.
If $targets contains URLs, immediately attempts to commit the creation of the
@@ -637,10 +652,23 @@ object.
Else, create the directories on disk, and attempt to schedule them for
addition.
In this case returns undef.
+If $make_parents is TRUE, create any non-existant parent directories also.
+
+If not undef, $revprop_hash is a reference to a hash table holding additional
+custom revision properites (property names mapped to strings) to be set on the
+new revision in the event that this is a committing operation. This hash
+cannot contain any standard Subversion properties.
+
+Calls the log message callback to query for a commit log message when one is
+needed.
+
Calls the notify callback when the directory has been created (successfully)
in the working copy, with the path of the new directory. Note this is only
called for items added to the working copy.
+If \&commit_callback is not undef, then for each successful commit, call
+\&commit_callback with the svn_commit_info_t object for the commit.
+
=item $ctx-E<gt>move($src_path, $src_revision, $dst_path, $force, $pool);
Move $src_path to $dst_path.
Modified: subversion/trunk/subversion/bindings/swig/perl/native/Core.pm
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/perl/native/Core.pm?rev=1398913&r1=1398912&r2=1398913&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/perl/native/Core.pm (original)
+++ subversion/trunk/subversion/bindings/swig/perl/native/Core.pm Tue Oct 16
18:23:22 2012
@@ -823,6 +823,37 @@ Author of created rev.
=cut
+package _p_svn_commit_info_t;
+use SVN::Base qw(Core svn_commit_info_t_);
+
+=head2 svn_commit_info_t
+
+=over 4
+
+=item $commit-E<gt>revision()
+
+Just committed revision.
+
+=item $commit-E<gt>date()
+
+Server-side date of the commit.
+
+=item $commit-E<gt>author()
+
+Author of the commit.
+
+=item $commit-E<gt>post_commit_err()
+
+Error message from the post-commit hook, or undef.
+
+=item $commit-E<gt>repos_root()
+
+Repoistory root, may be undef if unknown.
+
+=back
+
+=cut
+
package _p_svn_auth_cred_simple_t;
use SVN::Base qw(Core svn_auth_cred_simple_t_);
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=1398913&r1=1398912&r2=1398913&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/perl/native/t/3client.t (original)
+++ subversion/trunk/subversion/bindings/swig/perl/native/t/3client.t Tue Oct
16 18:23:22 2012
@@ -20,7 +20,7 @@
#
#
-use Test::More tests => 211;
+use Test::More tests => 221;
use strict;
# shut up about variables that are only used once.
@@ -101,6 +101,43 @@ $current_rev++;
# TEST
is($ci_dir1->revision,$current_rev,"commit info revision equals $current_rev");
+my ($ci_dir2) = $ctx->mkdir2(["$reposurl/dir2"]);
+# TEST
+isa_ok($ci_dir2,'_p_svn_commit_info_t');
+$current_rev++;
+# TEST
+is($ci_dir2->revision,$current_rev,"commit info revision equals $current_rev");
+
+my ($ci_dir3) = $ctx->mkdir3(["$reposurl/dir3"],0,undef);
+# TEST
+isa_ok($ci_dir3,'_p_svn_commit_info_t');
+$current_rev++;
+# TEST
+is($ci_dir3->revision,$current_rev,"commit info revision equals $current_rev");
+
+# TEST
+is($ctx->mkdir4(["$reposurl/dir4"],0,undef,sub {
+ my ($commit_info) = @_;
+
+ # TEST
+ isa_ok($commit_info,'_p_svn_commit_info_t','commit_info type check');
+
+ # TEST
+ is($commit_info->revision(),$current_rev + 1, 'commit info revision');
+
+ # TEST
+ like($commit_info->date(),
+ qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z$/,
+ 'commit info date');
+
+ # TEST
+ is($commit_info->post_commit_err(),undef,'commit info
post_commit_error');
+
+ # TEST
+ is($commit_info->repos_root(),$reposurl,'commit info repos_root');
+ }),
+ undef,'Returned undef from mkdir4 operation.');
+$current_rev++;
my ($rpgval,$rpgrev) = $ctx->revprop_get('svn:author',$reposurl,$current_rev);
@@ -736,13 +773,13 @@ isa_ok($plh,'HASH',
is_deeply($plh, {'perl-test' => 'test-val'}, 'test prop list prop_hash
values');
# add a dir to test update
-my ($ci_dir2) = $ctx->mkdir(["$reposurl/dir2"]);
+my ($ci_dir5) = $ctx->mkdir(["$reposurl/dir5"]);
# TEST
-isa_ok($ci_dir2,'_p_svn_client_commit_info_t',
+isa_ok($ci_dir5,'_p_svn_client_commit_info_t',
'mkdir returns a _p_svn_client_commit_info_t');
$current_rev++;
# TEST
-is($ci_dir2->revision(),$current_rev,
+is($ci_dir5->revision(),$current_rev,
"commit info revision equals $current_rev");
# Use explicit revnum to test that instead of just HEAD.