Patchwork [2,of,8] localrepo: factor out base of filecache annotation class

login
register
mail settings
Submitter Katsunori FUJIWARA
Date June 29, 2017, 4:53 p.m.
Message ID <de1d28aa7e7b94e01e10.1498755189@speaknoevil>
Download mbox | patch
Permalink /patch/21826/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - June 29, 2017, 4:53 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1498754869 -32400
#      Fri Jun 30 01:47:49 2017 +0900
# Node ID de1d28aa7e7b94e01e109dcb26aecf073ce1fde7
# Parent  14a0f53f998eb8c9781942fb6d6eb6bdc14cfcfd
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.
Yuya Nishihara - July 2, 2017, 1:23 p.m.
On Fri, 30 Jun 2017 01:53:09 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1498754869 -32400
> #      Fri Jun 30 01:47:49 2017 +0900
> # Node ID de1d28aa7e7b94e01e109dcb26aecf073ce1fde7
> # Parent  14a0f53f998eb8c9781942fb6d6eb6bdc14cfcfd
> localrepo: factor out base of filecache annotation class

Queued the first two, thanks.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -66,22 +66,24 @@  release = lockmod.release
 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())
-
-class storecache(repofilecache):
+        return super(_basefilecache, self).__delete__(repo.unfiltered())
+
+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)