dirstate: use tryunlink
authorRyan McElroy <rmcelroy@fb.com>
Tue, 21 Mar 2017 06:50:28 -0700
changeset 31553 ddadb6b0b58e
parent 31552 b71143b10f74
child 31554 ce4ddcda868b
dirstate: use tryunlink
mercurial/dirstate.py
--- 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),