[PATCH 13 of 14] vfs: use unlink

Ryan McElroy rm at fb.com
Tue Mar 21 09:47:49 EDT 2017



On 3/21/17 11:30 AM, Ryan McElroy wrote:
>
>
> On 3/21/17 3:28 AM, Jun Wu wrote:
>> Excerpts from Ryan McElroy's message of 2017-03-20 19:10:56 -0700:
>>> # HG changeset patch
>>> # User Ryan McElroy <rmcelroy at fb.com>
>>> # Date 1490059858 25200
>>> #      Mon Mar 20 18:30:58 2017 -0700
>>> # Node ID 912717e0a0921df8cb8440ce69185850e53788ba
>>> # Parent  f405f3bb1b9686322545a61d2f8df45ff53b4527
>>> vfs: use unlink
>>>
>>> diff --git a/mercurial/vfs.py b/mercurial/vfs.py
>>> --- a/mercurial/vfs.py
>>> +++ b/mercurial/vfs.py
>>> @@ -400,10 +400,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)
>> This could probably be changed to "self.tryunlink(dst)".
> Sure, that would work for me too.

Actually, inspecting the code more, this would be a bad change. 
Currently, the join only happens once, and the joined path is reused 
multiple times. It makes more sense to keep it this way.
>>
>>> util.makedirs(os.path.dirname(linkname), self.createmode)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.mercurial-2Dscm.org_mailman_listinfo_mercurial-2Ddevel&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=Jw8rundaE7TbmqBYd1txIQ&m=Nn7tE60VQ1b5sIq5uOLoPMtxQAnZVZmpx7aCKF3wXtg&s=C_CXEsd2lAxKXz_2kyfusEobHGt_1YioCaenrZ0f_l8&e= 




More information about the Mercurial-devel mailing list