Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlogutils/nodemap.py @ 49314: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 | 4fe46f96b56b |
comparison
equal
deleted
inserted
replaced
49313:53e9422a9b45 | 49314:2e726c934fcd |
---|---|
5 # | 5 # |
6 # This software may be used and distributed according to the terms of the | 6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. | 7 # GNU General Public License version 2 or any later version. |
8 | 8 |
9 | 9 |
10 import errno | |
11 import re | 10 import re |
12 import struct | 11 import struct |
13 | 12 |
14 from ..node import hex | 13 from ..node import hex |
15 | 14 |
81 except ValueError: | 80 except ValueError: |
82 # raised when the read file is too small | 81 # raised when the read file is too small |
83 data = b'' | 82 data = b'' |
84 else: | 83 else: |
85 data = fd.read(data_length) | 84 data = fd.read(data_length) |
86 except (IOError, OSError) as e: | 85 except FileNotFoundError: |
87 if e.errno == errno.ENOENT: | 86 return None |
88 return None | |
89 else: | |
90 raise | |
91 if len(data) < data_length: | 87 if len(data) < data_length: |
92 return None | 88 return None |
93 return docket, data | 89 return docket, data |
94 | 90 |
95 | 91 |