comparison mercurial/scmutil.py @ 52116: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 f4733654f144
children 1fef0d25dcde f5d134e57f51
comparison
equal deleted inserted replaced
52115:720d9849dcf9 52116:82e2c99c84f3
1762 else: 1762 else:
1763 return False 1763 return False
1764 1764
1765 @staticmethod 1765 @staticmethod
1766 def stat(path: bytes) -> Optional[typelib.CacheStat]: 1766 def stat(path: bytes) -> Optional[typelib.CacheStat]:
1767 # TODO have a cleaner approach on httpstaticrepo side
1768 if path.startswith(b'https://') or path.startswith(b'http://'):
1769 return util.uncacheable_cachestat()
1767 try: 1770 try:
1768 return util.cachestat(path) 1771 return util.cachestat(path)
1769 except FileNotFoundError: 1772 except FileNotFoundError:
1770 pass 1773 return None
1771 1774
1772 1775
1773 class filecacheentry: 1776 class filecacheentry:
1774 def __init__(self, paths, stat: bool = True) -> None: 1777 def __init__(self, paths, stat: bool = True) -> None:
1775 self._entries = [] 1778 self._entries = []