changeset 1011:cc774e975aed

commit: fix exception handling on transaction close On SVN 1.6 at least, a failing pre-commit hook appears to abort a commit transaction without us needing to do it manually. This is apparently managed by a callback at the end of SVN's internal commit callback chain. Subsequently trying to abort an already-aborted transaction results in a spurious "Transaction cleanup failed" message that breaks tests. To fix this, we simply move the commit call out of try/except block.
author Matt Mackall <mpm@selenic.com>
date Thu, 23 May 2013 19:23:02 -0500
parents f0ebc7113429
children e8cd211684c4
files hgsubversion/svnwrap/subvertpy_wrapper.py hgsubversion/svnwrap/svn_swig_wrapper.py
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnwrap/subvertpy_wrapper.py
+++ b/hgsubversion/svnwrap/subvertpy_wrapper.py
@@ -458,10 +458,10 @@ class SubversionRepo(object):
             rooteditor = commiteditor.open_root()
             visitdir(rooteditor, '', paths, 0)
             rooteditor.close()
-            commiteditor.close()
         except:
             commiteditor.abort()
             raise
+        commiteditor.close()
 
     def get_replay(self, revision, editor, oldestrev=0):
 
--- a/hgsubversion/svnwrap/svn_swig_wrapper.py
+++ b/hgsubversion/svnwrap/svn_swig_wrapper.py
@@ -437,13 +437,14 @@ class SubversionRepo(object):
         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
 
+        editor.close_edit(edit_baton, self.pool)
+
     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
         self.init_ra_and_client()