changeset 40792:47e3f554df35

check-exec: write file in 'wcache' instead of 'cache' Some cache are relevant or affected by the working copy used. So the `.hg/cache` directory is not the best place for them because multiple shared repository can end up fighting over them. To address this issue, we introduce a new 'wcache' directory to host this kind of cache. The first user are the `checkisexec` type file. These files describe property of the working copy and fit the use-case well.
author Boris Feld <boris.feld@octobus.net>
date Thu, 15 Nov 2018 17:08:23 +0100
parents 74a9f428227e
children 64cdfcc73706
files mercurial/posix.py tests/test-clone.t tests/test-fncache.t tests/test-hardlinks.t tests/test-inherit-mode.t tests/test-share.t tests/test-subrepo.t tests/test-tags.t
diffstat 8 files changed, 28 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/posix.py	Fri Nov 23 06:09:44 2018 +0100
+++ b/mercurial/posix.py	Thu Nov 15 17:08:23 2018 +0100
@@ -182,7 +182,7 @@
     try:
         EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
         basedir = os.path.join(path, '.hg')
-        cachedir = os.path.join(basedir, 'cache')
+        cachedir = os.path.join(basedir, 'wcache')
         storedir = os.path.join(basedir, 'store')
         if not os.path.exists(cachedir):
             try:
@@ -255,7 +255,7 @@
     # mktemp is not racy because symlink creation will fail if the
     # file already exists
     while True:
-        cachedir = os.path.join(path, '.hg', 'cache')
+        cachedir = os.path.join(path, '.hg', 'wcache')
         checklink = os.path.join(cachedir, 'checklink')
         # try fast path, read only
         if os.path.islink(checklink):
--- a/tests/test-clone.t	Fri Nov 23 06:09:44 2018 +0100
+++ b/tests/test-clone.t	Thu Nov 15 17:08:23 2018 +0100
@@ -43,10 +43,6 @@
   default                       10:a7949464abda
   $ ls .hg/cache
   branch2-served
-  checkisexec (execbit !)
-  checklink (symlink !)
-  checklink-target (symlink !)
-  checknoexec (execbit !)
   manifestfulltextcache (reporevlogstore !)
   rbc-names-v1
   rbc-revs-v1
@@ -62,9 +58,6 @@
 
   $ ls .hg/cache
   branch2-served
-  checkisexec (execbit !)
-  checklink (symlink !)
-  checklink-target (symlink !)
   rbc-names-v1
   rbc-revs-v1
 
--- a/tests/test-fncache.t	Fri Nov 23 06:09:44 2018 +0100
+++ b/tests/test-fncache.t	Thu Nov 15 17:08:23 2018 +0100
@@ -88,9 +88,6 @@
   .hg/00manifest.i
   .hg/cache
   .hg/cache/branch2-served
-  .hg/cache/checkisexec (execbit !)
-  .hg/cache/checklink (symlink !)
-  .hg/cache/checklink-target (symlink !)
   .hg/cache/manifestfulltextcache (reporevlogstore !)
   .hg/cache/rbc-names-v1
   .hg/cache/rbc-revs-v1
@@ -110,6 +107,10 @@
   .hg/undo.desc
   .hg/undo.dirstate
   .hg/undo.phaseroots
+  .hg/wcache
+  .hg/wcache/checkisexec
+  .hg/wcache/checklink
+  .hg/wcache/checklink-target
   $ cd ..
 
 Non fncache repo:
@@ -125,9 +126,6 @@
   .hg/00changelog.i
   .hg/cache
   .hg/cache/branch2-served
-  .hg/cache/checkisexec (execbit !)
-  .hg/cache/checklink (symlink !)
-  .hg/cache/checklink-target (symlink !)
   .hg/cache/manifestfulltextcache (reporevlogstore !)
   .hg/cache/rbc-names-v1
   .hg/cache/rbc-revs-v1
@@ -150,6 +148,10 @@
   .hg/undo.branch
   .hg/undo.desc
   .hg/undo.dirstate
+  .hg/wcache
+  .hg/wcache/checkisexec
+  .hg/wcache/checklink
+  .hg/wcache/checklink-target
   $ cd ..
 
 Encoding of reserved / long paths in the store
--- a/tests/test-hardlinks.t	Fri Nov 23 06:09:44 2018 +0100
+++ b/tests/test-hardlinks.t	Thu Nov 15 17:08:23 2018 +0100
@@ -239,9 +239,6 @@
   2 r4/.hg/branch
   2 r4/.hg/cache/branch2-base
   2 r4/.hg/cache/branch2-served
-  2 r4/.hg/cache/checkisexec (execbit !)
-  ? r4/.hg/cache/checklink-target (glob) (symlink !)
-  2 r4/.hg/cache/checknoexec (execbit !)
   2 r4/.hg/cache/manifestfulltextcache (reporevlogstore !)
   2 r4/.hg/cache/rbc-names-v1
   2 r4/.hg/cache/rbc-revs-v1
@@ -268,6 +265,9 @@
   2 r4/.hg/undo.branch
   2 r4/.hg/undo.desc
   [24] r4/\.hg/undo\.dirstate (re)
+  2 r4/.hg/wcache/checkisexec
+  2 r4/.hg/wcache/checklink-target
+  2 r4/.hg/wcache/checknoexec
   2 r4/d1/data1
   2 r4/d1/f2
   2 r4/f1
@@ -290,9 +290,6 @@
   1 r4/.hg/branch
   2 r4/.hg/cache/branch2-base
   2 r4/.hg/cache/branch2-served
-  2 r4/.hg/cache/checkisexec (execbit !)
-  2 r4/.hg/cache/checklink-target (symlink !)
-  2 r4/.hg/cache/checknoexec (execbit !)
   2 r4/.hg/cache/manifestfulltextcache (reporevlogstore !)
   2 r4/.hg/cache/rbc-names-v1
   2 r4/.hg/cache/rbc-revs-v1
@@ -319,6 +316,9 @@
   2 r4/.hg/undo.branch
   2 r4/.hg/undo.desc
   [24] r4/\.hg/undo\.dirstate (re)
+  2 r4/.hg/wcache/checkisexec
+  2 r4/.hg/wcache/checklink-target
+  2 r4/.hg/wcache/checknoexec
   2 r4/d1/data1
   2 r4/d1/f2
   1 r4/f1
--- a/tests/test-inherit-mode.t	Fri Nov 23 06:09:44 2018 +0100
+++ b/tests/test-inherit-mode.t	Thu Nov 15 17:08:23 2018 +0100
@@ -69,9 +69,6 @@
   00600 ./.hg/00changelog.i
   00770 ./.hg/cache/
   00660 ./.hg/cache/branch2-served
-  00711 ./.hg/cache/checkisexec
-  00777 ./.hg/cache/checklink
-  00600 ./.hg/cache/checklink-target
   00660 ./.hg/cache/manifestfulltextcache (reporevlogstore !)
   00660 ./.hg/cache/rbc-names-v1
   00660 ./.hg/cache/rbc-revs-v1
@@ -102,6 +99,10 @@
   00660 ./.hg/undo.branch
   00660 ./.hg/undo.desc
   00660 ./.hg/undo.dirstate
+  00770 ./.hg/wcache/
+  00711 ./.hg/wcache/checkisexec
+  00777 ./.hg/wcache/checklink
+  00600 ./.hg/wcache/checklink-target
   00700 ./dir/
   00600 ./dir/bar
   00600 ./foo
--- a/tests/test-share.t	Fri Nov 23 06:09:44 2018 +0100
+++ b/tests/test-share.t	Thu Nov 15 17:08:23 2018 +0100
@@ -28,16 +28,15 @@
   default                        0:d3873e73d99e
   $ hg tags
   tip                                0:d3873e73d99e
-  $ ls -1 .hg/cache || true
-  ls: .hg/cache: $ENOENT$ (no-execbit no-symlink !)
+  $ test -d .hg/cache
+  [1]
+  $ ls -1 .hg/wcache || true
+  ls: .hg/wcache: $ENOENT$ (no-execbit no-symlink !)
   checkisexec (execbit !)
   checklink (symlink !)
   checklink-target (symlink !)
   $ ls -1 ../repo1/.hg/cache
   branch2-served
-  checkisexec (execbit !)
-  checklink (symlink !)
-  checklink-target (symlink !)
   manifestfulltextcache (reporevlogstore !)
   rbc-names-v1
   rbc-revs-v1
--- a/tests/test-subrepo.t	Fri Nov 23 06:09:44 2018 +0100
+++ b/tests/test-subrepo.t	Thu Nov 15 17:08:23 2018 +0100
@@ -1246,15 +1246,16 @@
   ../shared/subrepo-2/.hg
   ../shared/subrepo-2/.hg/branch
   ../shared/subrepo-2/.hg/cache
-  ../shared/subrepo-2/.hg/cache/checkisexec (execbit !)
-  ../shared/subrepo-2/.hg/cache/checklink (symlink !)
-  ../shared/subrepo-2/.hg/cache/checklink-target (symlink !)
   ../shared/subrepo-2/.hg/cache/storehash
   ../shared/subrepo-2/.hg/cache/storehash/* (glob)
   ../shared/subrepo-2/.hg/dirstate
   ../shared/subrepo-2/.hg/hgrc
   ../shared/subrepo-2/.hg/requires
   ../shared/subrepo-2/.hg/sharedpath
+  ../shared/subrepo-2/.hg/wcache
+  ../shared/subrepo-2/.hg/wcache/checkisexec
+  ../shared/subrepo-2/.hg/wcache/checklink
+  ../shared/subrepo-2/.hg/wcache/checklink-target
   ../shared/subrepo-2/file
   $ hg -R ../shared in
   abort: repository default not found!
--- a/tests/test-tags.t	Fri Nov 23 06:09:44 2018 +0100
+++ b/tests/test-tags.t	Thu Nov 15 17:08:23 2018 +0100
@@ -698,9 +698,6 @@
 
   $ ls tagsclient/.hg/cache
   branch2-base
-  checkisexec (execbit !)
-  checklink (symlink !)
-  checklink-target (symlink !)
   hgtagsfnodes1
   rbc-names-v1
   rbc-revs-v1
@@ -725,9 +722,6 @@
 
   $ ls tagsclient/.hg/cache
   branch2-base
-  checkisexec (execbit !)
-  checklink (symlink !)
-  checklink-target (symlink !)
   hgtagsfnodes1
   rbc-names-v1
   rbc-revs-v1