# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1337263609 18000
# Node ID 757d6a862c833226708c41af27e194a0560a4ab7
# Parent  04ded06ea5174f14fc041abd5af363ef212eef40
subvertpy bindings: abort transaction if we can't finalize it

This should prevent us from leaking pending transactions on the
server.

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
@@ -411,10 +411,14 @@ class SubversionRepo(object):
 
             return pathidx
 
-        rooteditor = commiteditor.open_root()
-        visitdir(rooteditor, '', paths, 0)
-        rooteditor.close()
-        commiteditor.close()
+        try:
+            rooteditor = commiteditor.open_root()
+            visitdir(rooteditor, '', paths, 0)
+            rooteditor.close()
+            commiteditor.close()
+        except:
+            commiteditor.abort()
+            raise
 
     def get_replay(self, revision, editor, oldestrev=0):