comparison mercurial/transaction.py @ 49994:3128018e878b

transaction: run abort callback in all cases Previously, these possibly important callback were "forgotten" when running a quick rollback. This is now fixed, as the tests shown.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 14 Feb 2023 20:04:17 +0100
parents 2f348babe30d
children 27fd12eca557
comparison
equal deleted inserted replaced
49993:2f348babe30d 49994:3128018e878b
668 self._file.close() 668 self._file.close()
669 self._backupsfile.close() 669 self._backupsfile.close()
670 670
671 quick = self._can_quick_abort(entries) 671 quick = self._can_quick_abort(entries)
672 try: 672 try:
673 if not quick:
674 self._report(_(b"transaction abort!\n"))
675 for cat in sorted(self._abortcallback):
676 self._abortcallback[cat](self)
677 # Prevent double usage and help clear cycles.
678 self._abortcallback = None
673 if quick: 679 if quick:
674 self._do_quick_abort(entries) 680 self._do_quick_abort(entries)
675 else: 681 else:
676 self._do_full_abort(entries) 682 self._do_full_abort(entries)
677 finally: 683 finally:
697 if self._journal: 703 if self._journal:
698 self._opener.unlink(self._journal) 704 self._opener.unlink(self._journal)
699 705
700 def _do_full_abort(self, entries): 706 def _do_full_abort(self, entries):
701 """(Noisily) rollback all the change introduced by the transaction""" 707 """(Noisily) rollback all the change introduced by the transaction"""
702 self._report(_(b"transaction abort!\n"))
703 try: 708 try:
704 for cat in sorted(self._abortcallback):
705 self._abortcallback[cat](self)
706 # Prevent double usage and help clear cycles.
707 self._abortcallback = None
708 _playback( 709 _playback(
709 self._journal, 710 self._journal,
710 self._report, 711 self._report,
711 self._opener, 712 self._opener,
712 self._vfsmap, 713 self._vfsmap,