mercurial/win32.py
changeset 52640 24ee91ba9aa8
parent 51859 f4733654f144
equal deleted inserted replaced
52639:9db77d46de79 52640:24ee91ba9aa8
   716     '''try to implement POSIX' unlink semantics on Windows'''
   716     '''try to implement POSIX' unlink semantics on Windows'''
   717 
   717 
   718     if os.path.isdir(path):
   718     if os.path.isdir(path):
   719         # use EPERM because it is POSIX prescribed value, even though
   719         # use EPERM because it is POSIX prescribed value, even though
   720         # unlink(2) on directories returns EISDIR on Linux
   720         # unlink(2) on directories returns EISDIR on Linux
   721         raise IOError(
   721         raise OSError(
   722             errno.EPERM,
   722             errno.EPERM,
   723             r"Unlinking directory not permitted: '%s'"
   723             r"Unlinking directory not permitted: '%s'"
   724             % encoding.strfromlocal(path),
   724             % encoding.strfromlocal(path),
   725         )
   725         )
   726 
   726 
   747             os.rename(path, temp)
   747             os.rename(path, temp)
   748             break
   748             break
   749         except FileExistsError:
   749         except FileExistsError:
   750             pass
   750             pass
   751     else:
   751     else:
   752         raise IOError(errno.EEXIST, "No usable temporary filename found")
   752         raise OSError(errno.EEXIST, "No usable temporary filename found")
   753 
   753 
   754     try:
   754     try:
   755         os.unlink(temp)
   755         os.unlink(temp)
   756     except OSError:
   756     except OSError:
   757         # The unlink might have failed because the READONLY attribute may heave
   757         # The unlink might have failed because the READONLY attribute may heave