Mercurial > hg
comparison mercurial/transaction.py @ 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 | 13268fde4c4d |
children | d251da5e0e84 |
comparison
equal
deleted
inserted
replaced
23902:bfa52f4ecf54 | 23903:426607be9c69 |
---|---|
80 except (IOError, OSError, util.Abort), inst: | 80 except (IOError, OSError, util.Abort), inst: |
81 # only pure backup file remains, it is sage to ignore any error | 81 # only pure backup file remains, it is sage to ignore any error |
82 pass | 82 pass |
83 | 83 |
84 class transaction(object): | 84 class transaction(object): |
85 def __init__(self, report, opener, vfsmap, journalname, after=None, | 85 def __init__(self, report, opener, vfsmap, journalname, undoname=None, |
86 createmode=None): | 86 after=None, createmode=None): |
87 """Begin a new transaction | 87 """Begin a new transaction |
88 | 88 |
89 Begins a new transaction that allows rolling back writes in the event of | 89 Begins a new transaction that allows rolling back writes in the event of |
90 an exception. | 90 an exception. |
91 | 91 |
103 self._vfsmap = vfsmap | 103 self._vfsmap = vfsmap |
104 self.after = after | 104 self.after = after |
105 self.entries = [] | 105 self.entries = [] |
106 self.map = {} | 106 self.map = {} |
107 self.journal = journalname | 107 self.journal = journalname |
108 self.undoname = undoname | |
108 self._queue = [] | 109 self._queue = [] |
109 # a dict of arguments to be passed to hooks | 110 # a dict of arguments to be passed to hooks |
110 self.hookargs = {} | 111 self.hookargs = {} |
111 self.file = opener.open(self.journal, "w") | 112 self.file = opener.open(self.journal, "w") |
112 | 113 |