Rev 1024: Wrap svn_ra_get_locations(). in file:///data/jelmer/bzr-svn/pyrex/
Jelmer Vernooij
jelmer at samba.org
Fri Mar 21 15:32:59 GMT 2008
At file:///data/jelmer/bzr-svn/pyrex/
------------------------------------------------------------
revno: 1024
revision-id: jelmer at samba.org-20080321153257-efj301q543pyo9cz
parent: jelmer at samba.org-20080321151624-7xtzwi8wrryu6qq3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pyrex
timestamp: Fri 2008-03-21 16:32:57 +0100
message:
Wrap svn_ra_get_locations().
modified:
core.pxd core.pxd-20080314004625-ng663dn07ewpc26a-1
core.pyx core.pyx-20080313210413-17k59slolpfe5kdq-1
ra.pyx ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
=== modified file 'core.pxd'
--- a/core.pxd 2008-03-16 17:57:35 +0000
+++ b/core.pxd 2008-03-21 15:32:57 +0000
@@ -22,6 +22,7 @@
cdef svn_error_t *py_cancel_func(cancel_baton)
cdef wrap_lock(svn_lock_t *)
cdef apr_array_header_t *string_list_to_apr_array(apr_pool_t *pool, object l)
+cdef apr_array_header_t *revnum_list_to_apr_array(apr_pool_t *pool, object l)
cdef svn_error_t *py_svn_log_wrapper(baton, apr_hash_t *changed_paths, long revision, char *author, char *date, char *message, apr_pool_t *pool) except *
cdef svn_stream_t *new_py_stream(apr_pool_t *pool, object py)
cdef svn_stream_t *string_stream(apr_pool_t *pool, text)
=== modified file 'core.pyx'
--- a/core.pyx 2008-03-18 19:33:31 +0000
+++ b/core.pyx 2008-03-21 15:32:57 +0000
@@ -22,7 +22,7 @@
import constants
from constants import PROP_REVISION_LOG, PROP_REVISION_AUTHOR, PROP_REVISION_DATE
from types cimport svn_stream_set_read, svn_stream_set_write, svn_stream_set_close, svn_stream_from_stringbuf, svn_stream_create
-from types cimport svn_stringbuf_t, svn_stringbuf_ncreate, svn_string_t
+from types cimport svn_stringbuf_t, svn_stringbuf_ncreate, svn_string_t, svn_revnum_t
cdef extern from "Python.h":
void Py_INCREF(object)
@@ -135,6 +135,17 @@
NODE_UNKNOWN = svn_node_unknown
NODE_NONE = svn_node_none
+cdef apr_array_header_t *revnum_list_to_apr_array(apr_pool_t *pool, object l):
+ cdef apr_array_header_t *ret
+ cdef svn_revnum_t *el
+ if l is None:
+ return NULL
+ ret = apr_array_make(pool, len(l), sizeof(svn_revnum_t))
+ for i in l:
+ el = <svn_revnum_t *>apr_array_push(ret)
+ el[0] = i
+ return ret
+
cdef apr_array_header_t *string_list_to_apr_array(apr_pool_t *pool, object l):
cdef apr_array_header_t *ret
cdef char **el
=== modified file 'ra.pyx'
--- a/ra.pyx 2008-03-21 15:16:24 +0000
+++ b/ra.pyx 2008-03-21 15:32:57 +0000
@@ -19,7 +19,7 @@
from apr cimport apr_array_header_t, apr_array_make, apr_array_push
from apr cimport apr_file_t, apr_off_t, apr_size_t, apr_uint32_t
from apr cimport apr_initialize, apr_pstrdup
-from core cimport check_error, Pool, wrap_lock, string_list_to_apr_array, py_svn_log_wrapper, new_py_stream, prop_hash_to_dict, py_svn_error
+from core cimport check_error, Pool, wrap_lock, string_list_to_apr_array, py_svn_log_wrapper, new_py_stream, prop_hash_to_dict, py_svn_error, revnum_list_to_apr_array
from core import SubversionException
from constants import PROP_REVISION_LOG, PROP_REVISION_AUTHOR, PROP_REVISION_DATE
from types cimport svn_error_t, svn_revnum_t, svn_string_t, svn_version_t
@@ -217,6 +217,14 @@
lock_baton,
apr_pool_t *pool)
+ svn_error_t *svn_ra_get_locations(svn_ra_session_t *session,
+ apr_hash_t **locations,
+ char *path,
+ svn_revnum_t peg_revision,
+ apr_array_header_t *location_revisions,
+ apr_pool_t *pool)
+
+
cdef pyify_lock(svn_lock_t *lock):
return None # FIXME
@@ -847,7 +855,7 @@
py_lock_func, lock_func, temp_pool))
apr_pool_destroy(temp_pool)
- def get_locks(self, path):
+ def get_locks(self, char *path):
cdef apr_pool_t *temp_pool
cdef apr_hash_t *hash_locks
cdef apr_hash_index_t *idx
@@ -865,6 +873,27 @@
apr_pool_destroy(temp_pool)
return ret
+ def get_locations(self, char *path, svn_revnum_t peg_revision, location_revisions):
+ cdef apr_pool_t *temp_pool
+ cdef apr_hash_t *hash_locations
+ cdef apr_hash_index_t *idx
+ cdef svn_revnum_t *key
+ cdef long klen
+ cdef char *val
+ temp_pool = Pool(NULL)
+ check_error(svn_ra_get_locations(self.ra, &hash_locations,
+ path, peg_revision,
+ revnum_list_to_apr_array(temp_pool, location_revisions),
+ temp_pool))
+ ret = {}
+ idx = apr_hash_first(temp_pool, hash_locations)
+ while idx:
+ apr_hash_this(idx, <void **>&key, &klen, <void **>&val)
+ ret[key[0]] = val
+ idx = apr_hash_next(idx)
+ apr_pool_destroy(temp_pool)
+ return ret
+
def __dealloc__(self):
if self.pool != NULL:
apr_pool_destroy(self.pool)
More information about the bazaar-commits
mailing list