changeset 41962:07c80298b5a1

manifestcache: abstract the filename in a class attribute This make the code clearer and simpler to update.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 15 Mar 2019 12:17:30 +0000
parents c3522b015f81
children 6386f9a421d2
files mercurial/manifest.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Fri Mar 15 09:07:23 2019 +0000
+++ b/mercurial/manifest.py	Fri Mar 15 12:17:30 2019 +0000
@@ -1276,6 +1276,9 @@
     These are written in reverse cache order (oldest to newest).
 
     """
+
+    _file = 'manifestfulltextcache'
+
     def __init__(self, max):
         super(manifestfulltextcache, self).__init__(max)
         self._dirty = False
@@ -1287,7 +1290,7 @@
             return
 
         try:
-            with self._opener('manifestfulltextcache') as fp:
+            with self._opener(self._file) as fp:
                 set = super(manifestfulltextcache, self).__setitem__
                 # ignore trailing data, this is a cache, corruption is skipped
                 while True:
@@ -1313,8 +1316,7 @@
         if not self._dirty or self._opener is None:
             return
         # rotate backwards to the first used node
-        with self._opener(
-                'manifestfulltextcache', 'w', atomictemp=True, checkambig=True
+        with self._opener(self._file, 'w', atomictemp=True, checkambig=True
             ) as fp:
             node = self._head.prev
             while True: