changeset 23903:426607be9c69

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 16 Jan 2015 19:35:04 -0800
parents bfa52f4ecf54
children d251da5e0e84
files mercurial/localrepo.py mercurial/transaction.py
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 = {}