Mercurial > hg
changeset 50484:17a822d7943e
store: use StoreEntry API instead of parsing filename in narrow
This is more explicit and more robust.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 15 May 2023 08:59:56 +0200 |
parents | 60e613f6a229 |
children | 5805b8b25426 |
files | hgext/narrow/narrowcommands.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/narrow/narrowcommands.py Mon May 15 08:59:38 2023 +0200 +++ b/hgext/narrow/narrowcommands.py Mon May 15 08:59:56 2023 +0200 @@ -31,6 +31,7 @@ repoview, requirements, sparse, + store, util, wireprototypes, ) @@ -289,14 +290,14 @@ todelete = [] for entry in repo.store.datafiles(): - f = entry.unencoded_path - if f.startswith(b'data/'): - file = f[5:-2] - if not newmatch(file): + if not entry.is_revlog: + continue + if entry.revlog_type == store.FILEFLAGS_FILELOG: + if not newmatch(entry.target_id): for file_ in entry.files(): todelete.append(file_.unencoded_path) - elif f.startswith(b'meta/'): - dir = f[5:-13] + elif entry.revlog_type == store.FILEFLAGS_MANIFESTLOG: + dir = entry.target_id dirs = sorted(pathutil.dirs({dir})) + [dir] include = True for d in dirs: