##// END OF EJS Templates
localrepo: use tryunlink
Ryan McElroy -
r31550:66c3ae6d default
parent child Browse files
Show More
@@ -2025,14 +2025,10 b' def aftertrans(files):'
2025 renamefiles = [tuple(t) for t in files]
2025 renamefiles = [tuple(t) for t in files]
2026 def a():
2026 def a():
2027 for vfs, src, dest in renamefiles:
2027 for vfs, src, dest in renamefiles:
2028 try:
2028 # if src and dest refer to a same file, vfs.rename is a no-op,
2029 # if src and dest refer to a same file, vfs.rename is a no-op,
2029 # leaving both src and dest on disk. delete dest to make sure
2030 # leaving both src and dest on disk. delete dest to make sure
2030 # the rename couldn't be such a no-op.
2031 # the rename couldn't be such a no-op.
2031 vfs.tryunlink(dest)
2032 vfs.unlink(dest)
2033 except OSError as ex:
2034 if ex.errno != errno.ENOENT:
2035 raise
2036 try:
2032 try:
2037 vfs.rename(src, dest)
2033 vfs.rename(src, dest)
2038 except OSError: # journal file does not yet exist
2034 except OSError: # journal file does not yet exist
General Comments 0
You need to be logged in to leave comments. Login now