mercurial/util.py
changeset 9530 ba8a86d86fd6
parent 9524 effa05849027
parent 9529 e61e7b3e46d0
child 9552 f0417b6ff98a
equal deleted inserted replaced
9524:effa05849027 9530:ba8a86d86fd6
   442                     return temp
   442                     return temp
   443             raise IOError, (errno.EEXIST, "No usable temporary filename found")
   443             raise IOError, (errno.EEXIST, "No usable temporary filename found")
   444 
   444 
   445         temp = tempname(dst)
   445         temp = tempname(dst)
   446         os.rename(dst, temp)
   446         os.rename(dst, temp)
   447         os.unlink(temp)
   447         try:
       
   448             os.unlink(temp)
       
   449         except:
       
   450             # Some rude AV-scanners on Windows may cause the unlink to
       
   451             # fail. Not aborting here just leaks the temp file, whereas
       
   452             # aborting at this point may leave serious inconsistencies.
       
   453             # Ideally, we would notify the user here.
       
   454             pass
   448         os.rename(src, dst)
   455         os.rename(src, dst)
   449 
   456 
   450 def unlink(f):
   457 def unlink(f):
   451     """unlink and remove the directory if it is empty"""
   458     """unlink and remove the directory if it is empty"""
   452     os.unlink(f)
   459     os.unlink(f)