changeset 39700:1a68c9b1920d

transaction: make map a private attribute This is used to track which files are modified. It is an implementation detail of current transactions and doesn't need to be exposed to the public interface. So mark it as private. Differential Revision: https://phab.mercurial-scm.org/D4632
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 17 Sep 2018 16:13:38 -0700
parents 337d6e0fd9c9
children 4024c363cd33
files mercurial/transaction.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/transaction.py	Mon Sep 17 16:11:25 2018 -0700
+++ b/mercurial/transaction.py	Mon Sep 17 16:13:38 2018 -0700
@@ -130,7 +130,7 @@
         self._vfsmap = vfsmap
         self._after = after
         self.entries = []
-        self.map = {}
+        self._map = {}
         self._journal = journalname
         self._undoname = undoname
         self._queue = []
@@ -218,7 +218,7 @@
     @active
     def add(self, file, offset, data=None):
         """record the state of an append-only file before update"""
-        if file in self.map or file in self._backupmap:
+        if file in self._map or file in self._backupmap:
             return
         if self._queue:
             self._queue[-1].append((file, offset, data))
@@ -228,10 +228,10 @@
 
     def _addentry(self, file, offset, data):
         """add a append-only entry to memory and on-disk state"""
-        if file in self.map or file in self._backupmap:
+        if file in self._map or file in self._backupmap:
             return
         self.entries.append((file, offset, data))
-        self.map[file] = len(self.entries) - 1
+        self._map[file] = len(self.entries) - 1
         # add enough data to the journal to do the truncate
         self._file.write("%s\0%d\n" % (file, offset))
         self._file.flush()
@@ -251,7 +251,7 @@
             msg = 'cannot use transaction.addbackup inside "group"'
             raise error.ProgrammingError(msg)
 
-        if file in self.map or file in self._backupmap:
+        if file in self._map or file in self._backupmap:
             return
         vfs = self._vfsmap[location]
         dirname, filename = vfs.split(file)
@@ -351,8 +351,8 @@
 
     @active
     def find(self, file):
-        if file in self.map:
-            return self.entries[self.map[file]]
+        if file in self._map:
+            return self.entries[self._map[file]]
         if file in self._backupmap:
             return self._backupentries[self._backupmap[file]]
         return None
@@ -364,9 +364,9 @@
         that are not pending in the queue
         '''
 
-        if file not in self.map:
+        if file not in self._map:
             raise KeyError(file)
-        index = self.map[file]
+        index = self._map[file]
         self.entries[index] = (file, offset, data)
         self._file.write("%s\0%d\n" % (file, offset))
         self._file.flush()