I am going through looking into what I can do with the SWIG Python stuff.
I found one thing I can't do.
It seems like it doesn't like functions with arguments of "const char **"
I wrote a test script to verify this for myself. It is at the bottom of this email (I named it
For instance, my output is:
mwhite@big-dog:/storage/code/python# ./py_broke.py /home/svnrepos /trunk
commit date = `_60141a08_p_char`
commit author = `_f0371a08_p_char`
The commit date and authors are human readable strings.
The problem is that the arguments are being returned as "char *" which means nothing to Python.
They should instead be returned back as Python string objects.
The function I am calling in this script is just one of many that currently won't work correctly.
In fact one example of this bug exists in cvs2svn (that's where I got the idea):
conflicts, new_rev = fs.commit_txn(txn)
# set the time to the proper (past) time
fs.change_rev_prop(t_fs, new_rev, 'svn:date', date, c_pool)
### how come conflicts is a newline?
if conflicts != '\n':
print ' CONFLICTS:', `conflicts`
Indeed conflicts should not be a newline. In fact, most of the time it isn't. It is one of those
1) Is this a known bug?
2) I have a fairly simple patch to fix this. It causes "conflicts" in cvs2svn to be an empty
string (as it should be). It also allows the attached test script to print readable dates and
author names. I will post shortly.
# SVN SWIG Python interface test: ...
# How well do we handle C functions with const char ** arguments
from svn import fs, util, repos
def test_this(pool, ctx):
t_repos = repos.svn_repos_open(ctx.repospath, pool)
t_fs = repos.svn_repos_fs(t_repos)
rev = fs.youngest_rev(t_fs, pool)
txn = fs.begin_txn(t_fs, rev, pool)
root = fs.txn_root(txn, pool)
cr, cd, la = repos.svn_repos_get_committed_info(root, ctx.filepath, pool)
print 'commit date = `%s`' % cd
print 'commit author = `%s`' % la
print 'USAGE: %s svn-repos-path repos-file' % os.path.basename(sys.argv)
print ' svn-repos-path - A path to a valid repository'
print ' repos-file - A path to a file in that repository'
# prepare the operation context
ctx = _ctx()
if len(sys.argv) != 3:
ctx.repospath = sys.argv
ctx.filepath = sys.argv
if __name__ == '__main__':
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org
Received on Sat Feb 1 05:15:20 2003