[
https://issues.apache.org/jira/browse/SVN-3679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504206#comment-17504206
]
Markus Kuhn edited comment on SVN-3679 at 3/10/22, 11:46 AM:
-------------------------------------------------------------
Please look at the SVN::Ra(3perl) man page very carefully and test the example
given there. The example as given in the man page fails (as of libsvn-perl
1.13.0-3 in Ubuntu 20.04). It still says:
$ra->get_commit_editor($logmsg, $callback, $callback_baton,
$lock_tokens, $keep_locks)
$ra->get_commit_editor2($logmsg, $callback, $callback_baton,
$lock_tokens, $keep_locks)
Return an opaque editor object for committing a new revision to the
repository. The return values should be passed to the
SVN::Delta::Editor constructor to create an editor object you can
actually use. For example:
my $editor = SVN::Delta::Editor->new(
$ra->get_commit_editor(
"I'm going to commit some changes from within my Perl
code.",
\&commit_callback, undef, {}, 0));
[...]
"get_commit_editor2" is identical to "get_commit_editor" except for
the information passed to the callback function. The new version,
added in Subversion 1.4, will pass the callback a single value
(TODO: I can' test this, but it's probably an object or hash ref)
which contains all the information. It also includes the error
message from the post-commit hook script, which is not available
with "get_commit_editor".
This is still a valid a bug report about at least the SVN::Ra man page, which
hasn't been fixed yet. The line from my example script (with parameter
$callback_baton = undef) came directly from the man page, except that I called
get_commit_editor2 instead of get_commit_editor, but according to the man page,
both functions should accept identical parameters. Both fail.
was (Author: mkuhn):
Please look at the SVN::Ra(3perl) man page very carefully, which (as of
libsvn-perl 1.13.0-3 in Ubuntu 20.04) and test the example given there. The
example given in the man page still fails. It still says:
$ra->get_commit_editor($logmsg, $callback, $callback_baton,
$lock_tokens, $keep_locks)
$ra->get_commit_editor2($logmsg, $callback, $callback_baton,
$lock_tokens, $keep_locks)
Return an opaque editor object for committing a new revision to the
repository. The return values should be passed to the
SVN::Delta::Editor constructor to create an editor object you can
actually use. For example:
my $editor = SVN::Delta::Editor->new(
$ra->get_commit_editor(
"I'm going to commit some changes from within my Perl
code.",
\&commit_callback, undef, {}, 0));
[...]
"get_commit_editor2" is identical to "get_commit_editor" except for
the information passed to the callback function. The new version,
added in Subversion 1.4, will pass the callback a single value
(TODO: I can' test this, but it's probably an object or hash ref)
which contains all the information. It also includes the error
message from the post-commit hook script, which is not available
with "get_commit_editor".
This is still a valid a bug report about at least the SVN::Ra man page, which
hasn't been fixed yet. The line from my example script (with parameter
$callback_baton = undef) came directly from the man page, except that I called
get_commit_editor2 instead of get_commit_editor, but according to the man page,
both functions should accept identical parameters. Both fail.
> Perl API SVN::Ra get_commit_editor* functions broken, missing, untested
> -----------------------------------------------------------------------
>
> Key: SVN-3679
> URL: https://issues.apache.org/jira/browse/SVN-3679
> Project: Subversion
> Issue Type: Bug
> Components: bindings_swig_perl
> Affects Versions: 1.6.x
> Reporter: Markus Kuhn
> Priority: Blocker
> Fix For: unscheduled
>
>
> {noformat:nopanel=true}
> The test cases for the Perl API SVN::Ra at
> bindings/swig/perl/native/t/6ra.t
> currently (as of 1.6.12) lack tests for functions needed to commit a change to
> the repository via the remote-access API layer. For starters, there are no
> tests
> for get_commit_editor, get_commit_editor2, get_commit_editor3. (The SVN::Ra
> man
> page even says that the author did not succeed in testing get_commit_editor,
> get_commit_editor2; get_commit_editor3 is not even listed.)
> When I try to use e.g. get_commit_editor2 as suggested in the SVN::Ra
> man page, I just get an error message like
> TypeError in method 'svn_ra_get_commit_editor2', argument 5 of type
> 'svn_commit_callback2_t'
> A short example Perl script that reproduces this is attached below.
> Motivation: The remote-access layer API is very useful for applications (such
> as
> Web CGI editors) that want to commit changes without the overhead and
> disk-state
> involved with having to checkout a working directory first. Perl remains a
> popular CGI scripting language, which makes a well-tested, production-quality
> Perl SWIG binding for svn_ra.h highly desirable.
> See also:
> http://mail-archives.apache.org/mod_mbox/subversion-users/201007.mbox/browser
> http://svn.haxx.se/dev/archive-2010-07/0272.shtml
> How to reproduce TypeError:
> #!/usr/bin/perl
> use SVN::Core;
> use SVN::Ra;
> use SVN::Delta;
> my $ra = SVN::Ra->new('http://svn.apache.org/repos/asf/subversion/');
> my $path = 'trunk/BUGS';
> open($fh, '>', \$text) || die;
> my ($revnum, $props) = $ra->get_file($path, $SVN::Core::INVALID_REVNUM, $fh);
> close $fh || die;
> print "Revision: $revnum\n\n$text\n";
> my $logmsg = "test commit via the SVN:Ra Perl API";
> sub commit_callback {
> my ($arg) = @_;
> use Data::Dumper;
> print STDERR "commit_callback(".Dumper($arg).")\n";
> }
> my $editor = SVN::Delta::Editor->new(
> $ra->get_commit_editor2($logmsg, \&commit_callback, undef, {}, 0));
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)