dirstate: use self._filename instead of immediate string `dirstate`
This prevents immediate string `dirstate` from multiplying. This is also
a preparation for making dirstate aware of PENDING mechanism in
subsequent patches.
--- a/mercurial/dirstate.py Tue May 19 23:29:20 2015 +0900
+++ b/mercurial/dirstate.py Wed May 20 01:06:09 2015 +0900
@@ -48,6 +48,7 @@
self._ui = ui
self._filecache = {}
self._parentwriters = 0
+ self._filename = 'dirstate'
def beginparentchange(self):
'''Marks the beginning of a set of changes that involve changing
@@ -122,7 +123,7 @@
@propertycache
def _pl(self):
try:
- fp = self._opener("dirstate")
+ fp = self._opener(self._filename)
st = fp.read(40)
fp.close()
l = len(st)
@@ -325,7 +326,7 @@
self._map = {}
self._copymap = {}
try:
- st = self._opener.read("dirstate")
+ st = self._opener.read(self._filename)
except IOError, err:
if err.errno != errno.ENOENT:
raise
@@ -592,7 +593,7 @@
import time # to avoid useless import
time.sleep(delaywrite)
- st = self._opener("dirstate", "w", atomictemp=True)
+ st = self._opener(self._filename, "w", atomictemp=True)
# use the modification time of the newly created temporary file as the
# filesystem's notion of 'now'
now = util.fstat(st).st_mtime