Patchwork [05,of,11] bookmarks: use tryunlink

login
register
mail settings
Submitter Ryan McElroy
Date March 21, 2017, 1:54 p.m.
Message ID <18b77e381c09564f56da.1490104467@devbig314.prn1.facebook.com>
Download mbox | patch
Permalink /patch/19522/
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 18b77e381c09564f56dafc5d2b0ec6ae826139ba
# Parent  aa0458baf1599d8dc4c35d48609bd64141c38a09
bookmarks: use tryunlink

Patch

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -131,11 +131,7 @@  class bmstore(dict):
                 finally:
                     f.close()
             else:
-                try:
-                    self._repo.vfs.unlink('bookmarks.current')
-                except OSError as inst:
-                    if inst.errno != errno.ENOENT:
-                        raise
+                self._repo.vfs.tryunlink('bookmarks.current')
         self._aclean = True
 
     def _write(self, fp):