Show More
@@ -113,8 +113,12 class _dirstatemapcommon: | |||||
113 | self.identity = self._get_current_identity() |
|
113 | self.identity = self._get_current_identity() | |
114 |
|
114 | |||
115 | def _get_current_identity(self) -> Optional[typelib.CacheStat]: |
|
115 | def _get_current_identity(self) -> Optional[typelib.CacheStat]: | |
|
116 | # TODO have a cleaner approach on httpstaticrepo side | |||
|
117 | path = self._opener.join(self._filename) | |||
|
118 | if path.startswith(b'https://') or path.startswith(b'http://'): | |||
|
119 | return util.uncacheable_cachestat() | |||
116 | try: |
|
120 | try: | |
117 |
return util.cachestat( |
|
121 | return util.cachestat(path) | |
118 | except FileNotFoundError: |
|
122 | except FileNotFoundError: | |
119 | return None |
|
123 | return None | |
120 |
|
124 |
@@ -1764,10 +1764,13 class filecachesubentry: | |||||
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 |
|
|
1773 | return None | |
1771 |
|
1774 | |||
1772 |
|
1775 | |||
1773 | class filecacheentry: |
|
1776 | class filecacheentry: |
@@ -33,11 +33,16 if TYPE_CHECKING: | |||||
33 | from . import ( |
|
33 | from . import ( | |
34 | node, |
|
34 | node, | |
35 | posix, |
|
35 | posix, | |
|
36 | util, | |||
36 | windows, |
|
37 | windows, | |
37 | ) |
|
38 | ) | |
38 |
|
39 | |||
39 | BinaryIO_Proxy = BinaryIO |
|
40 | BinaryIO_Proxy = BinaryIO | |
40 | CacheStat = Union[posix.cachestat, windows.cachestat] |
|
41 | CacheStat = Union[ | |
|
42 | posix.cachestat, | |||
|
43 | windows.cachestat, | |||
|
44 | util.uncacheable_cachestat, | |||
|
45 | ] | |||
41 | NodeConstants = node.sha1nodeconstants |
|
46 | NodeConstants = node.sha1nodeconstants | |
42 | else: |
|
47 | else: | |
43 | from typing import Any |
|
48 | from typing import Any |
@@ -514,6 +514,16 def mmapread(fp, size=None, pre_populate | |||||
514 | raise |
|
514 | raise | |
515 |
|
515 | |||
516 |
|
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 | |||
|
525 | ||||
|
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 |
General Comments 0
You need to be logged in to leave comments.
Login now