Mercurial > hgsubversion
comparison hgsubversion/editor.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 | bd12a4da0f35 |
children | 63d6484c43ba |
comparison
equal
deleted
inserted
replaced
931:e1dbd9646d6a | 932:dfb3afa6c619 |
---|---|
354 'cannot call handler!') | 354 'cannot call handler!') |
355 def txdelt_window(window): | 355 def txdelt_window(window): |
356 try: | 356 try: |
357 if not self.meta.is_path_valid(self.current.file): | 357 if not self.meta.is_path_valid(self.current.file): |
358 return | 358 return |
359 handler(window) | 359 try: |
360 handler(window) | |
361 except AssertionError, e: # pragma: no cover | |
362 # Enhance the exception message | |
363 msg, others = e.args[0], e.args[1:] | |
364 | |
365 if msg: | |
366 msg += '\n' | |
367 | |
368 msg += _TXDELT_WINDOW_HANDLER_FAILURE_MSG | |
369 e.args = (msg,) + others | |
370 raise e | |
371 | |
360 # window being None means commit this file | 372 # window being None means commit this file |
361 if not window: | 373 if not window: |
362 self.current.files[self.current.file] = target.getvalue() | 374 self.current.files[self.current.file] = target.getvalue() |
363 except svnwrap.SubversionException, e: # pragma: no cover | 375 except svnwrap.SubversionException, e: # pragma: no cover |
364 if e.args[1] == svnwrap.ERR_INCOMPLETE_DATA: | 376 if e.args[1] == svnwrap.ERR_INCOMPLETE_DATA: |
367 raise hgutil.Abort(*e.args) | 379 raise hgutil.Abort(*e.args) |
368 except: # pragma: no cover | 380 except: # pragma: no cover |
369 self._exception_info = sys.exc_info() | 381 self._exception_info = sys.exc_info() |
370 raise | 382 raise |
371 return txdelt_window | 383 return txdelt_window |
384 | |
385 _TXDELT_WINDOW_HANDLER_FAILURE_MSG = ( | |
386 "Your SVN repository may not be supplying correct replay deltas." | |
387 " It is strongly" | |
388 "\nadvised that you repull the entire SVN repository using" | |
389 " hg pull --stupid." | |
390 "\nAlternatively, re-pull just this revision using --stupid and verify" | |
391 " that the" | |
392 "\nchangeset is correct." | |
393 ) |