From 0871e7fb66d1a9079404f2e5dc1ec54129406b46 Mon Sep 17 00:00:00 2001 From: FUJIWARA Katsunori Date: Wed, 20 May 2015 01:06:09 +0900 Subject: [PATCH] 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. --- mercurial/dirstate.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py index 3b82804d29..780ccdcfbe 100644 --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -48,6 +48,7 @@ class dirstate(object): 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 @@ class dirstate(object): @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 @@ class dirstate(object): 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 @@ class dirstate(object): 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