diff --git a/mercurial/posix.py b/mercurial/posix.py --- a/mercurial/posix.py +++ b/mercurial/posix.py @@ -105,7 +105,7 @@ def setflags(f, l, x): fp = open(f) data = fp.read() fp.close() - os.unlink(f) + unlink(f) try: os.symlink(data, f) except OSError: @@ -118,7 +118,7 @@ def setflags(f, l, x): if stat.S_ISLNK(s): # switch link to file data = os.readlink(f) - os.unlink(f) + unlink(f) fp = open(f, "w") fp.write(data) fp.close() @@ -187,9 +187,9 @@ def checkexec(path): # check-exec is exec and check-no-exec is not exec return True # checknoexec exists but is exec - delete it - os.unlink(checknoexec) + unlink(checknoexec) # checkisexec exists but is not exec - delete it - os.unlink(checkisexec) + unlink(checkisexec) # check using one file, leave it as checkisexec checkdir = cachedir @@ -210,7 +210,7 @@ def checkexec(path): return True finally: if fn is not None: - os.unlink(fn) + unlink(fn) except (IOError, OSError): # we don't care, the user probably won't be able to commit anyway return False @@ -248,12 +248,12 @@ def checklink(path): try: os.symlink(target, name) if cachedir is None: - os.unlink(name) + unlink(name) else: try: os.rename(name, checklink) except OSError: - os.unlink(name) + unlink(name) return True except OSError as inst: # link creation might race, try again @@ -268,7 +268,7 @@ def checklink(path): except OSError as inst: # sshfs might report failure while successfully creating the link if inst[0] == errno.EIO and os.path.exists(name): - os.unlink(name) + unlink(name) return False def checkosfilename(path): @@ -539,7 +539,7 @@ def makedir(path, notindexed): def unlinkpath(f, ignoremissing=False): """unlink and remove the directory if it is empty""" try: - os.unlink(f) + unlink(f) except OSError as e: if not (ignoremissing and e.errno == errno.ENOENT): raise