This appears to fix pushing over both the http and svn protocols.

This commit is contained in:
Augie Fackler 2008-10-29 11:48:58 -05:00
parent 65f3d0b450
commit 7334dc703f

View File

@ -13,6 +13,11 @@ from svn import ra
svn_config = core.svn_config_get_config(None) svn_config = core.svn_config_get_config(None)
class RaCallbacks(ra.Callbacks): class RaCallbacks(ra.Callbacks):
def open_tmp_file(self, pool):
(fd, fn) = tempfile.mkstemp()
os.close(fd)
return fn
def get_client_string(self, pool): def get_client_string(self, pool):
return 'hgsubversion' return 'hgsubversion'
@ -270,9 +275,18 @@ class SubversionRepo(object):
False, False,
self.pool) self.pool)
checksum = [] checksum = []
# internal dir batons can fall out of scope and get GCed before svn is
# done with them. This prevents that (credit to gvn for the idea).
batons = [edit_baton, ]
def driver_cb(parent, path, pool): def driver_cb(parent, path, pool):
if not parent:
bat = editor.open_root(edit_baton, base_revision, self.pool)
batons.append(bat)
return bat
if path in dirs: if path in dirs:
return editor.add_directory(path, parent, None, -1, pool) bat = editor.add_directory(path, parent, None, -1, pool)
batons.append(bat)
return bat
base_text, new_text, action = file_data[path] base_text, new_text, action = file_data[path]
compute_delta = True compute_delta = True
if action == 'modify': if action == 'modify':
@ -302,8 +316,9 @@ class SubversionRepo(object):
self.pool) self.pool)
delta.svn_txdelta_send_txstream(txdelta_stream, handler, delta.svn_txdelta_send_txstream(txdelta_stream, handler,
wh_baton, pool) wh_baton, pool)
# TODO pass md5(new_text) instead of None
editor.close_file(baton, None)
editor.open_root(edit_baton, base_revision, self.pool)
delta.path_driver(editor, edit_baton, base_revision, paths, driver_cb, delta.path_driver(editor, edit_baton, base_revision, paths, driver_cb,
self.pool) self.pool)
editor.close_edit(edit_baton, self.pool) editor.close_edit(edit_baton, self.pool)