Yasuhito FUTATSUKI <futatuki at yf.bsdclub.org>


Patch
r1880967, r1848577, r1848425

r1848425 | cmpilato | 2018-12-07 23:30:19 +0000 (Fri, 07 Dec 2018)

swig-py: allow svn.core.svn_stream_t proxy objects and svn.core.Stream
wrapper objects as input to APIs which consume svn_stream_t *.

* subversion/bindings/swig/include/svn_types.swg
  (%typemap(in) svn_stream_t *WRAPPED_STREAM): Allow
    svn.core.svn_stream_t proxy object for svn_stream_t * in args.
    this typemap is used by _client, _delta, _diff, _fs, _ra, and
    _repos modules.

* subversion/bindings/swig/python/tests/delta.py
  (DeltaTestCase.testTxWindowHandler_stream_IF): New test for
    svn_stream_t * interface wrapper accept svn.core.svn_stream_t
    proxy object.
  (DeltaTestCase.testTxWindowHandler_Stream_IF): New test for
    svn_stream_t * interface wrapper accept svn.core.Stream wrapper
    object.

Patch by: Yasuhito FUTATSUKI <futatuki at yf.bsdclub.org>


r1848577 | cmpilato | 2018-12-10 13:35:07 +0000 (Mon, 10 Dec 2018)

swig-py: Followup to r1848425, moving the bulk of the stream
conversion logic into libsvn_swig_py (instead of having it duplicated
dozens of times in generated code).

* subversion/bindings/swig/include/svn_types.swg
  (%typemap(in) svn_stream_t *WRAPPED_STREAM): Move the logic of
    handling multiple stream-like input types...

* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
  (svn_swig_py_make_stream): ...to here.
  (parse_fn3_set_fulltext): Raise a callback exception if stream
    construction fails.

* subversion/bindings/swig/python/tests/repository.py
  (test_parse_fns3_invalid_set_fulltext): New test.

Patch by: Yasuhito FUTATSUKI <futatuki at yf.bsdclub.org>
          Jun Omae <jun66j5 at gmail.com>
          (Tweaked by me.)


r1880967 | cmpilato | 2020-08-18 14:22:55 +0000 (Tue, 18 Aug 2020)

swig-py: Allow SubversionException to add attributes

A C API function can simultaneously return an error plus additional
non-error information.  But in Python, returning an error (that is,
raising an exception) and returning (as a function return value) other
non-error information are somewhat mutually exclusive.  With this
patch, we introduce a new set of typemaps to allow the bindings code
to attach any non-error information returned from an errorful C API
function as attributes to the raised exception so that callers can
access everything the C API returned.

[in subversion/bindings/swig/]

* include/svn_types.swg
  (typemap(out) svn_error_t * SVN_ERR_WITH_ATTRS,
   typemap(ret) svn_error_t * SVN_ERR_WITH_ATTRS):
    New typemaps to all wrapper functions to use the attributes-on-
    exception-objects feature.  With these typemaps, the argout
    typemaps can use the status code of the subversion error 'apr_err'
    and the exception instance object 'exc_ob'.

* python/libsvn_swig_py/swigutil_py.h, python/libsvn_swig_py/swigutil_py.c
  (svn_swig_py_build_svn_exception): New function, abstracted from...
  (svn_swig_py_svn_exception): ...this, which now uses
    svn_swig_py_build_svn_exception() to build the exception.

* svn_fs.i
  (typemap(argout) (const char **conflict_p, svn_revnum_t *new_rev)):
    Removed.  This reverts the behavor that svn.fs.commit_txn()
    always returns a 2-tuple of which the first item is always None.
  (typemap(argout) (const char **conflict_p)):
    New custom typemap to add the conflict path as an attibute to the
    exception instance.  This applies to svn_fs_merge(),
    svn_fs_commit_txn() and svn_repos_fs_commit_txn().
  (typemap(argout) (svn_revnum_t *new_rev)):
    New custom typemap to add the created revision as an attibute to
    the exception instance.  This applies to svn_fs_commit_txn() and
    svn_repos_fs_commit_txn().
  (): Apply the 'SVN_ERR_WITH_ATTRS' typemap to svn_fs_merge()
    and svn_fs_commit_txn().

* svn_repos.i
  (): Apply the 'SVN_ERR_WITH_ATTRS' typemap to svn_repos_fs_merge().

Patch by: Yasuhito FUTATSUKI <futatuki at yf.bsdclub.org>
          (Tweaked by me.)