# HG changeset patch # User Pierre-Yves David # Date 2021-01-25 15:34:43 # Node ID 374d7fff7cb5dc0e291e59d469aeb1c5f24a7639 # Parent d4c8b4b90ecb9df37b64569f89a8921c1083ac54 store: use `endswith` to detect revlog extension Suggested by Gregory Szorc. Differential Revision: https://phab.mercurial-scm.org/D9865 diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -387,13 +387,13 @@ def _calcmode(vfs): 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):