Patchwork [1,of,4] transaction: clarify the name of 'journal' argument for transaction

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 17, 2015, 3:51 a.m.
Message ID <fce27eb599b3f314fa13.1421466673@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/7510/
State Accepted
Commit 13268fde4c4d518e08a9d0fdf7ecb606e731a865
Headers show

Comments

Pierre-Yves David - Jan. 17, 2015, 3:51 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1421448864 28800
#      Fri Jan 16 14:54:24 2015 -0800
# Node ID fce27eb599b3f314fa1380a7ee2e1cf3db610f0f
# Parent  64936e376478677e2824479a48a6ec03d36e1b2a
transaction: clarify the name of 'journal' argument for transaction

The argument is a string containing the journal name (used as prefix for all
other transaction file). This is not the transaction file itself. So we clarify
this.

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -80,11 +80,11 @@  def _playback(journal, report, opener, v
     except (IOError, OSError, util.Abort), inst:
         # only pure backup file remains, it is sage to ignore any error
         pass
 
 class transaction(object):
-    def __init__(self, report, opener, vfsmap, journal, after=None,
+    def __init__(self, report, opener, vfsmap, journalname, after=None,
                  createmode=None):
         """Begin a new transaction
 
         Begins a new transaction that allows rolling back writes in the event of
         an exception.
@@ -102,11 +102,11 @@  class transaction(object):
         vfsmap[''] = opener  # set default value
         self._vfsmap = vfsmap
         self.after = after
         self.entries = []
         self.map = {}
-        self.journal = journal
+        self.journal = journalname
         self._queue = []
         # a dict of arguments to be passed to hooks
         self.hookargs = {}
         self.file = opener.open(self.journal, "w")
 
@@ -116,11 +116,11 @@  class transaction(object):
         # - if 'location' is not empty, the path is outside main opener reach.
         #   use 'location' value as a key in a vfsmap to find the right 'vfs'
         # (cache is currently unused)
         self._backupentries = []
         self._backupmap = {}
-        self._backupjournal = "%s.backupfiles" % journal
+        self._backupjournal = "%s.backupfiles" % self.journal
         self._backupsfile = opener.open(self._backupjournal, 'w')
         self._backupsfile.write('%d\n' % version)
 
         if createmode is not None:
             opener.chmod(self.journal, createmode & 0666)