Uploaded image for project: 'Subversion'
  1. Subversion
  2. SVN-2342

Python bindings need support for svn_client_ctx_t callbacks

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.x
    • unscheduled
    • bindings_swig_python
    • None

    Description

      The following python code fails dramatically at the arrow:
      -------------- 
      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, 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) 
      ---------------
      
      The error message is:
      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 pointer
      

      Original issue reported by chaosopher

      Attachments

        1. 1_2342.patch
          0.8 kB
          Subversion Importer

        Activity

          People

            Unassigned Unassigned
            subversion-importer Subversion Importer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: