diff hgsubversion/stupid.py @ 557:d74bf020a61c

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.
author Augie Fackler <durin42@gmail.com>
date Sun, 14 Feb 2010 14:04:56 -0600
parents 2d44461e8617
children 8e025a6f0db4
line wrap: on
line diff
--- 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: