Mercurial > public > mercurial-scm > hg
diff mercurial/store.py @ 50509:a32d739b0ffb
store: make `walk` return an entry for phase if requested so
Instead of having dedicated code in the streamclone code, we should have the
store deal with advertising the data it contains.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 21 May 2023 02:15:04 +0200 |
parents | 32b4c2bbdb94 |
children | 5a62d56e3955 |
line wrap: on
line diff
--- a/mercurial/store.py Mon May 22 10:20:24 2023 +0100 +++ b/mercurial/store.py Sun May 21 02:15:04 2023 +0200 @@ -685,7 +685,7 @@ details=file_details, ) - def top_entries(self) -> Generator[BaseStoreEntry, None, None]: + def top_entries(self, phase=False) -> Generator[BaseStoreEntry, None, None]: files = reversed(self._walk(b'', False)) changelogs = collections.defaultdict(dict) @@ -725,11 +725,18 @@ target_id=b'', details=file_details, ) + if phase and self.vfs.exists(b'phaseroots'): + yield SimpleStoreEntry( + entry_path=b'phaseroots', + is_volatile=True, + ) - def walk(self, matcher=None) -> Generator[BaseStoreEntry, None, None]: + def walk( + self, matcher=None, phase=False + ) -> Generator[BaseStoreEntry, None, None]: """return files related to data storage (ie: revlogs) - yields (file_type, unencoded, size) + yields instance from BaseStoreEntry subclasses if a matcher is passed, storage files of only those tracked paths are passed with matches the matcher @@ -737,7 +744,7 @@ # yield data files first for x in self.data_entries(matcher): yield x - for x in self.top_entries(): + for x in self.top_entries(phase=phase): yield x def copylist(self):