Index: subversion/bindings/swig/python/tests/ra.py =================================================================== --- subversion/bindings/swig/python/tests/ra.py (revision 20293) +++ subversion/bindings/swig/python/tests/ra.py (working copy) @@ -58,7 +58,7 @@ self.assert_(dirents.has_key('README2.txt')) self.assertEqual(dirents['README2.txt'].kind,core.svn_node_file) - def test_commit(self): + def test_commit2(self): def my_callback(info, pool): self.assertEqual(info.revision, fs.youngest_rev(self.fs)) @@ -67,6 +67,15 @@ child = delta.editor_invoke_add_directory(editor, "bla", root, None, 0) delta.editor_invoke_close_edit(editor, edit_baton) + def test_commit(self): + def my_callback(revision, date, author): + self.assertEqual(revision, fs.youngest_rev(self.fs)) + + editor, edit_baton = ra.get_commit_editor(self.ra_ctx, "foobar", my_callback, None, False) + root = delta.editor_invoke_open_root(editor, edit_baton, 4) + child = delta.editor_invoke_add_directory(editor, "blah", root, None, 0) + delta.editor_invoke_close_edit(editor, edit_baton) + def test_get_locations(self): locations = ra.get_locations(self.ra_ctx, "/trunk/README.txt", 2, range(1,5)) self.assertEqual(locations, { Index: subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c =================================================================== --- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (revision 20293) +++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (working copy) @@ -2351,6 +2351,38 @@ return err; } +svn_error_t *svn_swig_py_commit_callback(svn_revnum_t new_revision, + const char *date, + const char *author, + void *baton) +{ + PyObject *receiver = baton; + PyObject *result; + svn_error_t *err = SVN_NO_ERROR; + + if ((receiver == NULL) || (receiver == Py_None)) + return SVN_NO_ERROR; + + svn_swig_py_acquire_py_lock(); + + if ((result = PyObject_CallFunction(receiver, + (char *)"lss", + new_revision, date, author)) == NULL) + { + err = callback_exception_error(); + } + else + { + if (result != Py_None) + err = callback_bad_return_error("Not None"); + Py_DECREF(result); + } + + svn_swig_py_release_py_lock(); + + return err; +} + svn_error_t *svn_swig_py_ra_file_rev_handler_func( void *baton, const char *path, Index: subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h =================================================================== --- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h (revision 20293) +++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h (working copy) @@ -330,6 +330,13 @@ apr_pool_t *pool); SVN_SWIG_SWIGUTIL_EXPORT +svn_error_t *svn_swig_py_commit_callback(svn_revnum_t new_revision, + const char *date, + const char *author, + void *baton); + + +SVN_SWIG_SWIGUTIL_EXPORT svn_error_t *svn_swig_py_ra_file_rev_handler_func( void *baton, const char *path, Index: subversion/bindings/swig/include/svn_types.swg =================================================================== --- subversion/bindings/swig/include/svn_types.swg (revision 20293) +++ subversion/bindings/swig/include/svn_types.swg (working copy) @@ -496,6 +496,14 @@ }; #endif +#ifdef SWIGPYTHON +%typemap(in) (svn_commit_callback_t callback, void *callback_baton) +{ + $1 = svn_swig_py_commit_callback; + $2 = (void *)$input; +} +#endif + /* ----------------------------------------------------------------------- Callback: svn_commit_callback2_t svn_ra get_commit_editor2()