mercurial/store.py
changeset 51552 49faa72b994e
parent 51547 8e2a68e10f5c
equal deleted inserted replaced
51551:6e4c8366c5ce 51552:49faa72b994e
   482 class BaseStoreEntry:
   482 class BaseStoreEntry:
   483     """An entry in the store
   483     """An entry in the store
   484 
   484 
   485     This is returned by `store.walk` and represent some data in the store."""
   485     This is returned by `store.walk` and represent some data in the store."""
   486 
   486 
       
   487     maybe_volatile = True
       
   488 
   487     def files(self) -> List[StoreFile]:
   489     def files(self) -> List[StoreFile]:
   488         raise NotImplementedError
   490         raise NotImplementedError
   489 
   491 
   490     def get_streams(
   492     def get_streams(
   491         self,
   493         self,
   507 class SimpleStoreEntry(BaseStoreEntry):
   509 class SimpleStoreEntry(BaseStoreEntry):
   508     """A generic entry in the store"""
   510     """A generic entry in the store"""
   509 
   511 
   510     is_revlog = False
   512     is_revlog = False
   511 
   513 
       
   514     maybe_volatile = attr.ib()
   512     _entry_path = attr.ib()
   515     _entry_path = attr.ib()
   513     _is_volatile = attr.ib(default=False)
   516     _is_volatile = attr.ib(default=False)
   514     _file_size = attr.ib(default=None)
   517     _file_size = attr.ib(default=None)
   515     _files = attr.ib(default=None)
   518     _files = attr.ib(default=None)
   516 
   519 
   523         super().__init__()
   526         super().__init__()
   524         self._entry_path = entry_path
   527         self._entry_path = entry_path
   525         self._is_volatile = is_volatile
   528         self._is_volatile = is_volatile
   526         self._file_size = file_size
   529         self._file_size = file_size
   527         self._files = None
   530         self._files = None
       
   531         self.maybe_volatile = is_volatile
   528 
   532 
   529     def files(self) -> List[StoreFile]:
   533     def files(self) -> List[StoreFile]:
   530         if self._files is None:
   534         if self._files is None:
   531             self._files = [
   535             self._files = [
   532                 StoreFile(
   536                 StoreFile(
   544 
   548 
   545     is_revlog = True
   549     is_revlog = True
   546 
   550 
   547     revlog_type = attr.ib(default=None)
   551     revlog_type = attr.ib(default=None)
   548     target_id = attr.ib(default=None)
   552     target_id = attr.ib(default=None)
       
   553     maybe_volatile = attr.ib(default=True)
   549     _path_prefix = attr.ib(default=None)
   554     _path_prefix = attr.ib(default=None)
   550     _details = attr.ib(default=None)
   555     _details = attr.ib(default=None)
   551     _files = attr.ib(default=None)
   556     _files = attr.ib(default=None)
   552 
   557 
   553     def __init__(
   558     def __init__(
   560         super().__init__()
   565         super().__init__()
   561         self.revlog_type = revlog_type
   566         self.revlog_type = revlog_type
   562         self.target_id = target_id
   567         self.target_id = target_id
   563         self._path_prefix = path_prefix
   568         self._path_prefix = path_prefix
   564         assert b'.i' in details, (path_prefix, details)
   569         assert b'.i' in details, (path_prefix, details)
       
   570         for ext in details:
       
   571             if ext.endswith(REVLOG_FILES_VOLATILE_EXT):
       
   572                 self.maybe_volatile = True
       
   573                 break
       
   574         else:
       
   575             self.maybe_volatile = False
   565         self._details = details
   576         self._details = details
   566         self._files = None
   577         self._files = None
   567 
   578 
   568     @property
   579     @property
   569     def is_changelog(self):
   580     def is_changelog(self):