# HG changeset patch # User Pulkit Goyal # Date 1566084522 -10800 # Node ID 2c4f656c8e9f61afd8590d6daf59d5593eeaa29c # Parent 268662aac0752cc7ecd2f98ec80d0194ad8050ff interfaceutil: move to interfaces/ Now that we have a dedicated folder for interfaces, let's move interfaceutil there. Differential Revision: https://phab.mercurial-scm.org/D6742 diff -r 268662aac075 -r 2c4f656c8e9f hgext/sqlitestore.py --- a/hgext/sqlitestore.py Sun Aug 18 00:45:33 2019 +0300 +++ b/hgext/sqlitestore.py Sun Aug 18 02:28:42 2019 +0300 @@ -75,9 +75,9 @@ ) from mercurial.interfaces import ( repository, + util as interfaceutil, ) from mercurial.utils import ( - interfaceutil, storageutil, ) diff -r 268662aac075 -r 2c4f656c8e9f mercurial/filelog.py --- a/mercurial/filelog.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/filelog.py Sun Aug 18 02:28:42 2019 +0300 @@ -18,9 +18,9 @@ ) from .interfaces import ( repository, + util as interfaceutil, ) from .utils import ( - interfaceutil, storageutil, ) diff -r 268662aac075 -r 2c4f656c8e9f mercurial/httppeer.py --- a/mercurial/httppeer.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/httppeer.py Sun Aug 18 02:28:42 2019 +0300 @@ -16,9 +16,6 @@ import weakref from .i18n import _ -from .interfaces import ( - repository, -) from . import ( bundle2, error, @@ -33,9 +30,12 @@ wireprotov2peer, wireprotov2server, ) +from .interfaces import ( + repository, + util as interfaceutil, +) from .utils import ( cborutil, - interfaceutil, stringutil, ) diff -r 268662aac075 -r 2c4f656c8e9f mercurial/interfaces/repository.py --- a/mercurial/interfaces/repository.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/interfaces/repository.py Sun Aug 18 02:28:42 2019 +0300 @@ -11,8 +11,8 @@ from .. import ( error, ) -from ..utils import ( - interfaceutil, +from . import ( + util as interfaceutil, ) # When narrowing is finalized and no longer subject to format changes, diff -r 268662aac075 -r 2c4f656c8e9f mercurial/interfaces/util.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mercurial/interfaces/util.py Sun Aug 18 02:28:42 2019 +0300 @@ -0,0 +1,40 @@ +# util.py - Utilities for declaring interfaces. +# +# Copyright 2018 Gregory Szorc +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +# zope.interface imposes a run-time cost due to module import overhead and +# bookkeeping for declaring interfaces. So, we use stubs for various +# zope.interface primitives unless instructed otherwise. + +from __future__ import absolute_import + +from .. import ( + encoding, +) + +if encoding.environ.get('HGREALINTERFACES'): + from ..thirdparty.zope import ( + interface as zi, + ) + + Attribute = zi.Attribute + Interface = zi.Interface + implementer = zi.implementer +else: + class Attribute(object): + def __init__(self, __name__, __doc__=''): + pass + + class Interface(object): + def __init__(self, name, bases=(), attrs=None, __doc__=None, + __module__=None): + pass + + def implementer(*ifaces): + def wrapper(cls): + return cls + + return wrapper diff -r 268662aac075 -r 2c4f656c8e9f mercurial/localrepo.py --- a/mercurial/localrepo.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/localrepo.py Sun Aug 18 02:28:42 2019 +0300 @@ -68,10 +68,10 @@ from .interfaces import ( repository, + util as interfaceutil, ) from .utils import ( - interfaceutil, procutil, stringutil, ) diff -r 268662aac075 -r 2c4f656c8e9f mercurial/manifest.py --- a/mercurial/manifest.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/manifest.py Sun Aug 18 02:28:42 2019 +0300 @@ -29,9 +29,7 @@ ) from .interfaces import ( repository, -) -from .utils import ( - interfaceutil, + util as interfaceutil, ) parsers = policy.importmod(r'parsers') diff -r 268662aac075 -r 2c4f656c8e9f mercurial/revlog.py --- a/mercurial/revlog.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/revlog.py Sun Aug 18 02:28:42 2019 +0300 @@ -70,13 +70,13 @@ ) from .interfaces import ( repository, + util as interfaceutil, ) from .revlogutils import ( deltas as deltautil, flagutil, ) from .utils import ( - interfaceutil, storageutil, stringutil, ) diff -r 268662aac075 -r 2c4f656c8e9f mercurial/utils/interfaceutil.py --- a/mercurial/utils/interfaceutil.py Sun Aug 18 00:45:33 2019 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -# interfaceutil.py - Utilities for declaring interfaces. -# -# Copyright 2018 Gregory Szorc -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2 or any later version. - -# zope.interface imposes a run-time cost due to module import overhead and -# bookkeeping for declaring interfaces. So, we use stubs for various -# zope.interface primitives unless instructed otherwise. - -from __future__ import absolute_import - -from .. import ( - encoding, -) - -if encoding.environ.get('HGREALINTERFACES'): - from ..thirdparty.zope import ( - interface as zi, - ) - - Attribute = zi.Attribute - Interface = zi.Interface - implementer = zi.implementer -else: - class Attribute(object): - def __init__(self, __name__, __doc__=''): - pass - - class Interface(object): - def __init__(self, name, bases=(), attrs=None, __doc__=None, - __module__=None): - pass - - def implementer(*ifaces): - def wrapper(cls): - return cls - - return wrapper diff -r 268662aac075 -r 2c4f656c8e9f mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/wireprotoserver.py Sun Aug 18 02:28:42 2019 +0300 @@ -21,10 +21,12 @@ wireprotov1server, wireprotov2server, ) +from .interfaces import ( + util as interfaceutil, +) from .utils import ( cborutil, compression, - interfaceutil, ) stringio = util.stringio diff -r 268662aac075 -r 2c4f656c8e9f mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/wireprototypes.py Sun Aug 18 02:28:42 2019 +0300 @@ -17,9 +17,11 @@ error, util, ) +from .interfaces import ( + util as interfaceutil, +) from .utils import ( compression, - interfaceutil, ) # Names of the SSH protocol implementations. diff -r 268662aac075 -r 2c4f656c8e9f mercurial/wireprotov1peer.py --- a/mercurial/wireprotov1peer.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/wireprotov1peer.py Sun Aug 18 02:28:42 2019 +0300 @@ -27,9 +27,7 @@ ) from .interfaces import ( repository, -) -from .utils import ( - interfaceutil, + util as interfaceutil, ) urlreq = util.urlreq diff -r 268662aac075 -r 2c4f656c8e9f mercurial/wireprotov2server.py --- a/mercurial/wireprotov2server.py Sun Aug 18 00:45:33 2019 +0300 +++ b/mercurial/wireprotov2server.py Sun Aug 18 02:28:42 2019 +0300 @@ -28,9 +28,11 @@ wireprotoframing, wireprototypes, ) +from .interfaces import ( + util as interfaceutil, +) from .utils import ( cborutil, - interfaceutil, stringutil, ) diff -r 268662aac075 -r 2c4f656c8e9f tests/simplestorerepo.py --- a/tests/simplestorerepo.py Sun Aug 18 00:45:33 2019 +0300 +++ b/tests/simplestorerepo.py Sun Aug 18 02:28:42 2019 +0300 @@ -38,10 +38,10 @@ ) from mercurial.interfaces import ( repository, + util as interfaceutil, ) from mercurial.utils import ( cborutil, - interfaceutil, storageutil, ) from mercurial.revlogutils import ( diff -r 268662aac075 -r 2c4f656c8e9f tests/wireprotosimplecache.py --- a/tests/wireprotosimplecache.py Sun Aug 18 00:45:33 2019 +0300 +++ b/tests/wireprotosimplecache.py Sun Aug 18 02:28:42 2019 +0300 @@ -17,9 +17,9 @@ ) from mercurial.interfaces import ( repository, + util as interfaceutil, ) from mercurial.utils import ( - interfaceutil, stringutil, )