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

FW: python and ctx.log_msg_func

From: Dale Hirt <dale_at_sbcltd.com>
Date: 2005-06-21 06:34:46 CEST

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)
Received on Tue Jun 21 06:36:35 2005

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.