changeset 23279:e245775f8fd3

transaction: gather backupjournal logic together in the __init__ The initialisation of file-backup related variable were a bit scattered, we gather them together.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 05 Nov 2014 10:22:17 +0000
parents aa19432764d6
children b01c491af0cf
files mercurial/transaction.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/transaction.py	Wed Nov 05 01:38:48 2014 +0000
+++ b/mercurial/transaction.py	Wed Nov 05 10:22:17 2014 +0000
@@ -91,19 +91,20 @@
         self.onabort = onabort
         self.entries = []
         self.map = {}
+        self.journal = journal
+        self._queue = []
+        # a dict of arguments to be passed to hooks
+        self.hookargs = {}
+        self.file = opener.open(self.journal, "w")
+
         # a list of ('path', 'backuppath') entries.
         # if 'backuppath' is empty, no file existed at backup time
         self._backupentries = []
         self._backupmap = {}
-        self.journal = journal
-        self._queue = []
-        # a dict of arguments to be passed to hooks
-        self.hookargs = {}
-
         self._backupjournal = "%s.backupfiles" % journal
-        self.file = opener.open(self.journal, "w")
         self._backupsfile = opener.open(self._backupjournal, 'w')
         self._backupsfile.write('%d\n' % version)
+
         if createmode is not None:
             opener.chmod(self.journal, createmode & 0666)
             opener.chmod(self._backupjournal, createmode & 0666)