[PATCH 3 of 4] cache: create `wcache` directory at init time

Boris Feld boris.feld at octobus.net
Mon Dec 3 03:46:59 EST 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1542246391 -3600
#      Thu Nov 15 02:46:31 2018 +0100
# Node ID d39539fbd375c5948845be87987be90ee8bc703c
# Parent  fd281df3f7f069f599335220414e2a5bd712fb1d
# EXP-Topic wcache
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d39539fbd375
cache: create `wcache` directory at init time

The cache directory will be needed very quickly, so it seems simpler to create
it early to make sure it has the same owner and permission than the other
directory in the repository.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -3011,6 +3011,7 @@ def createrepository(ui, path, createopt
     hgvfs.makedir(notindexed=True)
     if 'sharedrepo' not in createopts:
         hgvfs.mkdir(b'cache')
+    hgvfs.mkdir(b'wcache')
 
     if b'store' in requirements and 'sharedrepo' not in createopts:
         hgvfs.mkdir(b'store')
diff --git a/tests/test-bundle.t b/tests/test-bundle.t
--- a/tests/test-bundle.t
+++ b/tests/test-bundle.t
@@ -212,6 +212,7 @@ Make sure bundlerepo doesn't leak tempfi
   cache
   requires
   store
+  wcache
 
 Pull ../full.hg into empty (with hook)
 
diff --git a/tests/test-empty.t b/tests/test-empty.t
--- a/tests/test-empty.t
+++ b/tests/test-empty.t
@@ -23,6 +23,7 @@ Check the basic files created:
   cache
   requires
   store
+  wcache
 
 Should be empty:
 
diff --git a/tests/test-inherit-mode.t b/tests/test-inherit-mode.t
--- a/tests/test-inherit-mode.t
+++ b/tests/test-inherit-mode.t
@@ -42,7 +42,7 @@ just in case somebody has a strange $TMP
   $ hg init repo
   $ cd repo
 
-  $ chmod 0770 .hg/store .hg/cache
+  $ chmod 0770 .hg/store .hg/cache .hg/wcache
 
 before commit
 store can be written by the group, other files cannot
@@ -54,6 +54,7 @@ store is setgid
   00770 ./.hg/cache/
   00600 ./.hg/requires
   00770 ./.hg/store/
+  00770 ./.hg/wcache/
 
   $ mkdir dir
   $ touch foo dir/bar
@@ -120,6 +121,7 @@ group can write everything
   00770 ../push/.hg/cache/
   00660 ../push/.hg/requires
   00770 ../push/.hg/store/
+  00770 ../push/.hg/wcache/
 
   $ umask 077
   $ hg -q push ../push
@@ -155,6 +157,7 @@ group can still write everything
   00660 ../push/.hg/undo.branch
   00660 ../push/.hg/undo.desc
   00660 ../push/.hg/undo.dirstate
+  00770 ../push/.hg/wcache/
 
 
 Test that we don't lose the setgid bit when we call chmod.
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -1242,6 +1242,7 @@ Check that share works with subrepo
   ../shared/subrepo-1/.hg/hgrc
   ../shared/subrepo-1/.hg/requires
   ../shared/subrepo-1/.hg/sharedpath
+  ../shared/subrepo-1/.hg/wcache
   ../shared/subrepo-2
   ../shared/subrepo-2/.hg
   ../shared/subrepo-2/.hg/branch


More information about the Mercurial-devel mailing list