Mercurial > public > mercurial-scm > hg
comparison mercurial/commit.py @ 49312:fce591256085
commit: remove special handling of IOError (actually dead code)
In the past, IOError was used to mark a file as removed. The differentiation
between OSError and IOError in this place was introduced in e553a425751d, to
avoid that ?normal? OSErrors / IOErrors accidentally mark files as removed.
This weird internal API was removed in 650b5b6e75ed. It seems like that
changeset should have removed the differentiation, at least I don?t see any
reason for keeping it.
On Python 3, OSError and IOError are aliased. Therefore the removed code was
actually dead.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Wed, 01 Jun 2022 01:30:48 +0200 |
parents | 6000f5b25c9b |
children | 421c9b3f2f4e |
comparison
equal
deleted
inserted
replaced
49311:defc369d705e | 49312:fce591256085 |
---|---|
1 # commit.py - fonction to perform commit | 1 # commit.py - fonction to perform commit |
2 # | 2 # |
3 # This software may be used and distributed according to the terms of the | 3 # This software may be used and distributed according to the terms of the |
4 # GNU General Public License version 2 or any later version. | 4 # GNU General Public License version 2 or any later version. |
5 | 5 |
6 | |
7 import errno | |
8 | 6 |
9 from .i18n import _ | 7 from .i18n import _ |
10 from .node import ( | 8 from .node import ( |
11 hex, | 9 hex, |
12 nullrev, | 10 nullrev, |
248 files.mark_touched(f) | 246 files.mark_touched(f) |
249 m.setflag(f, fctx.flags()) | 247 m.setflag(f, fctx.flags()) |
250 except OSError: | 248 except OSError: |
251 repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f)) | 249 repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f)) |
252 raise | 250 raise |
253 except IOError as inst: | |
254 errcode = getattr(inst, 'errno', errno.ENOENT) | |
255 if error or errcode and errcode != errno.ENOENT: | |
256 repo.ui.warn(_(b"trouble committing %s!\n") % uipathfn(f)) | |
257 raise | |
258 | 251 |
259 # update manifest | 252 # update manifest |
260 removed = [f for f in removed if f in m1 or f in m2] | 253 removed = [f for f in removed if f in m1 or f in m2] |
261 drop = sorted([f for f in removed if f in m]) | 254 drop = sorted([f for f in removed if f in m]) |
262 for f in drop: | 255 for f in drop: |