subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r985294 - in /subversion/trunk/subversion/bindings/swig: include/svn_containers.swg python/libsvn_swig_py/swigutil_py.c python/libsvn_swig_py/swigutil_py.h
Date Fri, 13 Aug 2010 17:24:41 GMT
Author: cmpilato
Date: Fri Aug 13 17:24:41 2010
New Revision: 985294

URL: http://svn.apache.org/viewvc?rev=985294&view=rev
Log:
Swig-ify the svn_log_entry_t's 'changed_paths2' member for Python.

* subversion/bindings/swig/include/svn_containers.swg
  (changed_paths2): Add new in and out typemaps for Python.

* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
  (make_ob_log_changed_path2): New (defined via macro).
  (svn_swig_py_changed_path2_hash_to_dict): New function.

* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
  (svn_swig_py_changed_path_hash_to_dict): Fix docstring.
  (svn_swig_py_changed_path2_hash_to_dict): New prototype.

Modified:
    subversion/trunk/subversion/bindings/swig/include/svn_containers.swg
    subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
    subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h

Modified: subversion/trunk/subversion/bindings/swig/include/svn_containers.swg
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_containers.swg?rev=985294&r1=985293&r2=985294&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/svn_containers.swg (original)
+++ subversion/trunk/subversion/bindings/swig/include/svn_containers.swg Fri Aug 13 17:24:41
2010
@@ -205,6 +205,27 @@
   %append_output(svn_swig_py_changed_path_hash_to_dict($1));
 }
 
+%typemap(in) apr_hash_t *changed_paths2
+  (apr_pool_t *_global_pool = NULL, PyObject *_global_py_pool = NULL)
+{
+  if (_global_pool == NULL)
+  {
+    if (svn_swig_py_get_parent_pool(args, $descriptor(apr_pool_t *),
+                                    &_global_py_pool, &_global_pool))
+      SWIG_fail;
+  }
+
+  $1 = svn_swig_py_struct_ptr_hash_from_dict($input,
+    $descriptor(svn_log_changed_path2_t *), _global_pool);
+  if (PyErr_Occurred()) {
+    SWIG_fail;
+  }
+}
+%typemap(out) apr_hash_t *changed_paths2
+{
+  %append_output(svn_swig_py_changed_path2_hash_to_dict($1));
+}
+
 /* apr_hash_t * <const char *, svn_config_t *> */
 %typemap(in) apr_hash_t *config
   (apr_pool_t *_global_pool = NULL, PyObject *_global_py_pool = NULL)

Modified: subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c?rev=985294&r1=985293&r2=985294&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (original)
+++ subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c Fri Aug
13 17:24:41 2010
@@ -805,6 +805,7 @@ static PyObject *make_ob_##type(void *va
 
 DECLARE_SWIG_CONSTRUCTOR(txdelta_window, svn_txdelta_window_dup)
 DECLARE_SWIG_CONSTRUCTOR(log_changed_path, svn_log_changed_path_dup)
+DECLARE_SWIG_CONSTRUCTOR(log_changed_path2, svn_log_changed_path2_dup)
 DECLARE_SWIG_CONSTRUCTOR(wc_status, svn_wc_dup_status)
 DECLARE_SWIG_CONSTRUCTOR(lock, svn_lock_dup)
 DECLARE_SWIG_CONSTRUCTOR(auth_ssl_server_cert_info,
@@ -878,6 +879,42 @@ PyObject *svn_swig_py_changed_path_hash_
   return dict;
 }
 
+PyObject *svn_swig_py_changed_path2_hash_to_dict(apr_hash_t *hash)
+{
+  apr_hash_index_t *hi;
+  PyObject *dict;
+
+  if (hash == NULL)
+    Py_RETURN_NONE;
+
+  if ((dict = PyDict_New()) == NULL)
+    return NULL;
+
+  for (hi = apr_hash_first(NULL, hash); hi; hi = apr_hash_next(hi))
+    {
+      const void *key;
+      void *val;
+      PyObject *value;
+
+      apr_hash_this(hi, &key, NULL, &val);
+      value = make_ob_log_changed_path2(val);
+      if (value == NULL)
+        {
+            Py_DECREF(dict);
+            return NULL;
+        }
+      if (PyDict_SetItemString(dict, (char *)key, value) == -1)
+        {
+          Py_DECREF(value);
+          Py_DECREF(dict);
+          return NULL;
+        }
+      Py_DECREF(value);
+    }
+
+  return dict;
+}
+
 apr_hash_t *svn_swig_py_stringhash_from_dict(PyObject *dict,
                                              apr_pool_t *pool)
 {

Modified: subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h?rev=985294&r1=985293&r2=985294&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h (original)
+++ subversion/trunk/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h Fri Aug
13 17:24:41 2010
@@ -174,11 +174,16 @@ PyObject *svn_swig_py_c_strings_to_list(
 SVN_SWIG_SWIGUTIL_EXPORT
 PyObject *svn_swig_py_array_to_list(const apr_array_header_t *strings);
 
-/* helper function to convert a hash mapping char * to svn_string_t * to a
- * Python dict mapping str to str. */
+/* helper function to convert a hash mapping char * to
+ * svn_log_changed_path_t * to a Python dict mapping str to str. */
 SVN_SWIG_SWIGUTIL_EXPORT
 PyObject *svn_swig_py_changed_path_hash_to_dict(apr_hash_t *hash);
 
+/* helper function to convert a hash mapping char * to
+ * svn_log_changed_path2_t * to a Python dict mapping str to str. */
+SVN_SWIG_SWIGUTIL_EXPORT
+PyObject *svn_swig_py_changed_path2_hash_to_dict(apr_hash_t *hash);
+
 /* helper function to convert an array of 'svn_revnum_t' to a Python list
    of int objects */
 SVN_SWIG_SWIGUTIL_EXPORT



Mime
View raw message