changeset 42824:2c4f656c8e9f

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
author Pulkit Goyal <pulkit@yandex-team.ru>
date Sun, 18 Aug 2019 02:28:42 +0300
parents 268662aac075
children 197e7326b8b8
files hgext/sqlitestore.py mercurial/filelog.py mercurial/httppeer.py mercurial/interfaces/repository.py mercurial/interfaces/util.py mercurial/localrepo.py mercurial/manifest.py mercurial/revlog.py mercurial/utils/interfaceutil.py mercurial/wireprotoserver.py mercurial/wireprototypes.py mercurial/wireprotov1peer.py mercurial/wireprotov2server.py tests/simplestorerepo.py tests/wireprotosimplecache.py
diffstat 15 files changed, 63 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- 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,
 )
 
--- 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,
 )
 
--- 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,
 )
 
--- 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,
--- /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 <gregory.szorc@gmail.com>
+#
+# 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
--- 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,
 )
--- 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')
--- 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,
 )
--- 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 <gregory.szorc@gmail.com>
-#
-# 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
--- 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
--- 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.
--- 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
--- 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,
 )
 
--- 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 (
--- 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,
 )