changeset 31553:ddadb6b0b58e

dirstate: use tryunlink
author Ryan McElroy <rmcelroy@fb.com>
date Tue, 21 Mar 2017 06:50:28 -0700
parents b71143b10f74
children ce4ddcda868b
files mercurial/dirstate.py
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Tue Mar 21 06:50:28 2017 -0700
+++ b/mercurial/dirstate.py	Tue Mar 21 06:50:28 2017 -0700
@@ -1262,8 +1262,7 @@
 
         backupname = prefix + self._filename + suffix
         assert backupname != filename
-        if self._opener.exists(backupname):
-            self._opener.unlink(backupname)
+        self._opener.tryunlink(backupname)
         # hardlink backup is okay because _writedirstate is always called
         # with an "atomictemp=True" file.
         util.copyfile(self._opener.join(filename),