comparison svnwrap/svn_swig_wrapper.py @ 45:ce00e6ffaa90

Change the implementation of the ra_session stuff. Thanks to Ben Collins-Sussman for pointing out the problem with the other method I was using. Note: this may appear to break commits over certain ra layers. Those layers were probably not working properly anyway.
author Augie Fackler <durin42@gmail.com>
date Tue, 28 Oct 2008 22:52:58 -0500
parents c4523e651325
children f30cda3389c2
comparison
equal deleted inserted replaced
44:85fcac4e2291 45:ce00e6ffaa90
10 from svn import delta 10 from svn import delta
11 from svn import ra 11 from svn import ra
12 12
13 svn_config = core.svn_config_get_config(None) 13 svn_config = core.svn_config_get_config(None)
14 14
15 class RaCallbacks(ra.Callbacks):
16 def get_client_string(self, pool):
17 return 'hgsubversion'
15 18
16 def user_pass_prompt(realm, default_username, ms, pool): 19 def user_pass_prompt(realm, default_username, ms, pool):
17 creds = core.svn_auth_cred_simple_t() 20 creds = core.svn_auth_cred_simple_t()
18 creds.may_save = ms 21 creds.may_save = ms
19 if default_username: 22 if default_username:
100 core.SVN_AUTH_PARAM_DEFAULT_USERNAME, 103 core.SVN_AUTH_PARAM_DEFAULT_USERNAME,
101 self.uname) 104 self.uname)
102 105
103 self.client_context.auth_baton = self.auth_baton 106 self.client_context.auth_baton = self.auth_baton
104 self.client_context.config = svn_config 107 self.client_context.config = svn_config
105 self.ra = client.open_ra_session(self.svn_url.encode('utf8'), 108 callbacks = RaCallbacks()
106 self.client_context) 109 callbacks.auth_baton = self.auth_baton
110 self.callbacks = callbacks
111 self.ra = ra.open2(self.svn_url.encode('utf-8'), callbacks,
112 svn_config)
107 113
108 114
109 @property 115 @property
110 def HEAD(self): 116 def HEAD(self):
111 return ra.get_latest_revnum(self.ra, self.pool) 117 return ra.get_latest_revnum(self.ra, self.pool)
228 if not start: 234 if not start:
229 start = self.START 235 start = self.START
230 if not stop: 236 if not stop:
231 stop = self.HEAD 237 stop = self.HEAD
232 while stop > start: 238 while stop > start:
233 ra.get_log(self.ra, paths, 239 ra.get_log(self.ra,
234 start+1, 240 paths,
235 stop, 241 start+1,
236 chunk_size, #limit of how many log messages to load 242 stop,
237 True, # don't need to know changed paths 243 chunk_size, #limit of how many log messages to load
238 True, # stop on copies 244 True, # don't need to know changed paths
239 callback, 245 True, # stop on copies
240 self.pool) 246 callback,
247 self.pool)
241 if len(revisions) < chunk_size: 248 if len(revisions) < chunk_size:
242 # this means there was no history for the path, so force the 249 # this means there was no history for the path, so force the
243 # loop to exit 250 # loop to exit
244 start = stop 251 start = stop
245 else: 252 else:
294 cStringIO.StringIO(base_text), cStringIO.StringIO(new_text), 301 cStringIO.StringIO(base_text), cStringIO.StringIO(new_text),
295 self.pool) 302 self.pool)
296 delta.svn_txdelta_send_txstream(txdelta_stream, handler, 303 delta.svn_txdelta_send_txstream(txdelta_stream, handler,
297 wh_baton, pool) 304 wh_baton, pool)
298 305
306 editor.open_root(edit_baton, base_revision, self.pool)
299 delta.path_driver(editor, edit_baton, base_revision, paths, driver_cb, 307 delta.path_driver(editor, edit_baton, base_revision, paths, driver_cb,
300 self.pool) 308 self.pool)
301 editor.close_edit(edit_baton, self.pool) 309 editor.close_edit(edit_baton, self.pool)
302 310
303 def get_replay(self, revision, editor, oldest_rev_i_have=0): 311 def get_replay(self, revision, editor, oldest_rev_i_have=0):