Mercurial > hg-stable
changeset 50538:862e3a13da44
store: rename `datafiles` to `data_entries`
The method is now returning StoreEntries let us rename the method for clarity.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 16 May 2023 10:43:36 +0200 |
parents | aede57466804 |
children | 32b4c2bbdb94 |
files | hgext/largefiles/lfutil.py hgext/largefiles/reposetup.py hgext/narrow/narrowcommands.py hgext/remotefilelog/contentstore.py hgext/remotefilelog/remotefilelogserver.py mercurial/repair.py mercurial/revlogutils/rewrite.py mercurial/store.py mercurial/verify.py tests/simplestorerepo.py |
diffstat | 10 files changed, 19 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py Mon May 15 22:03:39 2023 +0200 +++ b/hgext/largefiles/lfutil.py Tue May 16 10:43:36 2023 +0200 @@ -552,7 +552,7 @@ def islfilesrepo(repo): '''Return true if the repo is a largefile repo.''' if b'largefiles' in repo.requirements: - for entry in repo.store.datafiles(): + for entry in repo.store.data_entries(): if entry.is_revlog and shortnameslash in entry.target_id: return True
--- a/hgext/largefiles/reposetup.py Mon May 15 22:03:39 2023 +0200 +++ b/hgext/largefiles/reposetup.py Tue May 16 10:43:36 2023 +0200 @@ -460,7 +460,7 @@ if b'largefiles' in repo.requirements: return marker = lfutil.shortnameslash - for entry in repo.store.datafiles(): + for entry in repo.store.data_entries(): # XXX note that this match is not rooted and can wrongly match # directory ending with ".hglf" if entry.is_revlog and marker in entry.target_id:
--- a/hgext/narrow/narrowcommands.py Mon May 15 22:03:39 2023 +0200 +++ b/hgext/narrow/narrowcommands.py Tue May 16 10:43:36 2023 +0200 @@ -288,7 +288,7 @@ repair.strip(ui, unfi, tostrip, topic=b'narrow', backup=backup) todelete = [] - for entry in repo.store.datafiles(): + for entry in repo.store.data_entries(): if not entry.is_revlog: continue if entry.is_filelog:
--- a/hgext/remotefilelog/contentstore.py Mon May 15 22:03:39 2023 +0200 +++ b/hgext/remotefilelog/contentstore.py Tue May 16 10:43:36 2023 +0200 @@ -375,7 +375,7 @@ ledger.markdataentry(self, treename, node) ledger.markhistoryentry(self, treename, node) - for t, path, size in self._store.datafiles(): + for t, path, size in self._store.data_entries(): if path[:5] != b'meta/' or path[-2:] != b'.i': continue
--- a/hgext/remotefilelog/remotefilelogserver.py Mon May 15 22:03:39 2023 +0200 +++ b/hgext/remotefilelog/remotefilelogserver.py Tue May 16 10:43:36 2023 +0200 @@ -172,7 +172,7 @@ visit.append(fp) if scmutil.istreemanifest(repo): - for entry in repo.store.datafiles(): + for entry in repo.store.data_entries(): if not entry.is_revlog: continue if entry.is_manifestlog: @@ -181,7 +181,7 @@ # Return .d and .i files that do not match the shallow pattern match = state.match if match and not match.always(): - for entry in repo.store.datafiles(): + for entry in repo.store.data_entries(): if not entry.is_revlog: continue if not state.match(entry.target_id):
--- a/mercurial/repair.py Mon May 15 22:03:39 2023 +0200 +++ b/mercurial/repair.py Tue May 16 10:43:36 2023 +0200 @@ -445,7 +445,7 @@ if scmutil.istreemanifest(repo): # This logic is safe if treemanifest isn't enabled, but also # pointless, so we skip it if treemanifest isn't enabled. - for entry in repo.store.datafiles(): + for entry in repo.store.data_entries(): if not entry.is_revlog: continue if entry.revlog_type == store.FILEFLAGS_MANIFESTLOG:
--- a/mercurial/revlogutils/rewrite.py Mon May 15 22:03:39 2023 +0200 +++ b/mercurial/revlogutils/rewrite.py Tue May 16 10:43:36 2023 +0200 @@ -824,7 +824,7 @@ with context(): files = list( entry - for entry in repo.store.datafiles() + for entry in repo.store.data_entries() if entry.is_revlog and entry.is_filelog )
--- a/mercurial/store.py Mon May 15 22:03:39 2023 +0200 +++ b/mercurial/store.py Tue May 16 10:43:36 2023 +0200 @@ -654,7 +654,7 @@ rootstore = manifest.manifestrevlog(repo.nodeconstants, self.vfs) return manifest.manifestlog(self.vfs, repo, rootstore, storenarrowmatch) - def datafiles( + def data_entries( self, matcher=None, undecodable=None ) -> Generator[BaseStoreEntry, None, None]: """Like walk, but excluding the changelog and root manifest. @@ -735,7 +735,7 @@ are passed with matches the matcher """ # yield data files first - for x in self.datafiles(matcher): + for x in self.data_entries(matcher): yield x for x in self.topfiles(): yield x @@ -790,10 +790,12 @@ new.append((f2, value)) return new - def datafiles( + def data_entries( self, matcher=None, undecodable=None ) -> Generator[BaseStoreEntry, None, None]: - entries = super(encodedstore, self).datafiles(undecodable=undecodable) + entries = super(encodedstore, self).data_entries( + undecodable=undecodable + ) for entry in entries: if _match_tracked_entry(entry, matcher): yield entry @@ -992,7 +994,7 @@ def getsize(self, path): return self.rawvfs.stat(path).st_size - def datafiles( + def data_entries( self, matcher=None, undecodable=None ) -> Generator[BaseStoreEntry, None, None]: files = ((f, revlog_type(f)) for f in self.fncache)
--- a/mercurial/verify.py Mon May 15 22:03:39 2023 +0200 +++ b/mercurial/verify.py Tue May 16 10:43:36 2023 +0200 @@ -407,7 +407,7 @@ subdirs = set() revlogv1 = self.revlogv1 undecodable = [] - for entry in repo.store.datafiles(undecodable=undecodable): + for entry in repo.store.data_entries(undecodable=undecodable): for file_ in entry.files(): f = file_.unencoded_path size = file_.file_size(repo.store.vfs) @@ -475,7 +475,7 @@ storefiles = set() undecodable = [] - for entry in repo.store.datafiles(undecodable=undecodable): + for entry in repo.store.data_entries(undecodable=undecodable): for file_ in entry.files(): size = file_.file_size(repo.store.vfs) f = file_.unencoded_path
--- a/tests/simplestorerepo.py Mon May 15 22:03:39 2023 +0200 +++ b/tests/simplestorerepo.py Tue May 16 10:43:36 2023 +0200 @@ -664,8 +664,8 @@ class simplestore(store.encodedstore): - def datafiles(self, undecodable=None): - for x in super(simplestore, self).datafiles(): + def data_entries(self, undecodable=None): + for x in super(simplestore, self).data_entries(): yield x # Supplement with non-revlog files.