store: use StoreEntry API instead of parsing filename in remotefilelog
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 15 May 2023 09:00:13 +0200
changeset 50485 5805b8b25426
parent 50484 17a822d7943e
child 50486 85c5b4b507af
store: use StoreEntry API instead of parsing filename in remotefilelog This is more explicit and more robust.
hgext/remotefilelog/remotefilelogserver.py
--- a/hgext/remotefilelog/remotefilelogserver.py	Mon May 15 08:59:56 2023 +0200
+++ b/hgext/remotefilelog/remotefilelogserver.py	Mon May 15 09:00:13 2023 +0200
@@ -173,19 +173,18 @@
 
             if scmutil.istreemanifest(repo):
                 for entry in repo.store.datafiles():
-                    u = entry.unencoded_path
-                    if u.startswith(b'meta/') and (
-                        u.endswith(b'.i') or u.endswith(b'.d')
-                    ):
+                    if not entry.is_revlog:
+                        continue
+                    if entry.revlog_type == store.FILEFLAGS_MANIFESTLOG:
                         yield entry
 
             # 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():
-                    u = entry.unencoded_path
-                    f = u[5:-2]  # trim data/...  and .i/.d
-                    if not state.match(f):
+                    if not entry.is_revlog:
+                        continue
+                    if not state.match(entry.target_id):
                         yield entry
 
             for x in repo.store.topfiles():