Mercurial > hg
comparison mercurial/store.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 | d44e3c45f0e4 |
children | cf6e1d535602 |
comparison
equal
deleted
inserted
replaced
49305:53e9422a9b45 | 49306:2e726c934fcd |
---|---|
4 # | 4 # |
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 | 8 |
9 import errno | |
10 import functools | 9 import functools |
11 import os | 10 import os |
12 import re | 11 import re |
13 import stat | 12 import stat |
14 | 13 |
786 try: | 785 try: |
787 t = revlog_type(f) | 786 t = revlog_type(f) |
788 assert t is not None, f | 787 assert t is not None, f |
789 t |= FILEFLAGS_FILELOG | 788 t |= FILEFLAGS_FILELOG |
790 yield t, f, self.getsize(ef) | 789 yield t, f, self.getsize(ef) |
791 except OSError as err: | 790 except FileNotFoundError: |
792 if err.errno != errno.ENOENT: | 791 pass |
793 raise | |
794 | 792 |
795 def copylist(self): | 793 def copylist(self): |
796 d = ( | 794 d = ( |
797 b'bookmarks', | 795 b'bookmarks', |
798 b'narrowspec', | 796 b'narrowspec', |
823 def _exists(self, f): | 821 def _exists(self, f): |
824 ef = self.encode(f) | 822 ef = self.encode(f) |
825 try: | 823 try: |
826 self.getsize(ef) | 824 self.getsize(ef) |
827 return True | 825 return True |
828 except OSError as err: | 826 except FileNotFoundError: |
829 if err.errno != errno.ENOENT: | |
830 raise | |
831 # nonexistent entry | |
832 return False | 827 return False |
833 | 828 |
834 def __contains__(self, path): | 829 def __contains__(self, path): |
835 '''Checks if the store contains path''' | 830 '''Checks if the store contains path''' |
836 path = b"/".join((b"data", path)) | 831 path = b"/".join((b"data", path)) |