[PATCH 1 of 7] vfs: use propertycache for open

Yuya Nishihara yuya at tcha.org
Sat Aug 6 03:18:50 UTC 2016


On Fri, 05 Aug 2016 15:59:14 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1470322610 -7200
> #      Thu Aug 04 16:56:50 2016 +0200
> # Node ID 9b65c0820c940442454e5f92a9475c4ec97f705c
> # Parent  73ff159923c1f05899c27238409ca398342d9ae0
> # EXP-Topic vfsward
> vfs: use propertycache for open

Queued this one, thanks.

> --- a/mercurial/scmutil.py	Mon Aug 01 13:14:13 2016 -0400
> +++ b/mercurial/scmutil.py	Thu Aug 04 16:56:50 2016 +0200
> @@ -256,17 +256,15 @@ class abstractvfs(object):
>                  raise
>          return []
>  
> -    def open(self, path, mode="r", text=False, atomictemp=False,
> -             notindexed=False, backgroundclose=False):
> +    @util.propertycache
> +    def open(self):
>          '''Open ``path`` file, which is relative to vfs root.
>  
>          Newly created directories are marked as "not to be indexed by
>          the content indexing service", if ``notindexed`` is specified
>          for "write" mode access.
>          '''
> -        self.open = self.__call__
> -        return self.__call__(path, mode, text, atomictemp, notindexed,
> -                             backgroundclose=backgroundclose)
> +        return self.__call__

But I think we should deprecate either __call__ or open. Keeping bound method
creates reference cycle.



More information about the Mercurial-devel mailing list