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

Re: FW: python and ctx.log_msg_func

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2005-06-21 07:18:27 CEST

As far as I know, you're out of luck. When the log message function
and baton were moved into the svn_client_ctx_t structure without a
setter function, the "thunk" code which transforms a log message
callback function and baton into a callable Python object was rendered
useless. If only for the good of the Python bindings, I'd like to see
new functions for setting the cancel, notification, and log message
functions and baton.

   void
   svn_client_context_set_log_callback (svn_client_ctx_t *ctx,
                                        svn_client_get_commit_log_t
                                            log_msg_func,
                                        void *baton);

These would *greatly* simplify the work needed to get the bindings
version of the svn_client_ctx_t actually useful.

"Dale Hirt" <dale@sbcltd.com> writes:

> Originally posted to the users list, but since I got no answer, I'm
> posting to the dev list.
>
> Thanks for all your help.
>
> ________________________________
>
> From: Dale Hirt
> Sent: Fri 6/17/2005 2:57 PM
> To: Subversion Users Mailing List (E-mail)
> Subject: FW: python and ctx.log_msg_func
>
>
>
> Ok, I downloaded the 1.2.0 python bindings, and now I'm getting a
> new error. Instead of "TypeError: Type error. Expected
> _svn_client_get_commit_log_t", I'm now getting "TypeError: Expected
> a pointer". Literally the rest of the error message is the same
> though.
>
> Should I be posting this to the dev list instead?
>
> Thanks,
> Dale
>
> -----Original Message-----
> From: Dale Hirt
> Sent: Friday, June 17, 2005 12:04 PM
> To: Subversion Users Mailing List (E-mail)
> Subject: python and ctx.log_msg_func
>
>
> Hi all,
>

> I am having trouble with committing and setting up log messages with
> the Python bindings. So far, I've been cheating and writing to a
> file, then calling the command-line svn with a file arg. However,
> now that I'm setting up via the client API, it seems to be having
> some major issues.
>
> I have attached test code to show you what I'm doing, and the error
> that I'm getting. It errors out on commit_tmpl.commit() when I am
> attempting to assign a log_msg_func. Any and all help is
> appreciated.
>
> Dale
>
>
> Error Message
> ------------------
> Traceback (most recent call last):
> File "testCommit.py", line 44, in ?
> core.run_app(main)
> File "c:\python23\lib\site-packages\svn\core.py", line 33, in run_app
> return apply(func, (pool,) + args, kw)
> File "testCommit.py", line 40, in main
> pc.commit([base_path])
> File "testCommit.py", line 28, in commit
> self.__ctx.log_msg_func = self._commit_msg_func
> File "c:\python23\lib\site-packages\libsvn\client.py", line 134, in <lambda>
> __setattr__ = lambda self, name, value: _swig_setattr(self, svn_client_ctx_t
> , name, value)
> File "c:\python23\lib\site-packages\libsvn\client.py", line 13, in _swig_setat
> tr
> if method: return method(self,value)
> TypeError: Type error. Expected _svn_client_get_commit_log_t
>
> testCommit.py
> --------------
> import os
> import sys
>
> from svn import core, client
>
> def create_client_ctx(pool):
> ctx = client.svn_client_ctx_t()
> providers = []
> providers.append(client.svn_client_get_simple_provider(pool))
> providers.append(client.svn_client_get_username_provider(pool))
> providers.append(client.svn_client_get_ssl_server_trust_file_provider(pool))
> providers.append(client.svn_client_get_ssl_client_cert_file_provider(pool))
> providers.append(client.svn_client_get_ssl_client_cert_pw_file_provider(pool))
> ctx.auth_baton = core.svn_auth_open(providers, pool)
> ctx.config = core.svn_config_get_config(None, pool)
> return ctx
>
> class commit_tmpl:
> def __init__(self, ctx, pool):
> self.__ctx = ctx
> self.__pl = pool
>
> def _commit_msg_func(self, log_msg, tmp_file, commit_items, baton, pool):
> log_msg = ""
> return (log_msg, None)
>
> def commit(self, paths, recurse=True, keep_locks=False):
> self.__ctx.log_msg_func = self._commit_msg_func
> client.commit2(paths, recurse, keep_locks,
> self.__ctx, self.__pl)
>
> def main(pool):
> base_path = "."
>
> ctx = create_client_ctx(pool)
>
> client.svn_client_mkdir(["test"], ctx, pool)
>
> pc = commit_tmpl(ctx, pool)
> pc.commit([base_path])
>
>
> if __name__ == "__main__":
> core.run_app(main)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jun 21 07:20:37 2005

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