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_')
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.
39 class Callbacks(svn.ra.Callbacks):
40 def __init__(self, wc, username, password):
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,
49 svn.core.svn_auth_set_parameter(self.auth_baton,
50 svn.core.SVN_AUTH_PARAM_DEFAULT_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)
57 def cancel_func(self):
59 return svn.core.SVN_ERR_CANCELLED
67 invalidate_wc_props
= None
70 get_client_string
= None