comparison mercurial/store.py @ 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 7c1367c0b5bc
children e9901d01d135
comparison
equal deleted inserted replaced
46382:d4c8b4b90ecb 46383:374d7fff7cb5
385 b'phaseroots', 385 b'phaseroots',
386 b'obsstore', 386 b'obsstore',
387 b'requires', 387 b'requires',
388 ] 388 ]
389 389
390 REVLOG_FILES_EXT = (b'.i', b'.d', b'.n', b'.nd')
391
390 392
391 def isrevlog(f, kind, st): 393 def isrevlog(f, kind, st):
392 if kind != stat.S_IFREG: 394 if kind != stat.S_IFREG:
393 return False 395 return False
394 if f[-2:] in (b'.i', b'.d', b'.n'): 396 return f.endswith(REVLOG_FILES_EXT)
395 return True
396 return f[-3:] == b'.nd'
397 397
398 398
399 class basicstore(object): 399 class basicstore(object):
400 '''base class for local repository stores''' 400 '''base class for local repository stores'''
401 401