D4632: transaction: make map a private attribute
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Mon Sep 17 23:36:30 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4632
AFFECTED FILES
mercurial/transaction.py
CHANGE DETAILS
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -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()
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list