# HG changeset patch # User Matt Mackall # Date 1369354982 18000 # Node ID cc774e975aed52e7b34838e1f734f335d5591cc9 # Parent f0ebc71134292e2f8fe7bfb124d0ad8a487e6d0b 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. diff --git a/hgsubversion/svnwrap/subvertpy_wrapper.py b/hgsubversion/svnwrap/subvertpy_wrapper.py --- 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): diff --git a/hgsubversion/svnwrap/svn_swig_wrapper.py b/hgsubversion/svnwrap/svn_swig_wrapper.py --- 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()