changeset 46383:374d7fff7cb5

store: use `endswith` to detect revlog extension Suggested by Gregory Szorc. Differential Revision: https://phab.mercurial-scm.org/D9865
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 25 Jan 2021 16:34:43 +0100
parents d4c8b4b90ecb
children 7bb31c367847
files mercurial/store.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/store.py	Tue Dec 01 12:59:33 2020 -0500
+++ b/mercurial/store.py	Mon Jan 25 16:34:43 2021 +0100
@@ -387,13 +387,13 @@
     b'requires',
 ]
 
+REVLOG_FILES_EXT = (b'.i', b'.d', b'.n', b'.nd')
+
 
 def isrevlog(f, kind, st):
     if kind != stat.S_IFREG:
         return False
-    if f[-2:] in (b'.i', b'.d', b'.n'):
-        return True
-    return f[-3:] == b'.nd'
+    return f.endswith(REVLOG_FILES_EXT)
 
 
 class basicstore(object):