* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
[svn.git] / subversion / bindings / swig / python / svn / ra.py
blob8bdf3c6719486f3bd5ecc5fd5eb4cbb1382bc25e
2 # ra.py: public Python interface for ra components
4 # Subversion is a tool for revision control.
5 # See http://subversion.tigris.org for more information.
7 ######################################################################
9 # Copyright (c) 2000-2004 CollabNet. All rights reserved.
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at http://subversion.tigris.org/license-1.html.
14 # If newer versions of this license are posted there, you may use a
15 # newer version instead, at your option.
17 ######################################################################
19 from libsvn.ra import *
20 from svn.core import _unprefix_names
21 _unprefix_names(locals(), 'svn_ra_')
22 _unprefix_names(locals(), 'SVN_RA_')
23 del _unprefix_names
25 class Callbacks:
26 """Base class for callbacks structure for svn.ra.open2.
28 Ra users may pass an instance of this class as is to svn.ra.open2
29 for some simple operations: as long as authentication is not
30 required, auth_baton may be None, and some ra implementations do not
31 use open_tmp_file at all. These are not guarantees, however, and
32 all but the simplest scripts should fill even these in.
34 The wc_prop slots, on the other hand, are only necessary for commits
35 and updates, and progress_func and cancel_func are always optional.
37 A simple example:
39 class Callbacks(svn.ra.Callbacks):
40 def __init__(self, wc, username, password):
41 self.wc = wc
42 self.auth_baton = svn.core.svn_auth_open([
43 svn.client.get_simple_provider(),
44 svn.client.get_username_provider(),
46 svn.core.svn_auth_set_parameter(self.auth_baton,
47 svn.core.SVN_AUTH_PARAM_DEFAULT_USERNAME,
48 username)
49 svn.core.svn_auth_set_parameter(self.auth_baton,
50 svn.core.SVN_AUTH_PARAM_DEFAULT_PASSWORD,
51 password)
52 def open_tmp_file(self, pool):
53 path = '/'.join([self.wc, svn.wc.get_adm_dir(pool), 'tmp'])
54 (fd, fn) = tempfile.mkstemp(dir=path)
55 os.close(fd)
56 return fn
57 def cancel_func(self):
58 if some_condition():
59 return svn.core.SVN_ERR_CANCELLED
60 return 0
61 """
62 open_tmp_file = None
63 auth_baton = None
64 get_wc_prop = None
65 set_wc_prop = None
66 push_wc_prop = None
67 invalidate_wc_props = None
68 progress_func = None
69 cancel_func = None
70 get_client_string = None