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

Re: Learning the Python API - early questions

From: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2003-10-06 19:47:51 CEST

Barry Scott wrote:
> Russ,
>
> That works. Now I'm trying to call svn_client_ls.
>
> files = svn.client.svn_client_ls( url, 0, ctx, pool )
> TypeError: svn_client_ls() takes exactly 5 arguments (4 given)
>
> The 1st in the C API apr_hash_t **dirents. It seems that the SWIG you
> use to get the cfg_config is the same as for dirents so I'm not sure
> why svn_config_get_config is happy to have me ommit the hash as the
> 1st param but svn_client_ls is not.

SWIG is perfectly happy to omit the first argument. The problem is that you
forget one of the middle arguments. The following change will solve your
error:

--- test.py Sun Oct 05 21:45:22 2003
+++ test.py.fix1 Sun Oct 05 21:50:02 2003
@@ -20,7 +20,10 @@

     ctx.config = config

- all_files = svn.client.svn_client_ls( url, 0, ctx, pool )
+ revision = svn.core.svn_opt_revision_t()
+ revision.kind = svn.core.svn_opt_revision_head
+
+ all_files = svn.client.svn_client_ls( url, revision, 0, ctx, pool )
     print repr(all_files)
     print type(all_files)

> I now have this the test code below. I'm expecting that the ctx does
> not have enough fields initialised yet, like password prompting.

You're right. Running the script with the change above causes a NULL pointer
dereference. One more change makes the script work on a public URL:

--- test.py.fix1 Sun Oct 05 21:50:02 2003
+++ test.py.fix2 Sun Oct 05 22:03:27 2003
@@ -18,6 +18,7 @@
     print 'config repr:',repr(config)
     print 'config type:',type(config)

+ ctx.auth_baton = svn.core.svn_auth_open([], pool)
     ctx.config = config

     revision = svn.core.svn_opt_revision_t()

>
> In the case of the dirents I'm guessing that I do want it converted
> to a python dict to all me to process it.

That makes sense, and the current swig code does do the conversion.

- Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Oct 6 19:47:58 2003

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

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