[PATCH 4 of 4] transaction: remove the 'onabort' mechanism
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon Dec 8 19:26:15 CST 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1417729966 28800
# Thu Dec 04 13:52:46 2014 -0800
# Node ID 980580522580073e8c8e5ea1b7f765dca8abd53a
# Parent 6187b0dbeaf5ce313b6dae85f1f01c3ec67e866f
transaction: remove the 'onabort' mechanism
It has no known users. If someones needs similar functionality, a new 'addabort'
method similar to 'addfinalize' should be added.
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -82,20 +82,18 @@ def _playback(journal, report, opener, v
# only pure backup file remains, it is sage to ignore any error
pass
class transaction(object):
def __init__(self, report, opener, vfsmap, journal, after=None,
- createmode=None, onabort=None):
+ createmode=None):
"""Begin a new transaction
Begins a new transaction that allows rolling back writes in the event of
an exception.
* `after`: called after the transaction has been committed
* `createmode`: the mode of the journal file that will be created
- * `onabort`: called as the transaction is aborting, but before any files
- have been truncated
"""
self.count = 1
self.usages = 1
self.report = report
# a vfs to the store content
@@ -103,11 +101,10 @@ class transaction(object):
# a map to access file in various {location -> vfs}
vfsmap = vfsmap.copy()
vfsmap[''] = opener # set default value
self._vfsmap = vfsmap
self.after = after
- self.onabort = onabort
self.entries = []
self.map = {}
self.journal = journal
self._queue = []
# a dict of arguments to be passed to hooks
@@ -434,13 +431,10 @@ class transaction(object):
self.count = 0
self.usages = 0
self.file.close()
self._backupsfile.close()
- if self.onabort is not None:
- self.onabort()
-
try:
if not self.entries and not self._backupentries:
if self.journal:
self.opener.unlink(self.journal)
if self._backupjournal:
More information about the Mercurial-devel
mailing list