Patchwork [3,of,7,main-line-of-work] transaction: gather backupjournal logic together in the __init__

login
register
mail settings
Submitter Pierre-Yves David
Date Nov. 11, 2014, 5:35 p.m.
Message ID <f82d02b7ff612b2c00e5.1415727310@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6678/
State Accepted
Commit e245775f8fd30ef49f0026048605965f93194599
Headers show

Comments

Pierre-Yves David - Nov. 11, 2014, 5:35 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1415182937 0
#      Wed Nov 05 10:22:17 2014 +0000
# Node ID f82d02b7ff612b2c00e531832d776e60f2392714
# Parent  10b65c6db73ef5a94fc4933981a0403d38cb18a0
transaction: gather backupjournal logic together in the __init__

The initialisation of file-backup related variable were a bit scattered, we
gather them together.

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -89,23 +89,24 @@  class transaction(object):
         self.after = after
         self.onclose = onclose
         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)
 
         # hold file generations to be performed on commit