Mercurial > hg-stable
diff mercurial/store.py @ 46455: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 | 7c1367c0b5bc |
children | e9901d01d135 |
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):