comparison 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
comparison
equal deleted inserted replaced
931:e1dbd9646d6a 932:dfb3afa6c619
20 # +++ a (working copy) 20 # +++ a (working copy)
21 # @@ -1,2 +1,3 @@ 21 # @@ -1,2 +1,3 @@
22 # a 22 # a
23 # a 23 # a
24 # +a 24 # +a
25 # 25 #
26 # Property changes on: a 26 # Property changes on: a
27 # ___________________________________________________________________ 27 # ___________________________________________________________________
28 # Added: svn:executable 28 # Added: svn:executable
29 # ## -0,0 +1 ## 29 # ## -0,0 +1 ##
30 # +* 30 # +*
237 return patchrepoold(ui, meta, parentctx, patchfp) 237 return patchrepoold(ui, meta, parentctx, patchfp)
238 store = patch.filestore() 238 store = patch.filestore()
239 try: 239 try:
240 touched = set() 240 touched = set()
241 backend = svnbackend(ui, meta.repo, parentctx, store) 241 backend = svnbackend(ui, meta.repo, parentctx, store)
242 ret = patch.patchbackend(ui, backend, patchfp, 0, touched) 242
243 if ret < 0: 243 try:
244 raise BadPatchApply('patching failed') 244 ret = patch.patchbackend(ui, backend, patchfp, 0, touched)
245 if ret > 0: 245 if ret < 0:
246 raise BadPatchApply('patching succeeded with fuzz') 246 raise BadPatchApply('patching failed')
247 if ret > 0:
248 raise BadPatchApply('patching succeeded with fuzz')
249 except patch.PatchError, e:
250 raise BadPatchApply(str(e))
251
247 files = {} 252 files = {}
248 for f in touched: 253 for f in touched:
249 try: 254 try:
250 data, mode, copied = store.getfile(f) 255 data, mode, copied = store.getfile(f)
251 files[f] = data 256 files[f] = data