# HG changeset patch # User Augie Fackler # Date 1266177896 21600 # Node ID d74bf020a61c6c503bcff697ea01f5afdcd7fc80 # Parent 8522f8ef799e3528f47d19335e6437ced6491c22 replay/stupid: raise the correct errno in IOError to fix hg >= e553a425751d Basically, all the IOErrors we ever raise inside a file commit function that is sent to commitctx should be ENOENT. This suggests a change should be made in commitctx to not overload IOError. diff --git a/hgsubversion/replay.py b/hgsubversion/replay.py --- a/hgsubversion/replay.py +++ b/hgsubversion/replay.py @@ -144,8 +144,7 @@ def convert_rev(ui, meta, svn, r, tbdelt def filectxfn(repo, memctx, path): current_file = files[path] if current_file in current.deleted: - raise IOError(errno.EBADF, - 'Operation on deleted file attempted') + raise IOError(errno.ENOENT, '%s is deleted' % path) copied = current.copies.get(current_file) flags = parentctx.flags(path) is_exec = current.execfiles.get(current_file, 'x' in flags) @@ -192,7 +191,7 @@ def convert_rev(ui, meta, svn, r, tbdelt parent_ctx = meta.repo.changectx(ha) def del_all_files(*args): - raise IOError + raise IOError(errno.ENOENT, 'deleting all files') # True here meant nuke all files, shouldn't happen with branch closing if current.emptybranches[branch]: #pragma: no cover diff --git a/hgsubversion/stupid.py b/hgsubversion/stupid.py --- a/hgsubversion/stupid.py +++ b/hgsubversion/stupid.py @@ -224,7 +224,7 @@ def diff_branchrev(ui, svn, meta, branch def filectxfn(repo, memctx, path): if path in files_data and files_data[path] is None: - raise IOError(errno.EBADF, 'No data configured for file ' + path) + raise IOError(errno.ENOENT, '%s is deleted' % path) if path in binary_files or path in unknown_files: pa = path @@ -597,14 +597,12 @@ def convert_rev(ui, meta, svn, r, tbdelt def filectxfn(repo, memctx, path): if path == '.hgsvnexternals': if not externals: - raise IOError(errno.EINVAL, - '.hgsvnexternals exists, but externals are ' - 'not configured') + raise IOError(errno.ENOENT, 'no externals') return context.memfilectx(path=path, data=externals.write(), islink=False, isexec=False, copied=None) for bad in bad_branch_paths[b]: if path.startswith(bad): - raise IOError(errno.EINVAL, 'Path %s is bad' % path) + raise IOError(errno.ENOENT, 'Path %s is bad' % path) return filectxfn2(repo, memctx, path) if '' in files_touched: diff --git a/tests/test_push_command.py b/tests/test_push_command.py --- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -55,7 +55,7 @@ class PushTests(test_util.TestBase): repo = self.repo def file_callback(repo, memctx, path): return context.memfilectx( - path=path, data='foo', islink=False, + path=path, data='foo', islink=False, isexec=False, copied=False) ctx = context.memctx(repo, (repo['default'].node(), node.nullid), @@ -302,7 +302,7 @@ class PushTests(test_util.TestBase): def test_delete_file(self): repo = self.repo def file_callback(repo, memctx, path): - raise IOError(errno.EBADF, 'Operation on deleted file attempted') + raise IOError(errno.ENOENT, '%s is deleted' % path) old_files = set(repo['default'].manifest().keys()) ctx = context.memctx(repo, (repo['default'].node(), node.nullid),