# HG changeset patch # User Ryan McElroy # Date 1490104228 25200 # Node ID fad440db3565eacf176874530a95dc545142d06c # Parent bd9daafbf87cb29913846ccb2d523bd60331c9c0 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 -r bd9daafbf87c -r fad440db3565 mercurial/vfs.py --- 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)