comparison svnwrap/svn_swig_wrapper.py @ 46:f30cda3389c2

This appears to fix pushing over both the http and svn protocols.
author Augie Fackler <durin42@gmail.com>
date Wed, 29 Oct 2008 11:48:58 -0500
parents ce00e6ffaa90
children 9738a7c4e3dd
comparison
equal deleted inserted replaced
45:ce00e6ffaa90 46:f30cda3389c2
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): 15 class RaCallbacks(ra.Callbacks):
16 def open_tmp_file(self, pool):
17 (fd, fn) = tempfile.mkstemp()
18 os.close(fd)
19 return fn
20
16 def get_client_string(self, pool): 21 def get_client_string(self, pool):
17 return 'hgsubversion' 22 return 'hgsubversion'
18 23
19 def user_pass_prompt(realm, default_username, ms, pool): 24 def user_pass_prompt(realm, default_username, ms, pool):
20 creds = core.svn_auth_cred_simple_t() 25 creds = core.svn_auth_cred_simple_t()
268 commit_cb, 273 commit_cb,
269 None, 274 None,
270 False, 275 False,
271 self.pool) 276 self.pool)
272 checksum = [] 277 checksum = []
278 # internal dir batons can fall out of scope and get GCed before svn is
279 # done with them. This prevents that (credit to gvn for the idea).
280 batons = [edit_baton, ]
273 def driver_cb(parent, path, pool): 281 def driver_cb(parent, path, pool):
282 if not parent:
283 bat = editor.open_root(edit_baton, base_revision, self.pool)
284 batons.append(bat)
285 return bat
274 if path in dirs: 286 if path in dirs:
275 return editor.add_directory(path, parent, None, -1, pool) 287 bat = editor.add_directory(path, parent, None, -1, pool)
288 batons.append(bat)
289 return bat
276 base_text, new_text, action = file_data[path] 290 base_text, new_text, action = file_data[path]
277 compute_delta = True 291 compute_delta = True
278 if action == 'modify': 292 if action == 'modify':
279 baton = editor.open_file(path, parent, base_revision, pool) 293 baton = editor.open_file(path, parent, base_revision, pool)
280 elif action == 'add': 294 elif action == 'add':
300 txdelta_stream = delta.svn_txdelta( 314 txdelta_stream = delta.svn_txdelta(
301 cStringIO.StringIO(base_text), cStringIO.StringIO(new_text), 315 cStringIO.StringIO(base_text), cStringIO.StringIO(new_text),
302 self.pool) 316 self.pool)
303 delta.svn_txdelta_send_txstream(txdelta_stream, handler, 317 delta.svn_txdelta_send_txstream(txdelta_stream, handler,
304 wh_baton, pool) 318 wh_baton, pool)
305 319 # TODO pass md5(new_text) instead of None
306 editor.open_root(edit_baton, base_revision, self.pool) 320 editor.close_file(baton, None)
321
307 delta.path_driver(editor, edit_baton, base_revision, paths, driver_cb, 322 delta.path_driver(editor, edit_baton, base_revision, paths, driver_cb,
308 self.pool) 323 self.pool)
309 editor.close_edit(edit_baton, self.pool) 324 editor.close_edit(edit_baton, self.pool)
310 325
311 def get_replay(self, revision, editor, oldest_rev_i_have=0): 326 def get_replay(self, revision, editor, oldest_rev_i_have=0):