[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Allow "cease invocation" return from Python callback for repos.svn_repos_history2()

From: Роман Донченко <DXDragon_at_yandex.ru>
Date: Thu, 18 Mar 2010 02:59:34 +0300

Alexey Neyman <stilor_at_att.net> писал в своём письме Wed, 17 Mar 2010
00:05:01 +0300:

> Hi all,
>
> The svn_repos_history2() function allows the history_func() to return a
> special error, SVN_ERR_CEASE_INVOCATION, to stop the search. This is not
> supported in Python bindings, though: attempt to return
> core.SVN_ERR_CEASE_INVOCATION from the history receiver results in an
> exception:
>
> def history_lookup(path, rev, pool):
> return core.SVN_ERR_CEASE_INVOCATION
>
> repos.svn_repos_history2(..., history_lookup, ...)
>
> svn.core.SubversionException: ('Python callback returned an invalid
> object', 20014)
>
> Indeed, svn_swig_py_repos_history_func() only expects a return of None.
> This patch allows the callback to return core.SVN_ERR_CEASE_INVOCATION.
> Currently, this is only used in svn_repos_history2() - apparently, it's
> the only function that supports SVN_ERR_CEASE_INVOCATION. However, there
> is a FIXME at least in copyfrom_info_receiver() in libsvn_client/log.c,
> stating that other callbacks may eventually be able to return
> SVN_ERR_CEASE_INVOCATION as well.

Good idea, but I think that the callback should signal an error the same
way the Subversion functions do it - namely, by throwing
core.SubversionException. The wrapper would then translate the exception's
fields into an svn_error_t. It looks like tweaking
callback_exception_error is the most obvious way to do that. You don't
even have to special-case SVN_ERR_CEASE_INVOCATION, just copy whatever
code the exception had into the error.

It would also be great if you added a relevant test to the testsuite.

Thanks,
Roman.
Received on 2010-03-18 01:15:30 CET

This is an archived mail posted to the Subversion Dev mailing list.