transaction: pass the name of the "undo" journal to the transaction
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 16 Jan 2015 19:35:04 -0800
changeset 23903 426607be9c69
parent 23902 bfa52f4ecf54
child 23904 d251da5e0e84
transaction: pass the name of the "undo" journal to the transaction It is time for the transaction to be responsible for setting up the undo data. It is necessary to move this logic into the transaction because many more files are handled now, and the transaction is the object tracking them all. The value can be set to None if no undo should be set.
mercurial/localrepo.py
mercurial/transaction.py
--- a/mercurial/localrepo.py	Fri Jan 16 19:29:16 2015 -0800
+++ b/mercurial/localrepo.py	Fri Jan 16 19:35:04 2015 -0800
@@ -912,6 +912,7 @@
         vfsmap = {'plain': self.vfs} # root of .hg/
         tr = transaction.transaction(rp, self.svfs, vfsmap,
                                      "journal",
+                                     "undo",
                                      aftertrans(renames),
                                      self.store.createmode)
         # note: writing the fncache only during finalize mean that the file is
--- a/mercurial/transaction.py	Fri Jan 16 19:29:16 2015 -0800
+++ b/mercurial/transaction.py	Fri Jan 16 19:35:04 2015 -0800
@@ -82,8 +82,8 @@
         pass
 
 class transaction(object):
-    def __init__(self, report, opener, vfsmap, journalname, after=None,
-                 createmode=None):
+    def __init__(self, report, opener, vfsmap, journalname, undoname=None,
+                 after=None, createmode=None):
         """Begin a new transaction
 
         Begins a new transaction that allows rolling back writes in the event of
@@ -105,6 +105,7 @@
         self.entries = []
         self.map = {}
         self.journal = journalname
+        self.undoname = undoname
         self._queue = []
         # a dict of arguments to be passed to hooks
         self.hookargs = {}