changeset 905:04ded06ea517

swig bindings: abort transaction if we can't finalize it This should prevent us from leaking pending transactions on the server.
author Augie Fackler <raf@durin42.com>
date Thu, 17 May 2012 08:23:49 -0500
parents b6b1365e3489
children 757d6a862c83
files hgsubversion/svnwrap/svn_swig_wrapper.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnwrap/svn_swig_wrapper.py
+++ b/hgsubversion/svnwrap/svn_swig_wrapper.py
@@ -394,9 +394,15 @@ class SubversionRepo(object):
                 # TODO pass md5(new_text) instead of None
                 editor.close_file(baton, None, pool)
 
-        delta.path_driver(editor, edit_baton, base_revision, paths, driver_cb,
-                          self.pool)
-        editor.close_edit(edit_baton, self.pool)
+        try:
+            delta.path_driver(editor, edit_baton, base_revision, paths, driver_cb,
+                              self.pool)
+            editor.close_edit(edit_baton, self.pool)
+        except:
+            # If anything went wrong on the preceding lines, we should
+            # abort the in-progress transaction.
+            editor.abort_edit(edit_baton, self.pool)
+            raise
 
     def get_replay(self, revision, editor, oldest_rev_i_have=0):
         # this method has a tendency to chew through RAM if you don't re-init