You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Edward S. Marshall" <es...@logic.net> on 2002/11/18 19:28:08 UTC

[PATCH] fix up svn_fs_paths_changed SWIG binding

Hi,

Using svn.fs.paths_changed() via the SWIG bindings currently produces an
incorrect result; the apr_hash_t is converted to a dictionary of
properties by default instead of a dictionary of paths mapped to
svn_fs_path_change_t values.

This patch minimally fixes that up, but requires ugliness like...

changes = svn.fs.paths_changed(root, pool)
for change in changes.keys():
  print svn.fs.path_change_t_change_kind_get(changes[change])

...just to retrieve a value. Perhaps someone with more swig-fu than I
could enhance this to allow "changes[change].change_kind" to work? :-)
It looks like svn.fs.dir_entries() might need to have the same magic
applied to it as well.

Simple patch included below.

-- 
Edward S. Marshall <es...@logic.net>
http://esm.logic.net/

* subversion/bindings/swig/svn_fs.i: Add an exception to the apr_hash_t
  translation for svn_fs_paths_changed().

Index: subversion/bindings/swig/svn_fs.i
===================================================================
--- subversion/bindings/swig/svn_fs.i	(revision 3811)
+++ subversion/bindings/swig/svn_fs.i	(working copy)
@@ -102,6 +102,19 @@
         svn_swig_py_convert_hash(*$1, SWIGTYPE_p_svn_fs_dirent_t));
 }
 
+/*
-----------------------------------------------------------------------
+   and except for svn_fs_paths_changed, which returns
svn_fs_path_change_t
+   structures
+*/
+
+%typemap(in,numinputs=0) apr_hash_t **changed_paths_p = apr_hash_t
**OUTPUT;
+%typemap(python, argout, fragment="t_output_helper")
+apr_hash_t **changed_paths_p {
+    $result = t_output_helper(
+      $result,
+      svn_swig_py_convert_hash(*$1, SWIGTYPE_p_svn_fs_path_change_t));
+}
+
 /*
-----------------------------------------------------------------------
*/