Patchwork [1,of,6,V2] localrepo: store path and vfs location of cached properties

login
register
mail settings
Submitter Katsunori FUJIWARA
Date July 4, 2017, 2:28 p.m.
Message ID <a64883be3b408c964738.1499178539@speaknoevil>
Download mbox | patch
Permalink /patch/21966/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - July 4, 2017, 2:28 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1499177626 -32400
#      Tue Jul 04 23:13:46 2017 +0900
# Node ID a64883be3b408c96473824274c21b0ea660e4885
# Parent  45d6e2767a931aefb8052d9aa9ba50343b46290e
localrepo: store path and vfs location of cached properties

This information is used to make transaction handle these files
specially, in order to avoid file stat ambiguity of them.

Gathering information about cached files via annotation classes can
avoid overlooking properties newly introduced in the future.
Yuya Nishihara - July 6, 2017, 1 p.m.
On Tue, 04 Jul 2017 23:28:59 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1499177626 -32400
> #      Tue Jul 04 23:13:46 2017 +0900
> # Node ID a64883be3b408c96473824274c21b0ea660e4885
> # Parent  45d6e2767a931aefb8052d9aa9ba50343b46290e
> localrepo: store path and vfs location of cached properties

Queued these, thanks.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -66,6 +66,11 @@  release = lockmod.release
 urlerr = util.urlerr
 urlreq = util.urlreq
 
+# set of (path, vfs-location) tuples. vfs-location is:
+# - 'plain for vfs relative paths
+# - '' for svfs relative paths
+_cachedfiles = set()
+
 class _basefilecache(scmutil.filecache):
     """All filecache usage on repo are done for logic that should be unfiltered
     """
@@ -80,11 +85,21 @@  class _basefilecache(scmutil.filecache):
 
 class repofilecache(_basefilecache):
     """filecache for files in .hg but outside of .hg/store"""
+    def __init__(self, *paths):
+        super(repofilecache, self).__init__(*paths)
+        for path in paths:
+            _cachedfiles.add((path, 'plain'))
+
     def join(self, obj, fname):
         return obj.vfs.join(fname)
 
 class storecache(_basefilecache):
     """filecache for files in the store"""
+    def __init__(self, *paths):
+        super(storecache, self).__init__(*paths)
+        for path in paths:
+            _cachedfiles.add((path, ''))
+
     def join(self, obj, fname):
         return obj.sjoin(fname)