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

login
register
mail settings
Submitter Pierre-Yves David
Date April 3, 2017, 1:03 p.m.
Message ID <44992158d7c327b222c9.1491224639@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/19932/
State Changes Requested
Headers show

Comments

Pierre-Yves David - April 3, 2017, 1:03 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 44992158d7c327b222c9bdeed45402bc646d41a4
# Parent  1f0d735dff0613a2dadce85fbc396ef9306c0578
# 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 44992158d7c3
vfs: deprecate all old classes in scmutil

Now that all vfs class moved to the vfs module, we can deprecate the old one.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -332,15 +332,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):