Mercurial > public > mercurial-scm > hg
comparison mercurial/posix.py @ 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 | bd0874977a5e |
children | 593f6359681d |
comparison
equal
deleted
inserted
replaced
40786:74a9f428227e | 40792:47e3f554df35 |
---|---|
180 # with exec bit on. | 180 # with exec bit on. |
181 | 181 |
182 try: | 182 try: |
183 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH | 183 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
184 basedir = os.path.join(path, '.hg') | 184 basedir = os.path.join(path, '.hg') |
185 cachedir = os.path.join(basedir, 'cache') | 185 cachedir = os.path.join(basedir, 'wcache') |
186 storedir = os.path.join(basedir, 'store') | 186 storedir = os.path.join(basedir, 'store') |
187 if not os.path.exists(cachedir): | 187 if not os.path.exists(cachedir): |
188 try: | 188 try: |
189 # we want to create the 'cache' directory, not the '.hg' one. | 189 # we want to create the 'cache' directory, not the '.hg' one. |
190 # Automatically creating '.hg' directory could silently spawn | 190 # Automatically creating '.hg' directory could silently spawn |
253 def checklink(path): | 253 def checklink(path): |
254 """check whether the given path is on a symlink-capable filesystem""" | 254 """check whether the given path is on a symlink-capable filesystem""" |
255 # mktemp is not racy because symlink creation will fail if the | 255 # mktemp is not racy because symlink creation will fail if the |
256 # file already exists | 256 # file already exists |
257 while True: | 257 while True: |
258 cachedir = os.path.join(path, '.hg', 'cache') | 258 cachedir = os.path.join(path, '.hg', 'wcache') |
259 checklink = os.path.join(cachedir, 'checklink') | 259 checklink = os.path.join(cachedir, 'checklink') |
260 # try fast path, read only | 260 # try fast path, read only |
261 if os.path.islink(checklink): | 261 if os.path.islink(checklink): |
262 return True | 262 return True |
263 if os.path.isdir(cachedir): | 263 if os.path.isdir(cachedir): |