[PATCH 10 of 11] vfs: use tryunlink

Yuya Nishihara yuya at tcha.org
Tue Mar 21 10:25:16 EDT 2017


On Tue, 21 Mar 2017 06:54:32 -0700, Ryan McElroy wrote:
> # HG changeset patch
> # User Ryan McElroy <rmcelroy at fb.com>
> # Date 1490104228 25200
> #      Tue Mar 21 06:50:28 2017 -0700
> # Node ID ba24c5cdac8654da7d0d510e3643226e69cef187
> # Parent  684d201e116b65e6dff5f9494de064591da57b07
> vfs: use tryunlink
> 
> diff --git a/mercurial/vfs.py b/mercurial/vfs.py
> --- a/mercurial/vfs.py
> +++ b/mercurial/vfs.py
> @@ -401,10 +401,7 @@ class vfs(abstractvfs):
>      def symlink(self, src, dst):
>          self.audit(dst)
>          linkname = self.join(dst)
> -        try:
> -            os.unlink(linkname)
> -        except OSError:
> -            pass
> +        util.tryunlink(linkname)

I tracked history of this code down to 41ad4105dde9, and there seems no
practical reason to suppress all kinds of OSError. Looks good.


More information about the Mercurial-devel mailing list