Patchwork [04,of,11] shelve: use tryunlink

login
register
mail settings
Submitter Ryan McElroy
Date March 21, 2017, 1:54 p.m.
Message ID <aa0458baf1599d8dc4c3.1490104466@devbig314.prn1.facebook.com>
Download mbox | patch
Permalink /patch/19519/
State Accepted
Headers show

Comments

Ryan McElroy - March 21, 2017, 1:54 p.m.
# HG changeset patch
# User Ryan McElroy <rmcelroy@fb.com>
# Date 1490104228 25200
#      Tue Mar 21 06:50:28 2017 -0700
# Node ID aa0458baf1599d8dc4c35d48609bd64141c38a09
# Parent  05060c142764cd34c9ad16127bd1b562f9548bd7
shelve: use tryunlink

Patch

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