comparison mercurial/util.py @ 9530:ba8a86d86fd6

Merge with -crew-stable
author Matt Mackall <mpm@selenic.com>
date Wed, 07 Oct 2009 23:25:41 -0500
parents effa05849027 e61e7b3e46d0
children f0417b6ff98a
comparison
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)