]>
Commit | Line | Data |
---|---|---|
07747e60 | 1 | Source: http://samba.org/~metze/subversion-1.4.0-metze-python-bindings.patch |
2 | diff -Npur subversion-1.4.0-clean/subversion/bindings/swig/include/apr.swg subversion-1.4.0-patch1/subversion/bindings/swig/include/apr.swg | |
3 | --- subversion-1.4.0-clean/subversion/bindings/swig/include/apr.swg 2005-10-25 06:39:49.000000000 +0200 | |
4 | +++ subversion-1.4.0-patch1/subversion/bindings/swig/include/apr.swg 2007-01-26 17:54:33.463524500 +0100 | |
5 | @@ -146,14 +146,24 @@ typedef apr_int32_t time_t; | |
6 | ||
7 | /* ----------------------------------------------------------------------- | |
8 | create an OUTPUT argument defn for an apr_hash_t ** which is storing | |
9 | + dirent values | |
10 | +*/ | |
11 | +%typemap(python,in,numinputs=0) apr_hash_t **DIRENTHASH = apr_hash_t **OUTPUT; | |
12 | +%typemap(python,argout,fragment="t_output_helper") apr_hash_t **DIRENTHASH { | |
13 | + $result = t_output_helper($result, | |
14 | + svn_swig_py_convert_hash(*$1, | |
15 | + SWIGTYPE_p_svn_dirent_t, | |
16 | + NULL)); | |
17 | +} | |
18 | + | |
19 | +/* ----------------------------------------------------------------------- | |
20 | + create an OUTPUT argument defn for an apr_hash_t ** which is storing | |
21 | property values | |
22 | */ | |
23 | ||
24 | %typemap(python,in,numinputs=0) apr_hash_t **PROPHASH = apr_hash_t **OUTPUT; | |
25 | -%typemap(python,argout) apr_hash_t **PROPHASH { | |
26 | - /* toss prior result, get new result from the hash */ | |
27 | - Py_DECREF($result); | |
28 | - $result = svn_swig_py_prophash_to_dict(*$1); | |
29 | +%typemap(python,argout,fragment="t_output_helper") apr_hash_t **PROPHASH { | |
30 | + $result = t_output_helper($result, svn_swig_py_prophash_to_dict(*$1)); | |
31 | } | |
32 | ||
33 | %typemap(perl5,in,numinputs=0) apr_hash_t **PROPHASH = apr_hash_t **OUTPUT; | |
34 | diff -Npur subversion-1.4.0-clean/subversion/bindings/swig/include/proxy_apr.swg subversion-1.4.0-patch1/subversion/bindings/swig/include/proxy_apr.swg | |
35 | --- subversion-1.4.0-clean/subversion/bindings/swig/include/proxy_apr.swg 2006-03-05 08:31:48.000000000 +0100 | |
36 | +++ subversion-1.4.0-patch1/subversion/bindings/swig/include/proxy_apr.swg 2007-01-26 17:54:33.795545250 +0100 | |
37 | @@ -159,6 +159,28 @@ struct apr_pool_t { | |
38 | del self._parent_pool | |
39 | if hasattr(self, "_is_valid"): | |
40 | del self._is_valid | |
41 | + | |
42 | + # Clear out any pool-owned references inserted by typemaps | |
43 | + if hasattr(self, "_owned_refs"): | |
44 | + del self._owned_refs | |
45 | + | |
46 | + def _add_owned_ref(self, ref): | |
47 | + """Add a new 'owned' reference -- i.e. a Python object contained in a C | |
48 | + structure allocated in this pool. Used by the typemaps to manage | |
49 | + reference counting semantics.""" | |
50 | + if not hasattr(self, "_owned_refs"): | |
51 | + self._owned_refs = {} | |
52 | + if self._owned_refs.has_key(ref): | |
53 | + self._owned_refs[ref] += 1 | |
54 | + else: | |
55 | + self._owned_refs[ref] = 1 | |
56 | + | |
57 | + def _remove_owned_ref(self, ref): | |
58 | + """Remove an existing 'owned' reference. Also used by typemaps.""" | |
59 | + if hasattr(self, "_owned_refs") and self._owned_refs.has_key(ref): | |
60 | + self._owned_refs[ref] -= 1 | |
61 | + if self._owned_refs[ref] == 0: | |
62 | + del self._owned_refs[ref] | |
63 | ||
64 | def __del__(self): | |
65 | """Automatically destroy memory pools, if necessary""" | |
66 | diff -Npur subversion-1.4.0-clean/subversion/bindings/swig/include/svn_types.swg subversion-1.4.0-patch1/subversion/bindings/swig/include/svn_types.swg | |
67 | --- subversion-1.4.0-clean/subversion/bindings/swig/include/svn_types.swg 2006-04-20 04:47:39.000000000 +0200 | |
68 | +++ subversion-1.4.0-patch1/subversion/bindings/swig/include/svn_types.swg 2007-01-27 09:05:41.585591500 +0100 | |
69 | @@ -444,6 +444,12 @@ | |
70 | svn_swig_rb_set_baton($result, (VALUE)$2); | |
71 | }; | |
72 | ||
73 | +%typemap(python, in) (svn_commit_callback2_t callback, void *callback_baton) | |
74 | +{ | |
75 | + $1 = svn_swig_py_commit_callback2; | |
76 | + $2 = (void *)$input; | |
77 | +} | |
78 | + | |
79 | /* ----------------------------------------------------------------------- | |
80 | Callback: svn_cancel_func_t | |
81 | */ | |
82 | @@ -519,6 +525,33 @@ | |
83 | $1 = svn_swig_rb_make_stream($input); | |
84 | } | |
85 | ||
86 | +#ifdef SWIGPYTHON | |
87 | +%typemap(in) (svn_commit_callback_t callback, void *callback_baton) | |
88 | +{ | |
89 | + $1 = svn_swig_py_commit_callback; | |
90 | + $2 = (void *)$input; | |
91 | +} | |
92 | +#endif | |
93 | + | |
94 | +/* ----------------------------------------------------------------------- | |
95 | + Mapper to automatically turn Python objects into void* batons on assignment | |
96 | +*/ | |
97 | + | |
98 | +#ifdef SWIGPYTHON | |
99 | +%typemap(in) void *PY_AS_VOID (PyObject *newRef) { | |
100 | + newRef = $input; | |
101 | + if ($input == Py_None) { | |
102 | + $1 = newRef = NULL; | |
103 | + } else { | |
104 | + newRef = $input; | |
105 | + $1 = (void *)$input; | |
106 | + } | |
107 | + if (svn_swig_py_pool_set_owned_ref(obj0, (PyObject *)arg1->$1_name, newRef)) { | |
108 | + SWIG_fail; | |
109 | + } | |
110 | +} | |
111 | +#endif | |
112 | + | |
113 | /* ----------------------------------------------------------------------- | |
114 | Wrap the digest output for functions populating digests. | |
115 | */ | |
116 | diff -Npur subversion-1.4.0-clean/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c subversion-1.4.0-patch1/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c | |
117 | --- subversion-1.4.0-clean/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c 2006-04-18 21:49:41.000000000 +0200 | |
118 | +++ subversion-1.4.0-patch1/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c 2007-01-27 08:57:48.532027500 +0100 | |
119 | @@ -104,6 +104,8 @@ static apr_pool_t *_global_pool = NULL; | |
120 | static PyObject *_global_svn_swig_py_pool = NULL; | |
121 | static char assertValid[] = "assert_valid"; | |
122 | static char parentPool[] = "_parent_pool"; | |
123 | +static char addOwnedRef[] = "_add_owned_ref"; | |
124 | +static char removeOwnedRef[] = "_remove_owned_ref"; | |
125 | static char wrap[] = "_wrap"; | |
126 | static char unwrap[] = "_unwrap"; | |
127 | static char setParentPool[] = "set_parent_pool"; | |
128 | @@ -166,6 +168,51 @@ static int proxy_set_pool(PyObject **pro | |
129 | ||
130 | return 0; | |
131 | } | |
132 | + | |
133 | +/* Get the parent pool of a proxy object, or return the global application | |
134 | + * pool if one is not set. Returns a BORROWED reference! */ | |
135 | +static PyObject *proxy_get_pool(PyObject *proxy) | |
136 | +{ | |
137 | + PyObject *result; | |
138 | + | |
139 | + if (PyObject_HasAttrString(proxy, parentPool)) { | |
140 | + result = PyObject_GetAttrString(proxy, parentPool); | |
141 | + Py_DECREF(result); | |
142 | + } else { | |
143 | + result = _global_svn_swig_py_pool; | |
144 | + } | |
145 | + | |
146 | + return result; | |
147 | +} | |
148 | + | |
149 | +/* Change an 'owned reference' allocated in a pool from oldRef to newRef. | |
150 | + * If oldRef is non-NULL and present in the parent pool of proxy, it is removed. | |
151 | + */ | |
152 | +int svn_swig_py_pool_set_owned_ref(PyObject *proxy, PyObject *oldRef, | |
153 | + PyObject *newRef) | |
154 | +{ | |
155 | + PyObject *temp; | |
156 | + PyObject *py_pool = proxy_get_pool(proxy); | |
157 | + | |
158 | + if (oldRef != NULL) { | |
159 | + temp = PyObject_CallMethod(py_pool, removeOwnedRef, objectTuple, oldRef); | |
160 | + if (temp == NULL) { | |
161 | + return 1; | |
162 | + } else { | |
163 | + Py_DECREF(temp); | |
164 | + } | |
165 | + } | |
166 | + if (newRef != NULL) { | |
167 | + temp = PyObject_CallMethod(py_pool, addOwnedRef, objectTuple, newRef); | |
168 | + if (temp == NULL) { | |
169 | + return 1; | |
170 | + } else { | |
171 | + Py_DECREF(temp); | |
172 | + } | |
173 | + } | |
174 | + | |
175 | + return 0; | |
176 | +} | |
177 | \f | |
178 | /* Wrapper for SWIG_TypeQuery */ | |
179 | #define svn_swig_TypeQuery(x) SWIG_TypeQuery(x) | |
180 | @@ -239,14 +286,11 @@ void *svn_swig_MustGetPtr(void *input, s | |
181 | } | |
182 | Py_DECREF(result); | |
183 | } | |
184 | + | |
185 | if (py_pool != NULL) { | |
186 | - if (PyObject_HasAttrString(input, parentPool)) { | |
187 | - *py_pool = PyObject_GetAttrString(input, parentPool); | |
188 | - Py_DECREF(*py_pool); | |
189 | - } else { | |
190 | - *py_pool = _global_svn_swig_py_pool; | |
191 | - } | |
192 | + *py_pool = proxy_get_pool((PyObject *) input); | |
193 | } | |
194 | + | |
195 | if (PyObject_HasAttrString(input, unwrap)) { | |
196 | input = PyObject_CallMethod(input, unwrap, emptyTuple); | |
197 | if (input == NULL) { | |
198 | @@ -486,6 +530,47 @@ PyObject *svn_swig_py_prophash_to_dict(a | |
199 | return convert_hash(hash, convert_svn_string_t, NULL, NULL); | |
200 | } | |
201 | ||
202 | +static PyObject *proparray_to_dict(const apr_array_header_t *array) | |
203 | +{ | |
204 | + PyObject *dict = PyDict_New(); | |
205 | + int i; | |
206 | + | |
207 | + if (dict == NULL) { | |
208 | + return NULL; | |
209 | + } | |
210 | + | |
211 | + for (i = 0; i < array->nelts; ++i) { | |
212 | + svn_prop_t prop; | |
213 | + PyObject *py_key, *py_value; | |
214 | + | |
215 | + prop = APR_ARRAY_IDX(array, i, svn_prop_t); | |
216 | + | |
217 | + py_key = PyString_FromString(prop.name); | |
218 | + if (py_key == NULL) { | |
219 | + goto error; | |
220 | + } | |
221 | + | |
222 | + if (prop.value == NULL) { | |
223 | + py_value = Py_None; | |
224 | + Py_INCREF(Py_None); | |
225 | + } else { | |
226 | + py_value = PyString_FromStringAndSize((void *)prop.value->data, | |
227 | + prop.value->len); | |
228 | + if (py_value == NULL) { | |
229 | + Py_DECREF(py_key); | |
230 | + goto error; | |
231 | + } | |
232 | + } | |
233 | + | |
234 | + PyDict_SetItem(dict, py_key, py_value); | |
235 | + } | |
236 | + | |
237 | + return dict; | |
238 | + | |
239 | +error: | |
240 | + Py_DECREF(dict); | |
241 | + return NULL; | |
242 | +} | |
243 | ||
244 | PyObject *svn_swig_py_locationhash_to_dict(apr_hash_t *hash) | |
245 | { | |
246 | @@ -552,6 +637,8 @@ DECLARE_SWIG_CONSTRUCTOR(lock, svn_lock_ | |
247 | DECLARE_SWIG_CONSTRUCTOR(auth_ssl_server_cert_info, | |
248 | svn_auth_ssl_server_cert_info_dup) | |
249 | DECLARE_SWIG_CONSTRUCTOR(info, svn_info_dup) | |
250 | +DECLARE_SWIG_CONSTRUCTOR(commit_info, svn_commit_info_dup) | |
251 | +DECLARE_SWIG_CONSTRUCTOR(wc_notify, svn_wc_dup_notify) | |
252 | ||
253 | static PyObject *convert_log_changed_path(void *value, void *ctx, | |
254 | PyObject *py_pool) | |
255 | @@ -1448,6 +1535,14 @@ write_handler_pyio(void *baton, const ch | |
256 | return err; | |
257 | } | |
258 | ||
259 | +static svn_error_t * | |
260 | +close_handler_pyio(void *baton) | |
261 | +{ | |
262 | + PyObject *py_io = baton; | |
263 | + Py_DECREF(py_io); | |
264 | + return SVN_NO_ERROR; | |
265 | +} | |
266 | + | |
267 | svn_stream_t * | |
268 | svn_swig_py_make_stream(PyObject *py_io, apr_pool_t *pool) | |
269 | { | |
270 | @@ -1458,9 +1553,11 @@ svn_swig_py_make_stream(PyObject *py_io, | |
271 | * bindings, and we will be finished with the py_io object before we return | |
272 | * to python. I.e. DO NOT STORE AWAY THE RESULTING svn_stream_t * for use | |
273 | * over multiple calls into the bindings. */ | |
274 | + Py_INCREF(py_io); | |
275 | stream = svn_stream_create(py_io, pool); | |
276 | svn_stream_set_read(stream, read_handler_pyio); | |
277 | svn_stream_set_write(stream, write_handler_pyio); | |
278 | + svn_stream_set_close(stream, close_handler_pyio); | |
279 | ||
280 | return stream; | |
281 | } | |
282 | @@ -1507,6 +1604,40 @@ void svn_swig_py_notify_func(void *baton | |
283 | svn_swig_py_release_py_lock(); | |
284 | } | |
285 | ||
286 | +void svn_swig_py_notify_func2(void *baton, | |
287 | + const svn_wc_notify_t *notify, | |
288 | + apr_pool_t *pool) | |
289 | +{ | |
290 | + PyObject *function = baton; | |
291 | + PyObject *result; | |
292 | + svn_error_t *err = SVN_NO_ERROR; | |
293 | + | |
294 | + if (function == NULL || function == Py_None) { | |
295 | + return; | |
296 | + } | |
297 | + | |
298 | + svn_swig_py_acquire_py_lock(); | |
299 | + | |
300 | + if ((result = PyObject_CallFunction(function, | |
301 | + (char *)"(O&O&)", | |
302 | + make_ob_wc_notify, notify, | |
303 | + make_ob_pool, pool)) == NULL) { | |
304 | + err = callback_exception_error(); | |
305 | + } else { | |
306 | + /* The callback shouldn't be returning anything. */ | |
307 | + if (result != Py_None) { | |
308 | + err = callback_bad_return_error("Not None"); | |
309 | + } | |
310 | + Py_DECREF(result); | |
311 | + } | |
312 | + | |
313 | + /* Our error has no place to go. :-( */ | |
314 | + if (err) { | |
315 | + svn_error_clear(err); | |
316 | + } | |
317 | + | |
318 | + svn_swig_py_release_py_lock(); | |
319 | +} | |
320 | ||
321 | void svn_swig_py_status_func(void *baton, | |
322 | const char *path, | |
323 | @@ -2142,3 +2273,353 @@ svn_swig_py_auth_ssl_client_cert_pw_prom | |
324 | *cred = creds; | |
325 | return err; | |
326 | } | |
327 | + | |
328 | +/* svn_ra_callbacks_t */ | |
329 | +static svn_error_t * | |
330 | +ra_callbacks_open_tmp_file(apr_file_t **fp, | |
331 | + void *callback_baton, | |
332 | + apr_pool_t *pool) | |
333 | +{ | |
334 | + PyObject *callbacks = (PyObject *)callback_baton; | |
335 | + PyObject *result; | |
336 | + svn_error_t *err = SVN_NO_ERROR; | |
337 | + | |
338 | + svn_swig_py_acquire_py_lock(); | |
339 | + | |
340 | + if ((result = PyObject_CallMethod(callbacks, | |
341 | + "open_tmp_file", | |
342 | + (char *)"O&", | |
343 | + make_ob_pool, pool)) == NULL) { | |
344 | + err = callback_exception_error(); | |
345 | + } else if (result == Py_None) { | |
346 | + *fp = NULL; | |
347 | + } else { | |
348 | + *fp = svn_swig_py_make_file(result, pool); | |
349 | + if (*fp == NULL) { | |
350 | + err = callback_exception_error(); | |
351 | + } | |
352 | + } | |
353 | + | |
354 | + Py_XDECREF(result); | |
355 | + svn_swig_py_release_py_lock(); | |
356 | + return err; | |
357 | +} | |
358 | + | |
359 | +void | |
360 | +svn_swig_py_setup_ra_callbacks(svn_ra_callbacks2_t **callbacks, | |
361 | + void **baton, | |
362 | + PyObject *py_callbacks, | |
363 | + apr_pool_t *pool) | |
364 | +{ | |
365 | + svn_error_t *err = svn_ra_create_callbacks(callbacks, pool); | |
366 | + PyObject *py_auth_baton; | |
367 | + | |
368 | + if (err) { | |
369 | + svn_swig_py_svn_exception(err); | |
370 | + return; | |
371 | + } | |
372 | + | |
373 | + (*callbacks)->open_tmp_file = ra_callbacks_open_tmp_file; | |
374 | + | |
375 | + py_auth_baton = PyObject_GetAttrString(py_callbacks, "auth_baton"); | |
376 | + | |
377 | + if (svn_swig_ConvertPtrString(py_auth_baton, | |
378 | + (void **)&((*callbacks)->auth_baton), | |
379 | + "svn_auth_baton_t *")) { | |
380 | + err = type_conversion_error("svn_auth_baton_t *"); | |
381 | + svn_swig_py_svn_exception(err); | |
382 | + Py_DECREF(py_auth_baton); | |
383 | + return; | |
384 | + } | |
385 | + | |
386 | + Py_XDECREF(py_auth_baton); | |
387 | + | |
388 | + *baton = py_callbacks; | |
389 | +} | |
390 | + | |
391 | +svn_error_t *svn_swig_py_commit_callback2(const svn_commit_info_t *commit_info, | |
392 | + void *baton, | |
393 | + apr_pool_t *pool) | |
394 | +{ | |
395 | + PyObject *receiver = baton; | |
396 | + PyObject *result; | |
397 | + svn_error_t *err = SVN_NO_ERROR; | |
398 | + | |
399 | + if ((receiver == NULL) || (receiver == Py_None)) { | |
400 | + return SVN_NO_ERROR; | |
401 | + } | |
402 | + | |
403 | + svn_swig_py_acquire_py_lock(); | |
404 | + | |
405 | + if ((result = PyObject_CallFunction(receiver, | |
406 | + (char *)"O&O&", | |
407 | + make_ob_commit_info, commit_info, | |
408 | + make_ob_pool, pool)) == NULL) { | |
409 | + err = callback_exception_error(); | |
410 | + } else { | |
411 | + if (result != Py_None) { | |
412 | + err = callback_bad_return_error("Not None"); | |
413 | + } | |
414 | + Py_DECREF(result); | |
415 | + } | |
416 | + | |
417 | + svn_swig_py_release_py_lock(); | |
418 | + | |
419 | + return err; | |
420 | +} | |
421 | + | |
422 | +svn_error_t *svn_swig_py_commit_callback(svn_revnum_t new_revision, | |
423 | + const char *date, | |
424 | + const char *author, | |
425 | + void *baton) | |
426 | +{ | |
427 | + PyObject *receiver = baton; | |
428 | + PyObject *result; | |
429 | + svn_error_t *err = SVN_NO_ERROR; | |
430 | + | |
431 | + if ((receiver == NULL) || (receiver == Py_None)) { | |
432 | + return SVN_NO_ERROR; | |
433 | + } | |
434 | + | |
435 | + svn_swig_py_acquire_py_lock(); | |
436 | + | |
437 | + if ((result = PyObject_CallFunction(receiver, | |
438 | + (char *)"lss", | |
439 | + new_revision, date, author)) == NULL) { | |
440 | + err = callback_exception_error(); | |
441 | + } else { | |
442 | + if (result != Py_None) { | |
443 | + err = callback_bad_return_error("Not None"); | |
444 | + } | |
445 | + Py_DECREF(result); | |
446 | + } | |
447 | + | |
448 | + svn_swig_py_release_py_lock(); | |
449 | + | |
450 | + return err; | |
451 | +} | |
452 | + | |
453 | +svn_error_t *svn_swig_py_ra_file_rev_handler_func(void *baton, | |
454 | + const char *path, | |
455 | + svn_revnum_t rev, | |
456 | + apr_hash_t *rev_props, | |
457 | + svn_txdelta_window_handler_t *delta_handler, | |
458 | + void **delta_baton, | |
459 | + apr_array_header_t *prop_diffs, | |
460 | + apr_pool_t *pool) | |
461 | +{ | |
462 | + PyObject *handler = baton; | |
463 | + PyObject *result, *py_rev_props = NULL, *py_prop_diffs = NULL; | |
464 | + svn_error_t *err = SVN_NO_ERROR; | |
465 | + | |
466 | + if ((handler == NULL) || (handler == Py_None)) { | |
467 | + return SVN_NO_ERROR; | |
468 | + } | |
469 | + | |
470 | + svn_swig_py_acquire_py_lock(); | |
471 | + | |
472 | + py_rev_props = svn_swig_py_prophash_to_dict(rev_props); | |
473 | + if (py_rev_props == NULL) { | |
474 | + err = type_conversion_error("apr_hash_t *"); | |
475 | + goto error; | |
476 | + } | |
477 | + | |
478 | + py_prop_diffs = proparray_to_dict(prop_diffs); | |
479 | + | |
480 | + if (py_prop_diffs == NULL) { | |
481 | + err = type_conversion_error("apr_array_header_t *"); | |
482 | + goto error; | |
483 | + } | |
484 | + | |
485 | + if ((result = PyObject_CallFunction(handler, | |
486 | + (char *)"slOOO&", | |
487 | + path, rev, py_rev_props, py_prop_diffs, | |
488 | + make_ob_pool, pool)) == NULL) { | |
489 | + err = callback_exception_error(); | |
490 | + } else { | |
491 | + if (result != Py_None) { | |
492 | + err = callback_bad_return_error("Not None"); | |
493 | + } | |
494 | + | |
495 | + /* FIXME: Support returned TxDeltaWindow object and | |
496 | + * set delta_handler and delta_baton */ | |
497 | + *delta_handler = NULL; | |
498 | + *delta_baton = NULL; | |
499 | + | |
500 | + Py_XDECREF(result); | |
501 | + } | |
502 | + | |
503 | +error: | |
504 | + | |
505 | + Py_XDECREF(py_rev_props); | |
506 | + Py_XDECREF(py_prop_diffs); | |
507 | + | |
508 | + svn_swig_py_release_py_lock(); | |
509 | + | |
510 | + return err; | |
511 | +} | |
512 | + | |
513 | +static svn_error_t *reporter_set_path(void *report_baton, | |
514 | + const char *path, | |
515 | + svn_revnum_t revision, | |
516 | + svn_boolean_t start_empty, | |
517 | + const char *lock_token, | |
518 | + apr_pool_t *pool) | |
519 | +{ | |
520 | + svn_error_t *err = SVN_NO_ERROR; | |
521 | + PyObject *py_reporter = report_baton, *result; | |
522 | + | |
523 | + if (py_reporter == NULL || py_reporter == Py_None) { | |
524 | + return SVN_NO_ERROR; | |
525 | + } | |
526 | + | |
527 | + svn_swig_py_acquire_py_lock(); | |
528 | + | |
529 | + if ((result = PyObject_CallMethod(py_reporter, | |
530 | + (char *)"set_path", | |
531 | + (char *)"slbsO&", | |
532 | + path, revision, | |
533 | + start_empty, lock_token, | |
534 | + make_ob_pool, pool)) == NULL) { | |
535 | + err = callback_exception_error(); | |
536 | + } else if (result != Py_None) { | |
537 | + err = callback_bad_return_error("Not None"); | |
538 | + } | |
539 | + | |
540 | + Py_XDECREF(result); | |
541 | + | |
542 | + svn_swig_py_release_py_lock(); | |
543 | + | |
544 | + return err; | |
545 | +} | |
546 | + | |
547 | +static svn_error_t *reporter_delete_path(void *report_baton, | |
548 | + const char *path, | |
549 | + apr_pool_t *pool) | |
550 | +{ | |
551 | + svn_error_t *err = SVN_NO_ERROR; | |
552 | + PyObject *py_reporter = report_baton, *result; | |
553 | + | |
554 | + if (py_reporter == NULL || py_reporter == Py_None) { | |
555 | + return SVN_NO_ERROR; | |
556 | + } | |
557 | + | |
558 | + svn_swig_py_acquire_py_lock(); | |
559 | + | |
560 | + if ((result = PyObject_CallMethod(py_reporter, | |
561 | + (char *)"delete_path", | |
562 | + (char *)"sO&", | |
563 | + path, | |
564 | + make_ob_pool, pool)) == NULL) { | |
565 | + err = callback_exception_error(); | |
566 | + } else if (result != Py_None) { | |
567 | + err = callback_bad_return_error("Not None"); | |
568 | + } | |
569 | + | |
570 | + Py_XDECREF(result); | |
571 | + | |
572 | + svn_swig_py_release_py_lock(); | |
573 | + | |
574 | + return err; | |
575 | +} | |
576 | + | |
577 | +static svn_error_t *reporter_link_path(void *report_baton, | |
578 | + const char *path, | |
579 | + const char *url, | |
580 | + svn_revnum_t revision, | |
581 | + svn_boolean_t start_empty, | |
582 | + const char *lock_token, | |
583 | + apr_pool_t *pool) | |
584 | +{ | |
585 | + svn_error_t *err = SVN_NO_ERROR; | |
586 | + PyObject *py_reporter = report_baton, *result; | |
587 | + | |
588 | + if (py_reporter == NULL || py_reporter == Py_None) { | |
589 | + return SVN_NO_ERROR; | |
590 | + } | |
591 | + | |
592 | + svn_swig_py_acquire_py_lock(); | |
593 | + | |
594 | + if ((result = PyObject_CallMethod(py_reporter, | |
595 | + (char *)"link_path", | |
596 | + (char *)"sslbsO&", | |
597 | + path, url, revision, | |
598 | + start_empty, lock_token, | |
599 | + make_ob_pool, pool)) == NULL) { | |
600 | + err = callback_exception_error(); | |
601 | + } else if (result != Py_None) { | |
602 | + err = callback_bad_return_error("Not None"); | |
603 | + } | |
604 | + | |
605 | + Py_XDECREF(result); | |
606 | + | |
607 | + svn_swig_py_release_py_lock(); | |
608 | + | |
609 | + return err; | |
610 | +} | |
611 | + | |
612 | +static svn_error_t *reporter_finish_report(void *report_baton, | |
613 | + apr_pool_t *pool) | |
614 | +{ | |
615 | + svn_error_t *err = SVN_NO_ERROR; | |
616 | + | |
617 | + PyObject *py_reporter = report_baton, *result; | |
618 | + | |
619 | + if (py_reporter == NULL || py_reporter == Py_None) { | |
620 | + return SVN_NO_ERROR; | |
621 | + } | |
622 | + | |
623 | + svn_swig_py_acquire_py_lock(); | |
624 | + | |
625 | + if ((result = PyObject_CallMethod(py_reporter, | |
626 | + (char *)"finish_report", | |
627 | + (char *)"O&", | |
628 | + make_ob_pool, pool)) == NULL) { | |
629 | + err = callback_exception_error(); | |
630 | + } else if (result != Py_None) { | |
631 | + err = callback_bad_return_error("Not None"); | |
632 | + } | |
633 | + | |
634 | + Py_XDECREF(result); | |
635 | + | |
636 | + svn_swig_py_release_py_lock(); | |
637 | + | |
638 | + return err; | |
639 | +} | |
640 | + | |
641 | +static svn_error_t *reporter_abort_report(void *report_baton, | |
642 | + apr_pool_t *pool) | |
643 | +{ | |
644 | + svn_error_t *err = SVN_NO_ERROR; | |
645 | + | |
646 | + PyObject *py_reporter = report_baton, *result; | |
647 | + | |
648 | + if (py_reporter == NULL || py_reporter == Py_None) { | |
649 | + return SVN_NO_ERROR; | |
650 | + } | |
651 | + | |
652 | + svn_swig_py_acquire_py_lock(); | |
653 | + | |
654 | + if ((result = PyObject_CallMethod(py_reporter, | |
655 | + (char *)"abort_report", | |
656 | + (char *)"O&", | |
657 | + make_ob_pool, pool)) == NULL) { | |
658 | + err = callback_exception_error(); | |
659 | + } else if (result != Py_None) { | |
660 | + err = callback_bad_return_error("Not None"); | |
661 | + } | |
662 | + | |
663 | + Py_XDECREF(result); | |
664 | + | |
665 | + svn_swig_py_release_py_lock(); | |
666 | + | |
667 | + return err; | |
668 | +} | |
669 | + | |
670 | +const svn_ra_reporter2_t swig_py_ra_reporter2 = { | |
671 | + reporter_set_path, | |
672 | + reporter_delete_path, | |
673 | + reporter_link_path, | |
674 | + reporter_finish_report, | |
675 | + reporter_abort_report | |
676 | +}; | |
677 | diff -Npur subversion-1.4.0-clean/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h subversion-1.4.0-patch1/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h | |
678 | --- subversion-1.4.0-clean/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h 2006-04-18 21:49:41.000000000 +0200 | |
679 | +++ subversion-1.4.0-patch1/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h 2007-01-27 08:58:32.346765750 +0100 | |
680 | @@ -79,6 +79,9 @@ void svn_swig_py_clear_application_pool( | |
681 | SVN_SWIG_SWIGUTIL_EXPORT | |
682 | void svn_swig_get_application_pool(PyObject **py_pool, apr_pool_t **pool); | |
683 | ||
684 | +/* Set a Python 'owned' reference on the pool of the given proxy object */ | |
685 | +int svn_swig_py_pool_set_owned_ref(PyObject *proxy, PyObject *oldRef, PyObject *newRef); | |
686 | + | |
687 | \f | |
688 | /*** SWIG Wrappers ***/ | |
689 | ||
690 | @@ -198,6 +201,11 @@ void svn_swig_py_notify_func(void *baton | |
691 | svn_wc_notify_state_t prop_state, | |
692 | svn_revnum_t revision); | |
693 | ||
694 | +SVN_SWIG_SWIGUTIL_EXPORT | |
695 | +void svn_swig_py_notify_func2(void *baton, | |
696 | + const svn_wc_notify_t *notify, | |
697 | + apr_pool_t *pool); | |
698 | + | |
699 | /* a status function that executes a Python function that is passed in | |
700 | via the baton argument */ | |
701 | SVN_SWIG_SWIGUTIL_EXPORT | |
702 | @@ -310,6 +318,45 @@ svn_error_t *svn_swig_py_auth_ssl_client | |
703 | svn_boolean_t may_save, | |
704 | apr_pool_t *pool); | |
705 | ||
706 | +SVN_SWIG_SWIGUTIL_EXPORT | |
707 | +void | |
708 | +svn_swig_py_setup_ra_callbacks(svn_ra_callbacks2_t **callbacks, | |
709 | + void **baton, | |
710 | + PyObject *py_callbacks, | |
711 | + apr_pool_t *pool); | |
712 | +SVN_SWIG_SWIGUTIL_EXPORT | |
713 | +svn_error_t *svn_swig_py_commit_callback2(const svn_commit_info_t *commit_info, | |
714 | + void *baton, | |
715 | + apr_pool_t *pool); | |
716 | + | |
717 | +SVN_SWIG_SWIGUTIL_EXPORT | |
718 | +svn_error_t *svn_swig_py_commit_callback(svn_revnum_t new_revision, | |
719 | + const char *date, | |
720 | + const char *author, | |
721 | + void *baton); | |
722 | + | |
723 | + | |
724 | +SVN_SWIG_SWIGUTIL_EXPORT | |
725 | +svn_error_t *svn_swig_py_ra_file_rev_handler_func( | |
726 | + void *baton, | |
727 | + const char *path, | |
728 | + svn_revnum_t rev, | |
729 | + apr_hash_t *rev_props, | |
730 | + svn_txdelta_window_handler_t *delta_handler, | |
731 | + void **delta_baton, | |
732 | + apr_array_header_t *prop_diffs, | |
733 | + apr_pool_t *pool); | |
734 | + | |
735 | +SVN_SWIG_SWIGUTIL_EXPORT | |
736 | +extern const svn_ra_reporter2_t swig_py_ra_reporter2; | |
737 | + | |
738 | +SVN_SWIG_SWIGUTIL_EXPORT | |
739 | +void | |
740 | +svn_swig_py_setup_ra_callbacks(svn_ra_callbacks2_t **callbacks, | |
741 | + void **baton, | |
742 | + PyObject *py_callbacks, | |
743 | + apr_pool_t *pool); | |
744 | + | |
745 | #ifdef __cplusplus | |
746 | } | |
747 | #endif /* __cplusplus */ | |
748 | diff -Npur subversion-1.4.0-clean/subversion/bindings/swig/svn_client.i subversion-1.4.0-patch1/subversion/bindings/swig/svn_client.i | |
749 | --- subversion-1.4.0-clean/subversion/bindings/swig/svn_client.i 2006-04-21 01:25:54.000000000 +0200 | |
750 | +++ subversion-1.4.0-patch1/subversion/bindings/swig/svn_client.i 2007-01-27 09:09:48.813042250 +0100 | |
751 | @@ -25,6 +25,7 @@ | |
752 | #endif | |
753 | ||
754 | %include typemaps.i | |
755 | +%include constraints.i | |
756 | ||
757 | %include svn_global.swg | |
758 | %import core.i | |
759 | @@ -49,6 +50,11 @@ | |
760 | svn_client_ctx_t ** | |
761 | }; | |
762 | ||
763 | +%apply Pointer NONNULL { | |
764 | + const svn_opt_revision_t *revision, | |
765 | + const svn_opt_revision_t *peg_revision | |
766 | +}; | |
767 | + | |
768 | %apply const apr_array_header_t *STRINGLIST { | |
769 | const apr_array_header_t *targets, | |
770 | const apr_array_header_t *diff_options | |
771 | @@ -71,6 +77,16 @@ | |
772 | ||
773 | #ifdef SWIGPYTHON | |
774 | %apply svn_stream_t *WRAPPED_STREAM { svn_stream_t * }; | |
775 | + | |
776 | +/* members of svn_client_ctx_t */ | |
777 | +%apply void *PY_AS_VOID { | |
778 | + void *notify_baton, | |
779 | + void *log_msg_baton, | |
780 | + void *cancel_baton, | |
781 | + void *notify_baton2, | |
782 | + void *log_msg_baton2, | |
783 | + void *progress_baton | |
784 | +}; | |
785 | #endif | |
786 | ||
787 | /* ----------------------------------------------------------------------- | |
788 | @@ -240,6 +256,18 @@ | |
789 | } | |
790 | ||
791 | /* ----------------------------------------------------------------------- | |
792 | + Callback: svn_info_receiver_t | |
793 | + svn_client_info() | |
794 | +*/ | |
795 | + | |
796 | +%typemap(python, in) (svn_info_receiver_t receiver, | |
797 | + void *receiver_baton) { | |
798 | + $1 = svn_swig_py_info_receiver_func; | |
799 | + $2 = (void *)$input; | |
800 | +} | |
801 | + | |
802 | + | |
803 | +/* ----------------------------------------------------------------------- | |
804 | We use 'svn_wc_status_t *' in some custom code, but it isn't in the | |
805 | API anywhere. Thus, SWIG doesn't generate a typemap entry for it. by | |
806 | adding a simple declaration here, SWIG will insert a name for it. | |
807 | @@ -498,6 +526,15 @@ | |
808 | %include svn_time_h.swg | |
809 | %include svn_client_h.swg | |
810 | ||
811 | +#ifdef SWIGPYTHON | |
812 | + | |
813 | +/* provide Python with access to some thunks. */ | |
814 | +%constant svn_cancel_func_t svn_swig_py_cancel_func; | |
815 | +%constant svn_client_get_commit_log2_t svn_swig_py_get_commit_log_func; | |
816 | +%constant svn_wc_notify_func2_t svn_swig_py_notify_func; | |
817 | + | |
818 | +#endif | |
819 | + | |
820 | #ifdef SWIGRUBY | |
821 | %inline %{ | |
822 | static VALUE | |
823 | diff -Npur subversion-1.4.0-clean/subversion/bindings/swig/svn_delta.i subversion-1.4.0-patch1/subversion/bindings/swig/svn_delta.i | |
824 | --- subversion-1.4.0-clean/subversion/bindings/swig/svn_delta.i 2006-08-16 04:53:06.000000000 +0200 | |
825 | +++ subversion-1.4.0-patch1/subversion/bindings/swig/svn_delta.i 2007-01-26 17:54:34.759605500 +0100 | |
826 | @@ -47,7 +47,8 @@ | |
827 | const char *error_info, | |
828 | const char *copyfrom_path, | |
829 | const char *copy_path, | |
830 | - const char *base_checksum | |
831 | + const char *base_checksum, | |
832 | + const char *text_checksum | |
833 | }; | |
834 | ||
835 | #ifdef SWIGPYTHON | |
836 | @@ -148,6 +149,17 @@ void svn_swig_py_make_editor(const svn_d | |
837 | #endif | |
838 | %} | |
839 | ||
840 | +#ifdef SWIGPYTHON | |
841 | +%inline %{ | |
842 | +svn_error_t *svn_delta_invoke_txdelta_window_handler ( | |
843 | + svn_txdelta_window_handler_t handler, | |
844 | + svn_txdelta_window_t *window, void *baton) { | |
845 | + return handler(window, baton); | |
846 | +} | |
847 | +%} | |
848 | +#endif | |
849 | + | |
850 | + | |
851 | /* ----------------------------------------------------------------------- | |
852 | handle svn_txdelta_window_t::ops | |
853 | */ | |
854 | diff -Npur subversion-1.4.0-clean/subversion/bindings/swig/svn_ra.i subversion-1.4.0-patch1/subversion/bindings/swig/svn_ra.i | |
855 | --- subversion-1.4.0-clean/subversion/bindings/swig/svn_ra.i 2006-04-20 04:25:35.000000000 +0200 | |
856 | +++ subversion-1.4.0-patch1/subversion/bindings/swig/svn_ra.i 2007-01-26 18:20:24.464456000 +0100 | |
857 | @@ -25,6 +25,7 @@ | |
858 | #endif | |
859 | ||
860 | %include typemaps.i | |
861 | +%include constraints.i | |
862 | ||
863 | %include svn_global.swg | |
864 | %import apr.swg | |
865 | @@ -49,10 +50,12 @@ | |
866 | const svn_ra_reporter2_t **reporter, | |
867 | void **report_baton, | |
868 | svn_dirent_t **dirent, | |
869 | - svn_lock_t **lock | |
870 | + svn_lock_t **lock, | |
871 | + const svn_delta_editor_t ** | |
872 | }; | |
873 | ||
874 | %apply apr_hash_t **PROPHASH { apr_hash_t **props }; | |
875 | +%apply apr_hash_t **DIRENTHASH { apr_hash_t **dirents }; | |
876 | ||
877 | %apply const char *MAY_BE_NULL { | |
878 | const char *comment, | |
879 | @@ -120,6 +123,11 @@ | |
880 | svn_swig_rb_setup_ra_callbacks(&$1, &$2, $input, _global_pool); | |
881 | } | |
882 | ||
883 | +%typemap(python, in) (const svn_ra_callbacks2_t *callbacks, | |
884 | + void *callback_baton) { | |
885 | + svn_swig_py_setup_ra_callbacks(&$1, &$2, $input, _global_pool); | |
886 | +} | |
887 | + | |
888 | %typemap(perl5, in) apr_hash_t *config { | |
889 | $1 = svn_swig_pl_objs_to_hash_by_name ($input, "svn_config_t *", | |
890 | _global_pool); | |
891 | @@ -142,6 +150,22 @@ | |
892 | $1 = svn_swig_rb_hash_to_apr_hash_revnum($input, _global_pool); | |
893 | } | |
894 | ||
895 | +#ifdef SWIGPYTHON | |
896 | +%typemap(in) (svn_ra_file_rev_handler_t handler, void *handler_baton) | |
897 | +{ | |
898 | + $1 = svn_swig_py_ra_file_rev_handler_func; | |
899 | + $2 = (void *)$input; | |
900 | +} | |
901 | +#endif | |
902 | + | |
903 | +#ifdef SWIGPYTHON | |
904 | +%typemap(in) (const svn_ra_reporter2_t *reporter, void *report_baton) | |
905 | +{ | |
906 | + $1 = (svn_ra_reporter2_t *)&swig_py_ra_reporter2; | |
907 | + $2 = (void *)$input; | |
908 | +} | |
909 | +#endif | |
910 | + | |
911 | /* ----------------------------------------------------------------------- */ | |
912 | ||
913 | %{ | |
914 | diff -Npur subversion-1.4.0-clean/subversion/bindings/swig/svn_wc.i subversion-1.4.0-patch1/subversion/bindings/swig/svn_wc.i | |
915 | --- subversion-1.4.0-clean/subversion/bindings/swig/svn_wc.i 2006-04-20 04:49:42.000000000 +0200 | |
916 | +++ subversion-1.4.0-patch1/subversion/bindings/swig/svn_wc.i 2007-01-26 17:54:34.807608500 +0100 | |
917 | @@ -226,6 +226,20 @@ | |
918 | } | |
919 | } | |
920 | ||
921 | +#ifdef SWIGPYTHON | |
922 | +%typemap(in, numinputs=0) | |
923 | + apr_array_header_t **patterns (apr_array_header_t *temp) | |
924 | +{ | |
925 | + $1 = &temp; | |
926 | +} | |
927 | +%typemap(argout, fragment="t_output_helper") | |
928 | + apr_array_header_t **patterns | |
929 | +{ | |
930 | + $result = t_output_helper($result, | |
931 | + svn_swig_py_array_to_list(*$1)); | |
932 | +} | |
933 | +#endif | |
934 | + | |
935 | /* ----------------------------------------------------------------------- | |
936 | Callback: svn_wc_notify_func_t | |
937 | svn_client_ctx_t | |
938 | @@ -272,6 +286,11 @@ | |
939 | $2 = $input; /* our function is the baton. */ | |
940 | } | |
941 | ||
942 | +%typemap(python,in) (svn_wc_notify_func2_t notify_func, void *notify_baton) { | |
943 | + $1 = svn_swig_py_notify_func2; | |
944 | + $2 = $input; /* our function is the baton. */ | |
945 | +} | |
946 | + | |
947 | %typemap(perl5,in) (svn_wc_status_func_t status_func, void *status_baton) { | |
948 | $1 = svn_swig_pl_status_func; | |
949 | $2 = $input; /* our function is the baton. */ |