# HG changeset patch # User Pierre-Yves David # Date 1684133996 -7200 # Node ID 17a822d7943ed273c0556da1b64f7e064a85f03e # Parent 60e613f6a2299b44eecf38cd983bed414cd7d079 store: use StoreEntry API instead of parsing filename in narrow This is more explicit and more robust. diff -r 60e613f6a229 -r 17a822d7943e hgext/narrow/narrowcommands.py --- 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: