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.
--- a/mercurial/vfs.py Tue Mar 21 06:50:28 2017 -0700
+++ b/mercurial/vfs.py Tue Mar 21 06:50:28 2017 -0700
@@ -223,6 +223,10 @@
def unlink(self, path=None):
return util.unlink(self.join(path))
+ def tryunlink(self, path=None):
+ """Attempt to remove a file, ignoring missing file errors."""
+ util.tryunlink(self.join(path))
+
def unlinkpath(self, path=None, ignoremissing=False):
return util.unlinkpath(self.join(path), ignoremissing=ignoremissing)