[PATCH 06 of 14] vfs: add tryunlink method
Ryan McElroy
rm at fb.com
Mon Mar 20 22:10:49 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 640adb7ea3cd568cd046ee55ede19849082595ce
# Parent 2908e421fa11b827f880de73cfa53667cc0635cb
vfs: add tryunlink method
Thoughout hg code, we see a pattern of attempting to remove a file and then
catching and ignoring any errors due to a missing file in the calling code.
Let's unify this pattern in a single implementation in the vfs layer.
diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -223,6 +223,9 @@ class abstractvfs(object):
def unlink(self, path=None):
return util.unlink(self.join(path))
+ def tryunlink(self, path=None):
+ return util.tryunlink(self.join(path))
+
def unlinkpath(self, path=None, ignoremissing=False):
return util.unlinkpath(self.join(path), ignoremissing=ignoremissing)
More information about the Mercurial-devel
mailing list