mercurial/store.py
changeset 50548 0925eaf09c8b
parent 50547 5a62d56e3955
child 50657 e1ee6910f6bc
equal deleted inserted replaced
50547:5a62d56e3955 50548:0925eaf09c8b
   683                     revlog_type=rl_type,
   683                     revlog_type=rl_type,
   684                     target_id=revlog_target_id,
   684                     target_id=revlog_target_id,
   685                     details=file_details,
   685                     details=file_details,
   686                 )
   686                 )
   687 
   687 
   688     def top_entries(self, phase=False) -> Generator[BaseStoreEntry, None, None]:
   688     def top_entries(
       
   689         self, phase=False, obsolescence=False
       
   690     ) -> Generator[BaseStoreEntry, None, None]:
   689         if phase and self.vfs.exists(b'phaseroots'):
   691         if phase and self.vfs.exists(b'phaseroots'):
   690             yield SimpleStoreEntry(
   692             yield SimpleStoreEntry(
   691                 entry_path=b'phaseroots',
   693                 entry_path=b'phaseroots',
       
   694                 is_volatile=True,
       
   695             )
       
   696 
       
   697         if obsolescence and self.vfs.exists(b'obsstore'):
       
   698             # XXX if we had the file size it could be non-volatile
       
   699             yield SimpleStoreEntry(
       
   700                 entry_path=b'obsstore',
   692                 is_volatile=True,
   701                 is_volatile=True,
   693             )
   702             )
   694 
   703 
   695         files = reversed(self._walk(b'', False))
   704         files = reversed(self._walk(b'', False))
   696 
   705 
   731                     target_id=b'',
   740                     target_id=b'',
   732                     details=file_details,
   741                     details=file_details,
   733                 )
   742                 )
   734 
   743 
   735     def walk(
   744     def walk(
   736         self, matcher=None, phase=False
   745         self, matcher=None, phase=False, obsolescence=False
   737     ) -> Generator[BaseStoreEntry, None, None]:
   746     ) -> Generator[BaseStoreEntry, None, None]:
   738         """return files related to data storage (ie: revlogs)
   747         """return files related to data storage (ie: revlogs)
   739 
   748 
   740         yields instance from BaseStoreEntry subclasses
   749         yields instance from BaseStoreEntry subclasses
   741 
   750 
   743         are passed with matches the matcher
   752         are passed with matches the matcher
   744         """
   753         """
   745         # yield data files first
   754         # yield data files first
   746         for x in self.data_entries(matcher):
   755         for x in self.data_entries(matcher):
   747             yield x
   756             yield x
   748         for x in self.top_entries(phase=phase):
   757         for x in self.top_entries(phase=phase, obsolescence=obsolescence):
   749             yield x
   758             yield x
   750 
   759 
   751     def copylist(self):
   760     def copylist(self):
   752         return _data
   761         return _data
   753 
   762