I'm trying to call fs.change_rev_prop2 from Python / SWIG - and apparently can't figure out how to pass old_value_p as what I suppose should be a double pointer from Python.
Example with reduced code:
#!/usr/bin/env python from svn import repos, fs, core fs_ptr = repos.fs(repos.open("/opt/app/svn/repos/test")) rev_num = 1 user = fs.revision_prop(fs_ptr, rev_num, "svn:author")
Error Details # 160049:
Traceback (most recent call last): File "./normalize-usernames.py", line 10, in <module> fs.change_rev_prop2(fs_ptr, rev_num, "svn:author", user, user.lower()) File "/opt/app/subversion/lib/svn-python/libsvn/fs.py", line 711, in svn_fs_change_rev_prop2 return _fs.svn_fs_change_rev_prop2(*args) svn.core.SubversionException: 160049 - revprop 'svn:author' has unexpected value in filesystem
I believe that the meaning I'm trying to convey is "correct." In the end, I get it from the API just before trying to return it. I assume that I just do not pass the value correctly in such a way that the native API can accept it.
Therefore, I could just continue to use change_rev_prop , but it is explicitly marked as deprecated in the API ("Provided for backward compatibility with API 1.6"). Must be able to do better, though ...
Interestingly, calling change_rev_prop2 with None for old_value_p results in the desired change affecting the repository - but without causing the Python program to terminate immediately with a segmentation error.
It would seem that I need to pass the old / current value as a pointer - perhaps in order to be able to distinguish the API from the difference between a null pointer (no value specified) and a pointer to a zero value (value is equal but the value is null)? However, I tried all the combinations that I can come up with here without success, including the use of various wrappers from ctypes .
SO appropriately offers a large number of questions that may already have an answer here, but it seems that most of them relate to cases where the author has control over the sources of C and recommendations for changing the C API to avoid difficulties completely, which I donβt see here. This is my only experience with Python and SWIG so far, and any advice would be appreciated, thanks!