From patchwork Tue Apr 4 09:58:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2,of,2,V2] vfs: deprecate all old classes in scmutil From: Pierre-Yves David X-Patchwork-Id: 19948 Message-Id: <3b21e4220481269157fe.1491299930@nodosa.octopoid.net> To: mercurial-devel@mercurial-scm.org Date: Tue, 04 Apr 2017 11:58:50 +0200 # HG changeset patch # User Pierre-Yves David # Date 1491222098 -7200 # Mon Apr 03 14:21:38 2017 +0200 # Node ID 3b21e4220481269157fe804e2a91cbe973f240a0 # Parent 3992b843a7832bf23f2430dc2308907d1f5ba7f9 # 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 3b21e4220481 vfs: deprecate all old classes in scmutil Now that all vfs class moved to the vfs module, we can deprecate the old one. 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):