Merge 0.4.
[jelmer/subvertpy.git] / util.h
1 /*
2  * Copyright © 2008 Jelmer Vernooij <jelmer@samba.org>
3  * -*- coding: utf-8 -*-
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 #ifndef _BZR_SVN_UTIL_H_
21 #define _BZR_SVN_UTIL_H_
22
23 #pragma GCC visibility push(hidden)
24
25 __attribute__((warn_unused_result)) apr_pool_t *Pool(apr_pool_t *parent);
26 __attribute__((warn_unused_result)) bool check_error(svn_error_t *error);
27 bool string_list_to_apr_array(apr_pool_t *pool, PyObject *l, apr_array_header_t **);
28 PyObject *prop_hash_to_dict(apr_hash_t *props);
29 svn_error_t *py_svn_log_wrapper(void *baton, apr_hash_t *changed_paths, 
30                                                                 long revision, const char *author, 
31                                                                 const char *date, const char *message, 
32                                                                 apr_pool_t *pool);
33 svn_error_t *py_svn_error(void);
34 void PyErr_SetSubversionException(svn_error_t *error);
35
36 #define RUN_SVN_WITH_POOL(pool, cmd)  \
37         if (!check_error((cmd))) { \
38                 apr_pool_destroy(pool); \
39                 return NULL; \
40         }
41
42 PyObject *wrap_lock(svn_lock_t *lock);
43 apr_array_header_t *revnum_list_to_apr_array(apr_pool_t *pool, PyObject *l);
44 svn_stream_t *new_py_stream(apr_pool_t *pool, PyObject *py);
45 PyObject *PyErr_NewSubversionException(svn_error_t *error);
46 svn_error_t *py_cancel_func(void *cancel_baton);
47 apr_hash_t *config_hash_from_object(PyObject *config, apr_pool_t *pool);
48 void PyErr_SetAprStatus(apr_status_t status);
49
50 #if SVN_VER_MAJOR == 1 && SVN_VER_MINOR >= 5
51 svn_error_t *py_svn_log_entry_receiver(void *baton, svn_log_entry_t *log_entry, apr_pool_t *pool);
52 #endif
53
54 #pragma GCC visibility pop
55
56 #endif /* _BZR_SVN_UTIL_H_ */