Patchwork [2,of,2,V3] vfs: deprecate all old classes in scmutil

login
register
mail settings
Submitter Pierre-Yves David
Date April 13, 2017, 2:53 p.m.
Message ID <e92f6389d3f2182864fc.1492095212@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20178/
State Accepted
Headers show

Comments

Pierre-Yves David - April 13, 2017, 2:53 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1491222098 -7200
#      Mon Apr 03 14:21:38 2017 +0200
# Node ID e92f6389d3f2182864fccc3e4dc4ce7fb70fea7b
# Parent  a86a1d8576c062dc6a95a7d02c886f9cf798d65e
# EXP-Topic vfs.cleanup
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e92f6389d3f2
vfs: deprecate all old classes in scmutil

Now that all vfs class moved to the vfs module, we can deprecate the old one.
Yuya Nishihara - April 13, 2017, 3:13 p.m.
On Thu, 13 Apr 2017 16:53:32 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1491222098 -7200
> #      Mon Apr 03 14:21:38 2017 +0200
> # Node ID e92f6389d3f2182864fccc3e4dc4ce7fb70fea7b
> # Parent  a86a1d8576c062dc6a95a7d02c886f9cf798d65e
> # EXP-Topic vfs.cleanup
> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e92f6389d3f2
> vfs: deprecate all old classes in scmutil

Queued, thanks.

>  # compatibility layer since all 'vfs' code moved to 'mercurial.vfs'
>  #
>  # This is hard to instal deprecation warning to this since we do not have
>  # access to a 'ui' object.
> -opener = vfs = vfsmod.vfs
> -filteropener = filtervfs = vfsmod.filtervfs
> -abstractvfs = vfsmod.abstractvfs
> -readonlyvfs = vfsmod.readonlyvfs
> -auditvfs = vfsmod.auditvfs
> +opener = _deprecated('opener', 'vfs', vfsmod.vfs)
> +cfs = _deprecated('vfs', 'vfs', vfsmod.vfs)

Fixed typo of vfs.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -329,15 +329,25 @@  def filteredhash(repo, maxrev):
         key = s.digest()
     return key
 
+def _deprecated(old, new, func):
+    msg = ('class at mercurial.scmutil.%s moved to mercurial.vfs.%s'
+           % (old, new))
+    def wrapper(*args, **kwargs):
+        util.nouideprecwarn(msg, '4.2')
+        return func(*args, **kwargs)
+    return wrapper
+
 # compatibility layer since all 'vfs' code moved to 'mercurial.vfs'
 #
 # This is hard to instal deprecation warning to this since we do not have
 # access to a 'ui' object.
-opener = vfs = vfsmod.vfs
-filteropener = filtervfs = vfsmod.filtervfs
-abstractvfs = vfsmod.abstractvfs
-readonlyvfs = vfsmod.readonlyvfs
-auditvfs = vfsmod.auditvfs
+opener = _deprecated('opener', 'vfs', vfsmod.vfs)
+cfs = _deprecated('vfs', 'vfs', vfsmod.vfs)
+filteropener = _deprecated('filteropener', 'filtervfs', vfsmod.filtervfs)
+filtervfs = _deprecated('filtervfs', 'filtervfs', vfsmod.filtervfs)
+abstractvfs = _deprecated('abstractvfs', 'abstractvfs', vfsmod.abstractvfs)
+readonlyvfs = _deprecated('readonlyvfs', 'readonlyvfs', vfsmod.readonlyvfs)
+auditvfs = _deprecated('auditvfs', 'auditvfs', vfsmod.auditvfs)
 checkambigatclosing = vfsmod.checkambigatclosing
 
 def walkrepos(path, followsym=False, seen_dirs=None, recurse=False):