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

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


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1542245935 -3600
#      Thu Nov 15 02:38:55 2018 +0100
# Node ID fd281df3f7f069f599335220414e2a5bd712fb1d
# Parent  82bb348c50f81208bc58d85b1c9057eb091867a0
# EXP-Topic wcache
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fd281df3f7f0
cache: create `cache` 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
@@ -3009,6 +3009,8 @@ def createrepository(ui, path, createopt
         wdirvfs.makedirs()
 
     hgvfs.makedir(notindexed=True)
+    if 'sharedrepo' not in createopts:
+        hgvfs.mkdir(b'cache')
 
     if b'store' in requirements and 'sharedrepo' not in createopts:
         hgvfs.mkdir(b'store')
diff --git a/tests/test-empty.t b/tests/test-empty.t
--- a/tests/test-empty.t
+++ b/tests/test-empty.t
@@ -20,6 +20,7 @@ Check the basic files created:
 
   $ ls .hg
   00changelog.i
+  cache
   requires
   store
 
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
+  $ chmod 0770 .hg/store .hg/cache
 
 before commit
 store can be written by the group, other files cannot
@@ -51,6 +51,7 @@ store is setgid
   $ "$PYTHON" ../printmodes.py .
   00700 ./.hg/
   00600 ./.hg/00changelog.i
+  00770 ./.hg/cache/
   00600 ./.hg/requires
   00770 ./.hg/store/
 
@@ -116,6 +117,7 @@ group can write everything
   $ "$PYTHON" ../printmodes.py ../push
   00770 ../push/.hg/
   00660 ../push/.hg/00changelog.i
+  00770 ../push/.hg/cache/
   00660 ../push/.hg/requires
   00770 ../push/.hg/store/
 


More information about the Mercurial-devel mailing list