diff hgsubversion/stupid.py @ 932:dfb3afa6c619

stupid: Fail over to full revision when a PatchError is thrown (issue294) Also give an enhanced exception message when an AssertionError is thrown out of subvertpy. Can't test this as throwing an exception from the appropriate place leaves file handles open in the SVN repository, resulting in a failure to clean up in tearDown().
author Tim Delaney <timothy.c.delaney@gmail.com>
date Tue, 18 Sep 2012 13:18:22 +1000
parents 1be4ea4f3c0d
children d6db289f1548
line wrap: on
line diff
--- a/hgsubversion/stupid.py
+++ b/hgsubversion/stupid.py
@@ -22,7 +22,7 @@ import util
 #  a
 #  a
 # +a
-# 
+#
 # Property changes on: a
 # ___________________________________________________________________
 # Added: svn:executable
@@ -239,11 +239,16 @@ def patchrepo(ui, meta, parentctx, patch
     try:
         touched = set()
         backend = svnbackend(ui, meta.repo, parentctx, store)
-        ret = patch.patchbackend(ui, backend, patchfp, 0, touched)
-        if ret < 0:
-            raise BadPatchApply('patching failed')
-        if ret > 0:
-            raise BadPatchApply('patching succeeded with fuzz')
+
+        try:
+            ret = patch.patchbackend(ui, backend, patchfp, 0, touched)
+            if ret < 0:
+                raise BadPatchApply('patching failed')
+            if ret > 0:
+                raise BadPatchApply('patching succeeded with fuzz')
+        except patch.PatchError, e:
+            raise BadPatchApply(str(e))
+
         files = {}
         for f in touched:
             try: