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

python and ctx.log_msg_func

From: Dale Hirt <dale_at_sbcltd.com>
Date: 2005-06-17 21:03:41 CEST

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: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Jun 17 21:05:30 2005

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