[PATCH 11 of 14] dirstate: use tryunlink

Ryan McElroy rm at fb.com
Mon Mar 20 22:10:54 EDT 2017


# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1490059858 25200
#      Mon Mar 20 18:30:58 2017 -0700
# Node ID 87d67dea66e7820d59153d74ce7cf4fe809323c9
# Parent  3228faef45885c9f931fb88ae3b796d923cde7c2
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),


More information about the Mercurial-devel mailing list