# HG changeset patch
# User Ryan McElroy <rmcelroy@fb.com>
# Date 2017-03-21 13:50:28
# Node ID ddadb6b0b58e908bf46f803edd8df435ed1b579a
# Parent  b71143b10f74fa4316e6bdfc26a16b2179f2c2ea

dirstate: use tryunlink

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1262,8 +1262,7 @@ class dirstate(object):
 
         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),