[PATCH 07 of 14] shelve: use tryunlink

Ryan McElroy rm at fb.com
Mon Mar 20 22:10:50 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 79c8e7ca7cb92d208c4c72454f06f11e6ef99d49
# Parent  640adb7ea3cd568cd046ee55ede19849082595ce
shelve: use tryunlink

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -236,11 +236,7 @@ def cleanupoldbackups(repo):
             continue
         base = f[:-(1 + len(patchextension))]
         for ext in shelvefileextensions:
-            try:
-                vfs.unlink(base + '.' + ext)
-            except OSError as err:
-                if err.errno != errno.ENOENT:
-                    raise
+            vfs.tryunlink(base + '.' + ext)
 
 def _aborttransaction(repo):
     '''Abort current transaction for shelve/unshelve, but keep dirstate


More information about the Mercurial-devel mailing list