Patchwork [1,of,3,FOLLOW-UP] vfs: fix proxyvfs inheritance

login
register
mail settings
Submitter Boris Feld
Date Jan. 2, 2019, 11:29 a.m.
Message ID <b33239d75ded3c23d46f.1546428567@Laptop-Boris.lan>
Download mbox | patch
Permalink /patch/37418/
State Accepted
Headers show

Comments

Boris Feld - Jan. 2, 2019, 11:29 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1546421352 -3600
#      Wed Jan 02 10:29:12 2019 +0100
# Node ID b33239d75ded3c23d46fe50bb04e0dd3aac9ef9b
# Parent  9e593db5f1a1b08f812591439c831ace55bca321
# EXP-Topic vfs-audit
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b33239d75ded
vfs: fix proxyvfs inheritance

The proxyvfs class is designed to overwrite some of the vfs logic. Yet, it did
not use normal class inheritance. This is becoming an issue as `abstractvfs`
method could take precedence over their `proxyvfs` version.

We fix the inheritance chain to be as expected.
Pulkit Goyal - Jan. 2, 2019, 12:26 p.m.
On Wed, Jan 2, 2019 at 5:01 PM Boris Feld <boris.feld@octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1546421352 -3600
> #      Wed Jan 02 10:29:12 2019 +0100
> # Node ID b33239d75ded3c23d46fe50bb04e0dd3aac9ef9b
> # Parent  9e593db5f1a1b08f812591439c831ace55bca321
> # EXP-Topic vfs-audit
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> b33239d75ded
> vfs: fix proxyvfs inheritance
>
> The proxyvfs class is designed to overwrite some of the vfs logic. Yet, it
> did
> not use normal class inheritance. This is becoming an issue as
> `abstractvfs`
> method could take precedence over their `proxyvfs` version.
>
> We fix the inheritance chain to be as expected.
>

Queued this series, many thanks!
Yuya Nishihara - Jan. 3, 2019, 9:03 a.m.
On Wed, 02 Jan 2019 12:29:27 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1546421352 -3600
> #      Wed Jan 02 10:29:12 2019 +0100
> # Node ID b33239d75ded3c23d46fe50bb04e0dd3aac9ef9b
> # Parent  9e593db5f1a1b08f812591439c831ace55bca321
> # EXP-Topic vfs-audit
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b33239d75ded
> vfs: fix proxyvfs inheritance

> -class filtervfs(abstractvfs, proxyvfs):
> +class filtervfs(proxyvfs, abstractvfs):

Did you intentionally leave abstractvfs in the list?

> -class readonlyvfs(abstractvfs, proxyvfs):
> +class readonlyvfs(proxyvfs):
Boris FELD - Jan. 3, 2019, 11:19 a.m.
On 03/01/2019 10:03, Yuya Nishihara wrote:
> On Wed, 02 Jan 2019 12:29:27 +0100, Boris Feld wrote:
>> # HG changeset patch
>> # User Boris Feld <boris.feld@octobus.net>
>> # Date 1546421352 -3600
>> #      Wed Jan 02 10:29:12 2019 +0100
>> # Node ID b33239d75ded3c23d46fe50bb04e0dd3aac9ef9b
>> # Parent  9e593db5f1a1b08f812591439c831ace55bca321
>> # EXP-Topic vfs-audit
>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b33239d75ded
>> vfs: fix proxyvfs inheritance
>> -class filtervfs(abstractvfs, proxyvfs):
>> +class filtervfs(proxyvfs, abstractvfs):
> Did you intentionally leave abstractvfs in the list?
No, it's a mistake, I'm not sure what the status of this patch is as
Pulkit said it was queued but I don't see it on the commited repo.
Should I send a V2?
>
>> -class readonlyvfs(abstractvfs, proxyvfs):
>> +class readonlyvfs(proxyvfs):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Pulkit Goyal - Jan. 3, 2019, 2:34 p.m.
On Thu, Jan 3, 2019 at 4:50 PM Boris FELD <lothiraldan@gmail.com> wrote:

> On 03/01/2019 10:03, Yuya Nishihara wrote:
> > On Wed, 02 Jan 2019 12:29:27 +0100, Boris Feld wrote:
> >> # HG changeset patch
> >> # User Boris Feld <boris.feld@octobus.net>
> >> # Date 1546421352 -3600
> >> #      Wed Jan 02 10:29:12 2019 +0100
> >> # Node ID b33239d75ded3c23d46fe50bb04e0dd3aac9ef9b
> >> # Parent  9e593db5f1a1b08f812591439c831ace55bca321
> >> # EXP-Topic vfs-audit
> >> # Available At https://bitbucket.org/octobus/mercurial-devel/
> >> #              hg pull https://bitbucket.org/octobus/mercurial-devel/
> -r b33239d75ded
> >> vfs: fix proxyvfs inheritance
> >> -class filtervfs(abstractvfs, proxyvfs):
> >> +class filtervfs(proxyvfs, abstractvfs):
> > Did you intentionally leave abstractvfs in the list?
> No, it's a mistake, I'm not sure what the status of this patch is as
> Pulkit said it was queued but I don't see it on the commited repo.
> Should I send a V2?
>

I can see it here:
https://www.mercurial-scm.org/repo/hg-committed/rev/6498f0e03526
Boris Feld - Jan. 3, 2019, 2:44 p.m.
On 03/01/2019 15:34, Pulkit Goyal wrote:
>
>
> On Thu, Jan 3, 2019 at 4:50 PM Boris FELD <lothiraldan@gmail.com
> <mailto:lothiraldan@gmail.com>> wrote:
>
>     On 03/01/2019 10:03, Yuya Nishihara wrote:
>     > On Wed, 02 Jan 2019 12:29:27 +0100, Boris Feld wrote:
>     >> # HG changeset patch
>     >> # User Boris Feld <boris.feld@octobus.net
>     <mailto:boris.feld@octobus.net>>
>     >> # Date 1546421352 -3600
>     >> #      Wed Jan 02 10:29:12 2019 +0100
>     >> # Node ID b33239d75ded3c23d46fe50bb04e0dd3aac9ef9b
>     >> # Parent  9e593db5f1a1b08f812591439c831ace55bca321
>     >> # EXP-Topic vfs-audit
>     >> # Available At https://bitbucket.org/octobus/mercurial-devel/
>     >> #              hg pull
>     https://bitbucket.org/octobus/mercurial-devel/ -r b33239d75ded
>     >> vfs: fix proxyvfs inheritance
>     >> -class filtervfs(abstractvfs, proxyvfs):
>     >> +class filtervfs(proxyvfs, abstractvfs):
>     > Did you intentionally leave abstractvfs in the list?
>     No, it's a mistake, I'm not sure what the status of this patch is as
>     Pulkit said it was queued but I don't see it on the commited repo.
>     Should I send a V2?
>
>  
> I can see it here:
> https://www.mercurial-scm.org/repo/hg-committed/rev/6498f0e03526
>
Ok I see it now, I will send a V2.

Patch

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -523,7 +523,7 @@  class fncache(object):
             self._load()
         return iter(self.entries | self.addls)
 
-class _fncachevfs(vfsmod.abstractvfs, vfsmod.proxyvfs):
+class _fncachevfs(vfsmod.proxyvfs):
     def __init__(self, vfs, fnc, encode):
         vfsmod.proxyvfs.__init__(self, vfs)
         self.fncache = fnc
diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -469,7 +469,7 @@  class vfs(abstractvfs):
 
 opener = vfs
 
-class proxyvfs(object):
+class proxyvfs(abstractvfs):
     def __init__(self, vfs):
         self.vfs = vfs
 
@@ -481,7 +481,7 @@  class proxyvfs(object):
     def options(self, value):
         self.vfs.options = value
 
-class filtervfs(abstractvfs, proxyvfs):
+class filtervfs(proxyvfs, abstractvfs):
     '''Wrapper vfs for filtering filenames with a function.'''
 
     def __init__(self, vfs, filter):
@@ -499,7 +499,7 @@  class filtervfs(abstractvfs, proxyvfs):
 
 filteropener = filtervfs
 
-class readonlyvfs(abstractvfs, proxyvfs):
+class readonlyvfs(proxyvfs):
     '''Wrapper vfs preventing any writing.'''
 
     def __init__(self, vfs):