Patchwork [5,of,5] localrepo: deprecated 'repo.opener' (API)

login
register
mail settings
Submitter Pierre-Yves David
Date March 2, 2017, 2:58 a.m.
Message ID <aacf8b01b81483b4815a.1488423525@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18867/
State Accepted
Headers show

Comments

Pierre-Yves David - March 2, 2017, 2:58 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1470398170 -7200
#      Fri Aug 05 13:56:10 2016 +0200
# Node ID aacf8b01b81483b4815a974f17d0ff5d214c4d3d
# Parent  437a39859c33901ea29cd22341d93be752e4acc0
# EXP-Topic vfs.cleanup
localrepo: deprecated 'repo.opener' (API)

The "new" 'repo.vfs' attribute have been around for almost 5 years. I think we
can deprecate the old form now ;-)
Ryan McElroy - March 2, 2017, 4:23 p.m.
This series looks good to me. I'd suggest changing the past-tense 
"deprecated" to the present-tense "deprecate" in the titles in-flight.


On 3/1/17 6:58 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1470398170 -7200
> #      Fri Aug 05 13:56:10 2016 +0200
> # Node ID aacf8b01b81483b4815a974f17d0ff5d214c4d3d
> # Parent  437a39859c33901ea29cd22341d93be752e4acc0
> # EXP-Topic vfs.cleanup
> localrepo: deprecated 'repo.opener' (API)
>
> The "new" 'repo.vfs' attribute have been around for almost 5 years. I think we
> can deprecate the old form now ;-)
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -266,7 +266,6 @@ class localrepository(object):
>           self.nofsauditor = pathutil.pathauditor(self.root, self._checknested,
>                                                   realfs=False)
>           self.vfs = scmutil.vfs(self.path)
> -        self.opener = self.vfs
>           self.baseui = baseui
>           self.ui = baseui.copy()
>           self.ui.copy = baseui.copy # prevent copying repo configuration
> @@ -379,6 +378,11 @@ class localrepository(object):
>           self.ui.deprecwarn("use 'repo.wvfs' instead of 'repo.wopener'", '4.2')
>           return self.wvfs
>   
> +    @property
> +    def opener(self):
> +        self.ui.deprecwarn("use 'repo.vfs' instead of 'repo.opener'", '4.2')
> +        return self.vfs
> +
>       def close(self):
>           self._writecaches()
>   
> diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
> --- a/mercurial/statichttprepo.py
> +++ b/mercurial/statichttprepo.py
> @@ -123,7 +123,6 @@ class statichttprepository(localrepo.loc
>   
>           vfsclass = build_opener(ui, authinfo)
>           self.vfs = vfsclass(self.path)
> -        self.opener = self.vfs
>           self._phasedefaults = []
>   
>           self.names = namespaces.namespaces()
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@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=pGe4-AWiOAPibuWIRfURjzzHLk5Xnfg7vTq3aCWDwyM&s=W8xRG1nGSGlZascbfPeFdqDPaF3a3XY5lj-hewgtrNw&e=
Yuya Nishihara - March 3, 2017, 1:47 p.m.
On Thu, 2 Mar 2017 08:23:09 -0800, Ryan McElroy wrote:
> This series looks good to me. I'd suggest changing the past-tense 
> "deprecated" to the present-tense "deprecate" in the titles in-flight.

Yeah, queued these, thanks.
Yuya Nishihara - March 3, 2017, 1:50 p.m.
On Thu, 02 Mar 2017 03:58:45 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1470398170 -7200
> #      Fri Aug 05 13:56:10 2016 +0200
> # Node ID aacf8b01b81483b4815a974f17d0ff5d214c4d3d
> # Parent  437a39859c33901ea29cd22341d93be752e4acc0
> # EXP-Topic vfs.cleanup
> localrepo: deprecated 'repo.opener' (API)

It appears fsmonitor still use repo.opener. Can you fix it as a follow up?
Pierre-Yves David - March 3, 2017, 3:42 p.m.
On 03/03/2017 02:50 PM, Yuya Nishihara wrote:
> On Thu, 02 Mar 2017 03:58:45 +0100, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
>> # Date 1470398170 -7200
>> #      Fri Aug 05 13:56:10 2016 +0200
>> # Node ID aacf8b01b81483b4815a974f17d0ff5d214c4d3d
>> # Parent  437a39859c33901ea29cd22341d93be752e4acc0
>> # EXP-Topic vfs.cleanup
>> localrepo: deprecated 'repo.opener' (API)
>
> It appears fsmonitor still use repo.opener. Can you fix it as a follow up?

Yep, sent. It appears, fsmonitor is not tested at all by default :-/
Durham Goode - March 7, 2017, 8:56 p.m.
On 3/3/17 7:42 AM, Pierre-Yves David wrote:
>
>
> On 03/03/2017 02:50 PM, Yuya Nishihara wrote:
>> On Thu, 02 Mar 2017 03:58:45 +0100, Pierre-Yves David wrote:
>>> # HG changeset patch
>>> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
>>> # Date 1470398170 -7200
>>> #      Fri Aug 05 13:56:10 2016 +0200
>>> # Node ID aacf8b01b81483b4815a974f17d0ff5d214c4d3d
>>> # Parent  437a39859c33901ea29cd22341d93be752e4acc0
>>> # EXP-Topic vfs.cleanup
>>> localrepo: deprecated 'repo.opener' (API)
>>
>> It appears fsmonitor still use repo.opener. Can you fix it as a follow
>> up?
>
> Yep, sent. It appears, fsmonitor is not tested at all by default :-/

I didn't see the patch on the list (or my email search skills are just 
bad), so I sent a patch to fix this.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -266,7 +266,6 @@  class localrepository(object):
         self.nofsauditor = pathutil.pathauditor(self.root, self._checknested,
                                                 realfs=False)
         self.vfs = scmutil.vfs(self.path)
-        self.opener = self.vfs
         self.baseui = baseui
         self.ui = baseui.copy()
         self.ui.copy = baseui.copy # prevent copying repo configuration
@@ -379,6 +378,11 @@  class localrepository(object):
         self.ui.deprecwarn("use 'repo.wvfs' instead of 'repo.wopener'", '4.2')
         return self.wvfs
 
+    @property
+    def opener(self):
+        self.ui.deprecwarn("use 'repo.vfs' instead of 'repo.opener'", '4.2')
+        return self.vfs
+
     def close(self):
         self._writecaches()
 
diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -123,7 +123,6 @@  class statichttprepository(localrepo.loc
 
         vfsclass = build_opener(ui, authinfo)
         self.vfs = vfsclass(self.path)
-        self.opener = self.vfs
         self._phasedefaults = []
 
         self.names = namespaces.namespaces()