comparison mercurial/util.py @ 9544:b6b0c42739e9

Merge with crew-stable
author Steve Borho <steve@borho.org>
date Tue, 06 Oct 2009 16:08:38 -0500
parents 4368f582c806 e61e7b3e46d0
children 7732606b0767
comparison
equal deleted inserted replaced
9543:56a5f80556f5 9544:b6b0c42739e9
425 return temp 425 return temp
426 raise IOError, (errno.EEXIST, "No usable temporary filename found") 426 raise IOError, (errno.EEXIST, "No usable temporary filename found")
427 427
428 temp = tempname(dst) 428 temp = tempname(dst)
429 os.rename(dst, temp) 429 os.rename(dst, temp)
430 os.unlink(temp) 430 try:
431 os.unlink(temp)
432 except:
433 # Some rude AV-scanners on Windows may cause the unlink to
434 # fail. Not aborting here just leaks the temp file, whereas
435 # aborting at this point may leave serious inconsistencies.
436 # Ideally, we would notify the user here.
437 pass
431 os.rename(src, dst) 438 os.rename(src, dst)
432 439
433 def unlink(f): 440 def unlink(f):
434 """unlink and remove the directory if it is empty""" 441 """unlink and remove the directory if it is empty"""
435 os.unlink(f) 442 os.unlink(f)