diff mercurial/dirstatemap.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 ea0467ed76aa
children 4cb75772818d 51a9148f8349
line wrap: on
line diff
--- a/mercurial/dirstatemap.py	Sat Oct 26 02:03:54 2024 +0200
+++ b/mercurial/dirstatemap.py	Sat Oct 26 01:38:20 2024 +0200
@@ -113,8 +113,12 @@
         self.identity = self._get_current_identity()
 
     def _get_current_identity(self) -> Optional[typelib.CacheStat]:
+        # TODO have a cleaner approach on httpstaticrepo side
+        path = self._opener.join(self._filename)
+        if path.startswith(b'https://') or path.startswith(b'http://'):
+            return util.uncacheable_cachestat()
         try:
-            return util.cachestat(self._opener.join(self._filename))
+            return util.cachestat(path)
         except FileNotFoundError:
             return None