Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 52098:82e2c99c84f3
cachestat: avoid creating cachestat for http path
The statichttprepo repo attemp to create cachestat for content we access through
http. We modify the couple of place create cachestat object to detect this
situation and avoids it.
This is not marvelous, but there is few of them and the freeze is looming. This
helps on Windows where calling cachestat on http path might create issues.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 26 Oct 2024 01:38:20 +0200 |
parents | fa7059f031a9 |
children | fca7d38e040b |
comparison
equal
deleted
inserted
replaced
52097:720d9849dcf9 | 52098:82e2c99c84f3 |
---|---|
510 # Empty files cannot be mmapped, but mmapread should still work. Check | 510 # Empty files cannot be mmapped, but mmapread should still work. Check |
511 # if the file is empty, and if so, return an empty buffer. | 511 # if the file is empty, and if so, return an empty buffer. |
512 if os.fstat(fd).st_size == 0: | 512 if os.fstat(fd).st_size == 0: |
513 return b'' | 513 return b'' |
514 raise | 514 raise |
515 | |
516 | |
517 class uncacheable_cachestat: | |
518 stat: Optional[os.stat_result] | |
519 | |
520 def __init__(self) -> None: | |
521 self.stat = None | |
522 | |
523 def cacheable(self) -> bool: | |
524 return False | |
515 | 525 |
516 | 526 |
517 class fileobjectproxy: | 527 class fileobjectproxy: |
518 """A proxy around file objects that tells a watcher when events occur. | 528 """A proxy around file objects that tells a watcher when events occur. |
519 | 529 |