Mercurial > hg
comparison hgext/rebase.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 | cfff73cab721 |
comparison
equal
deleted
inserted
replaced
49305:53e9422a9b45 | 49306:2e726c934fcd |
---|---|
13 For more information: | 13 For more information: |
14 https://mercurial-scm.org/wiki/RebaseExtension | 14 https://mercurial-scm.org/wiki/RebaseExtension |
15 ''' | 15 ''' |
16 | 16 |
17 | 17 |
18 import errno | |
19 import os | 18 import os |
20 | 19 |
21 from mercurial.i18n import _ | 20 from mercurial.i18n import _ |
22 from mercurial.node import ( | 21 from mercurial.node import ( |
23 nullrev, | 22 nullrev, |
1938 """Restore previously stored collapse message""" | 1937 """Restore previously stored collapse message""" |
1939 try: | 1938 try: |
1940 f = repo.vfs(b"last-message.txt") | 1939 f = repo.vfs(b"last-message.txt") |
1941 collapsemsg = f.readline().strip() | 1940 collapsemsg = f.readline().strip() |
1942 f.close() | 1941 f.close() |
1943 except IOError as err: | 1942 except FileNotFoundError: |
1944 if err.errno != errno.ENOENT: | |
1945 raise | |
1946 if isabort: | 1943 if isabort: |
1947 # Oh well, just abort like normal | 1944 # Oh well, just abort like normal |
1948 collapsemsg = b'' | 1945 collapsemsg = b'' |
1949 else: | 1946 else: |
1950 raise error.Abort(_(b'missing .hg/last-message.txt for rebase')) | 1947 raise error.Abort(_(b'missing .hg/last-message.txt for rebase')) |