comparison mercurial/lock.py @ 49306:2e726c934fcd

py3: catch FileNotFoundError instead of checking errno == ENOENT
author Manuel Jacob <me@manueljacob.de>
date Tue, 31 May 2022 22:50:01 +0200
parents 642e31cb55f0
children 050dc8730858
comparison
equal deleted inserted replaced
49305:53e9422a9b45 49306:2e726c934fcd
309 Returns None if no lock exists, pid for old-style locks, and host:pid 309 Returns None if no lock exists, pid for old-style locks, and host:pid
310 for new-style locks. 310 for new-style locks.
311 """ 311 """
312 try: 312 try:
313 return self.vfs.readlock(self.f) 313 return self.vfs.readlock(self.f)
314 except (OSError, IOError) as why: 314 except FileNotFoundError:
315 if why.errno == errno.ENOENT: 315 return None
316 return None
317 raise
318 316
319 def _lockshouldbebroken(self, locker): 317 def _lockshouldbebroken(self, locker):
320 if locker is None: 318 if locker is None:
321 return False 319 return False
322 try: 320 try: