localrepo: factor out base of filecache annotation class
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 30 Jun 2017 01:47:49 +0900
changeset 33176 edb7f628ef8b
parent 33175 3b85c474cbcf
child 33177 be723e2afd3d
localrepo: factor out base of filecache annotation class It isn't needed that storecache is derived from repofilecache. Changes in this patch allow repofilecache and storecache to do in own __init__() differently from each other.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri Jun 30 01:47:48 2017 +0900
+++ b/mercurial/localrepo.py	Fri Jun 30 01:47:49 2017 +0900
@@ -66,22 +66,24 @@
 urlerr = util.urlerr
 urlreq = util.urlreq
 
-class repofilecache(scmutil.filecache):
+class _basefilecache(scmutil.filecache):
     """All filecache usage on repo are done for logic that should be unfiltered
     """
-
-    def join(self, obj, fname):
-        return obj.vfs.join(fname)
     def __get__(self, repo, type=None):
         if repo is None:
             return self
-        return super(repofilecache, self).__get__(repo.unfiltered(), type)
+        return super(_basefilecache, self).__get__(repo.unfiltered(), type)
     def __set__(self, repo, value):
-        return super(repofilecache, self).__set__(repo.unfiltered(), value)
+        return super(_basefilecache, self).__set__(repo.unfiltered(), value)
     def __delete__(self, repo):
-        return super(repofilecache, self).__delete__(repo.unfiltered())
+        return super(_basefilecache, self).__delete__(repo.unfiltered())
 
-class storecache(repofilecache):
+class repofilecache(_basefilecache):
+    """filecache for files in .hg but outside of .hg/store"""
+    def join(self, obj, fname):
+        return obj.vfs.join(fname)
+
+class storecache(_basefilecache):
     """filecache for files in the store"""
     def join(self, obj, fname):
         return obj.sjoin(fname)