comparison svnwrap/svn_swig_wrapper.py @ 50:80b923ab242b

Drop any pretense of supporting svn 1.4.x. The quality of the SWIG bindings is just too low for this to work reasonably. In theory, 1.4.x will be supported at a future date by ctypes.
author Augie Fackler <durin42@gmail.com>
date Sat, 01 Nov 2008 12:23:07 -0500
parents 9738a7c4e3dd
children fd5aadd552c8
comparison
equal deleted inserted replaced
49:2bc4999a89d3 50:80b923ab242b
9 from svn import client 9 from svn import client
10 from svn import core 10 from svn import core
11 from svn import delta 11 from svn import delta
12 from svn import ra 12 from svn import ra
13 13
14 if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO) < (1, 5, 0):
15 raise ImportError, 'You must have Subversion 1.5.0 or newer and matching SWIG bindings.'
16
14 svn_config = core.svn_config_get_config(None) 17 svn_config = core.svn_config_get_config(None)
15
16 class RaCallbacks(ra.Callbacks): 18 class RaCallbacks(ra.Callbacks):
17 def open_tmp_file(self, pool): 19 def open_tmp_file(self, pool):
18 (fd, fn) = tempfile.mkstemp() 20 (fd, fn) = tempfile.mkstemp()
19 os.close(fd) 21 os.close(fd)
20 return fn 22 return fn
21 23
22 def get_client_string(self, pool): 24 def get_client_string(self, pool):
23 return 'hgsubversion' 25 return 'hgsubversion'
26
24 27
25 def user_pass_prompt(realm, default_username, ms, pool): 28 def user_pass_prompt(realm, default_username, ms, pool):
26 creds = core.svn_auth_cred_simple_t() 29 creds = core.svn_auth_cred_simple_t()
27 creds.may_save = ms 30 creds.may_save = ms
28 if default_username: 31 if default_username:
113 self.client_context.config = svn_config 116 self.client_context.config = svn_config
114 callbacks = RaCallbacks() 117 callbacks = RaCallbacks()
115 callbacks.auth_baton = self.auth_baton 118 callbacks.auth_baton = self.auth_baton
116 self.callbacks = callbacks 119 self.callbacks = callbacks
117 self.ra = ra.open2(self.svn_url.encode('utf-8'), callbacks, 120 self.ra = ra.open2(self.svn_url.encode('utf-8'), callbacks,
118 svn_config) 121 svn_config, self.pool)
119
120 122
121 @property 123 @property
122 def HEAD(self): 124 def HEAD(self):
123 return ra.get_latest_revnum(self.ra, self.pool) 125 return ra.get_latest_revnum(self.ra, self.pool)
124 126
240 if not start: 242 if not start:
241 start = self.START 243 start = self.START
242 if not stop: 244 if not stop:
243 stop = self.HEAD 245 stop = self.HEAD
244 while stop > start: 246 while stop > start:
245 ra.get_log(self.ra, 247 ra.get_log(self.ra,
246 paths, 248 paths,
247 start+1, 249 start+1,
248 stop, 250 stop,
249 chunk_size, #limit of how many log messages to load 251 chunk_size, #limit of how many log messages to load
250 True, # don't need to know changed paths 252 True, # don't need to know changed paths