##// END OF EJS Templates
interfaceutil: module to stub out zope.interface...
Gregory Szorc -
r37828:856f381a stable
parent child Browse files
Show More
@@ -0,0 +1,40 b''
1 # interfaceutil.py - Utilities for declaring interfaces.
2 #
3 # Copyright 2018 Gregory Szorc <gregory.szorc@gmail.com>
4 #
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
7
8 # zope.interface imposes a run-time cost due to module import overhead and
9 # bookkeeping for declaring interfaces. So, we use stubs for various
10 # zope.interface primitives unless instructed otherwise.
11
12 from __future__ import absolute_import
13
14 from .. import (
15 encoding,
16 )
17
18 if encoding.environ.get('HGREALINTERFACES'):
19 from ..thirdparty.zope import (
20 interface as zi,
21 )
22
23 Attribute = zi.Attribute
24 Interface = zi.Interface
25 implementer = zi.implementer
26 else:
27 class Attribute(object):
28 def __init__(self, __name__, __doc__=''):
29 pass
30
31 class Interface(object):
32 def __init__(self, name, bases=(), attrs=None, __doc__=None,
33 __module__=None):
34 pass
35
36 def implementer(*ifaces):
37 def wrapper(cls):
38 return cls
39
40 return wrapper
@@ -7,16 +7,16 b''
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from .thirdparty.zope import (
11 interface as zi,
12 )
13 from . import (
10 from . import (
14 error,
11 error,
15 repository,
12 repository,
16 revlog,
13 revlog,
17 )
14 )
15 from .utils import (
16 interfaceutil,
17 )
18
18
19 @zi.implementer(repository.ifilestorage)
19 @interfaceutil.implementer(repository.ifilestorage)
20 class filelog(object):
20 class filelog(object):
21 def __init__(self, opener, path):
21 def __init__(self, opener, path):
22 self._revlog = revlog.revlog(opener,
22 self._revlog = revlog.revlog(opener,
@@ -20,9 +20,6 b' from .i18n import _'
20 from .thirdparty import (
20 from .thirdparty import (
21 cbor,
21 cbor,
22 )
22 )
23 from .thirdparty.zope import (
24 interface as zi,
25 )
26 from . import (
23 from . import (
27 bundle2,
24 bundle2,
28 error,
25 error,
@@ -38,6 +35,9 b' from . import ('
38 wireprotov2peer,
35 wireprotov2peer,
39 wireprotov2server,
36 wireprotov2server,
40 )
37 )
38 from .utils import (
39 interfaceutil,
40 )
41
41
42 httplib = util.httplib
42 httplib = util.httplib
43 urlerr = util.urlerr
43 urlerr = util.urlerr
@@ -582,7 +582,7 b' class queuedcommandfuture(pycompat.futur'
582 # will resolve to Future.result.
582 # will resolve to Future.result.
583 return self.result(timeout)
583 return self.result(timeout)
584
584
585 @zi.implementer(repository.ipeercommandexecutor)
585 @interfaceutil.implementer(repository.ipeercommandexecutor)
586 class httpv2executor(object):
586 class httpv2executor(object):
587 def __init__(self, ui, opener, requestbuilder, apiurl, descriptor):
587 def __init__(self, ui, opener, requestbuilder, apiurl, descriptor):
588 self._ui = ui
588 self._ui = ui
@@ -731,7 +731,8 b' class httpv2executor(object):'
731 pass
731 pass
732
732
733 # TODO implement interface for version 2 peers
733 # TODO implement interface for version 2 peers
734 @zi.implementer(repository.ipeerconnection, repository.ipeercapabilities,
734 @interfaceutil.implementer(repository.ipeerconnection,
735 repository.ipeercapabilities,
735 repository.ipeerrequests)
736 repository.ipeerrequests)
736 class httpv2peer(object):
737 class httpv2peer(object):
737 def __init__(self, ui, repourl, apipath, opener, requestbuilder,
738 def __init__(self, ui, repourl, apipath, opener, requestbuilder,
@@ -21,9 +21,6 b' from .node import ('
21 nullid,
21 nullid,
22 short,
22 short,
23 )
23 )
24 from .thirdparty.zope import (
25 interface as zi,
26 )
27 from . import (
24 from . import (
28 bookmarks,
25 bookmarks,
29 branchmap,
26 branchmap,
@@ -68,6 +65,7 b' from . import ('
68 vfs as vfsmod,
65 vfs as vfsmod,
69 )
66 )
70 from .utils import (
67 from .utils import (
68 interfaceutil,
71 procutil,
69 procutil,
72 stringutil,
70 stringutil,
73 )
71 )
@@ -153,7 +151,7 b" moderncaps = {'lookup', 'branchmap', 'pu"
153 'unbundle'}
151 'unbundle'}
154 legacycaps = moderncaps.union({'changegroupsubset'})
152 legacycaps = moderncaps.union({'changegroupsubset'})
155
153
156 @zi.implementer(repository.ipeercommandexecutor)
154 @interfaceutil.implementer(repository.ipeercommandexecutor)
157 class localcommandexecutor(object):
155 class localcommandexecutor(object):
158 def __init__(self, peer):
156 def __init__(self, peer):
159 self._peer = peer
157 self._peer = peer
@@ -196,7 +194,7 b' class localcommandexecutor(object):'
196 def close(self):
194 def close(self):
197 self._closed = True
195 self._closed = True
198
196
199 @zi.implementer(repository.ipeercommands)
197 @interfaceutil.implementer(repository.ipeercommands)
200 class localpeer(repository.peer):
198 class localpeer(repository.peer):
201 '''peer for a local repo; reflects only the most recent API'''
199 '''peer for a local repo; reflects only the most recent API'''
202
200
@@ -324,7 +322,7 b' class localpeer(repository.peer):'
324
322
325 # End of peer interface.
323 # End of peer interface.
326
324
327 @zi.implementer(repository.ipeerlegacycommands)
325 @interfaceutil.implementer(repository.ipeerlegacycommands)
328 class locallegacypeer(localpeer):
326 class locallegacypeer(localpeer):
329 '''peer extension which implements legacy methods too; used for tests with
327 '''peer extension which implements legacy methods too; used for tests with
330 restricted capabilities'''
328 restricted capabilities'''
@@ -365,7 +363,7 b" REVLOGV2_REQUIREMENT = 'exp-revlogv2.0'"
365 # set to reflect that the extension knows how to handle that requirements.
363 # set to reflect that the extension knows how to handle that requirements.
366 featuresetupfuncs = set()
364 featuresetupfuncs = set()
367
365
368 @zi.implementer(repository.completelocalrepository)
366 @interfaceutil.implementer(repository.completelocalrepository)
369 class localrepository(object):
367 class localrepository(object):
370
368
371 # obsolete experimental requirements:
369 # obsolete experimental requirements:
@@ -8,14 +8,14 b''
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from .i18n import _
10 from .i18n import _
11 from .thirdparty.zope import (
12 interface as zi,
13 )
14 from . import (
11 from . import (
15 error,
12 error,
16 )
13 )
14 from .utils import (
15 interfaceutil,
16 )
17
17
18 class ipeerconnection(zi.Interface):
18 class ipeerconnection(interfaceutil.Interface):
19 """Represents a "connection" to a repository.
19 """Represents a "connection" to a repository.
20
20
21 This is the base interface for representing a connection to a repository.
21 This is the base interface for representing a connection to a repository.
@@ -24,7 +24,7 b' class ipeerconnection(zi.Interface):'
24 This is not a complete interface definition and should not be used
24 This is not a complete interface definition and should not be used
25 outside of this module.
25 outside of this module.
26 """
26 """
27 ui = zi.Attribute("""ui.ui instance""")
27 ui = interfaceutil.Attribute("""ui.ui instance""")
28
28
29 def url():
29 def url():
30 """Returns a URL string representing this peer.
30 """Returns a URL string representing this peer.
@@ -61,7 +61,7 b' class ipeerconnection(zi.Interface):'
61 associated with the peer should be cleaned up.
61 associated with the peer should be cleaned up.
62 """
62 """
63
63
64 class ipeercapabilities(zi.Interface):
64 class ipeercapabilities(interfaceutil.Interface):
65 """Peer sub-interface related to capabilities."""
65 """Peer sub-interface related to capabilities."""
66
66
67 def capable(name):
67 def capable(name):
@@ -81,7 +81,7 b' class ipeercapabilities(zi.Interface):'
81 Raises a ``CapabilityError`` if the capability isn't present.
81 Raises a ``CapabilityError`` if the capability isn't present.
82 """
82 """
83
83
84 class ipeercommands(zi.Interface):
84 class ipeercommands(interfaceutil.Interface):
85 """Client-side interface for communicating over the wire protocol.
85 """Client-side interface for communicating over the wire protocol.
86
86
87 This interface is used as a gateway to the Mercurial wire protocol.
87 This interface is used as a gateway to the Mercurial wire protocol.
@@ -170,7 +170,7 b' class ipeercommands(zi.Interface):'
170 Returns the integer number of heads added to the peer.
170 Returns the integer number of heads added to the peer.
171 """
171 """
172
172
173 class ipeerlegacycommands(zi.Interface):
173 class ipeerlegacycommands(interfaceutil.Interface):
174 """Interface for implementing support for legacy wire protocol commands.
174 """Interface for implementing support for legacy wire protocol commands.
175
175
176 Wire protocol commands transition to legacy status when they are no longer
176 Wire protocol commands transition to legacy status when they are no longer
@@ -202,7 +202,7 b' class ipeerlegacycommands(zi.Interface):'
202 def changegroupsubset(bases, heads, source):
202 def changegroupsubset(bases, heads, source):
203 pass
203 pass
204
204
205 class ipeercommandexecutor(zi.Interface):
205 class ipeercommandexecutor(interfaceutil.Interface):
206 """Represents a mechanism to execute remote commands.
206 """Represents a mechanism to execute remote commands.
207
207
208 This is the primary interface for requesting that wire protocol commands
208 This is the primary interface for requesting that wire protocol commands
@@ -259,7 +259,7 b' class ipeercommandexecutor(zi.Interface)'
259 This method may call ``sendcommands()`` if there are buffered commands.
259 This method may call ``sendcommands()`` if there are buffered commands.
260 """
260 """
261
261
262 class ipeerrequests(zi.Interface):
262 class ipeerrequests(interfaceutil.Interface):
263 """Interface for executing commands on a peer."""
263 """Interface for executing commands on a peer."""
264
264
265 def commandexecutor():
265 def commandexecutor():
@@ -290,7 +290,7 b' class ipeerbase(ipeerconnection, ipeerca'
290 All peer instances must conform to this interface.
290 All peer instances must conform to this interface.
291 """
291 """
292
292
293 @zi.implementer(ipeerbase)
293 @interfaceutil.implementer(ipeerbase)
294 class peer(object):
294 class peer(object):
295 """Base class for peer repositories."""
295 """Base class for peer repositories."""
296
296
@@ -314,7 +314,7 b' class peer(object):'
314 _('cannot %s; remote repository does not support the %r '
314 _('cannot %s; remote repository does not support the %r '
315 'capability') % (purpose, name))
315 'capability') % (purpose, name))
316
316
317 class ifilerevisionssequence(zi.Interface):
317 class ifilerevisionssequence(interfaceutil.Interface):
318 """Contains index data for all revisions of a file.
318 """Contains index data for all revisions of a file.
319
319
320 Types implementing this behave like lists of tuples. The index
320 Types implementing this behave like lists of tuples. The index
@@ -365,7 +365,7 b' class ifilerevisionssequence(zi.Interfac'
365 def insert(self, i, entry):
365 def insert(self, i, entry):
366 """Add an item to the index at specific revision."""
366 """Add an item to the index at specific revision."""
367
367
368 class ifileindex(zi.Interface):
368 class ifileindex(interfaceutil.Interface):
369 """Storage interface for index data of a single file.
369 """Storage interface for index data of a single file.
370
370
371 File storage data is divided into index metadata and data storage.
371 File storage data is divided into index metadata and data storage.
@@ -377,7 +377,7 b' class ifileindex(zi.Interface):'
377 * DAG data (storing and querying the relationship between nodes).
377 * DAG data (storing and querying the relationship between nodes).
378 * Metadata to facilitate storage.
378 * Metadata to facilitate storage.
379 """
379 """
380 index = zi.Attribute(
380 index = interfaceutil.Attribute(
381 """An ``ifilerevisionssequence`` instance.""")
381 """An ``ifilerevisionssequence`` instance.""")
382
382
383 def __len__():
383 def __len__():
@@ -470,7 +470,7 b' class ifileindex(zi.Interface):'
470 def candelta(baserev, rev):
470 def candelta(baserev, rev):
471 """"Whether a delta can be generated between two revisions."""
471 """"Whether a delta can be generated between two revisions."""
472
472
473 class ifiledata(zi.Interface):
473 class ifiledata(interfaceutil.Interface):
474 """Storage interface for data storage of a specific file.
474 """Storage interface for data storage of a specific file.
475
475
476 This complements ``ifileindex`` and provides an interface for accessing
476 This complements ``ifileindex`` and provides an interface for accessing
@@ -536,7 +536,7 b' class ifiledata(zi.Interface):'
536 revision data.
536 revision data.
537 """
537 """
538
538
539 class ifilemutation(zi.Interface):
539 class ifilemutation(interfaceutil.Interface):
540 """Storage interface for mutation events of a tracked file."""
540 """Storage interface for mutation events of a tracked file."""
541
541
542 def add(filedata, meta, transaction, linkrev, p1, p2):
542 def add(filedata, meta, transaction, linkrev, p1, p2):
@@ -608,13 +608,13 b' class ifilemutation(zi.Interface):'
608 class ifilestorage(ifileindex, ifiledata, ifilemutation):
608 class ifilestorage(ifileindex, ifiledata, ifilemutation):
609 """Complete storage interface for a single tracked file."""
609 """Complete storage interface for a single tracked file."""
610
610
611 version = zi.Attribute(
611 version = interfaceutil.Attribute(
612 """Version number of storage.
612 """Version number of storage.
613
613
614 TODO this feels revlog centric and could likely be removed.
614 TODO this feels revlog centric and could likely be removed.
615 """)
615 """)
616
616
617 storedeltachains = zi.Attribute(
617 storedeltachains = interfaceutil.Attribute(
618 """Whether the store stores deltas.
618 """Whether the store stores deltas.
619
619
620 TODO deltachains are revlog centric. This can probably removed
620 TODO deltachains are revlog centric. This can probably removed
@@ -622,7 +622,7 b' class ifilestorage(ifileindex, ifiledata'
622 data.
622 data.
623 """)
623 """)
624
624
625 _generaldelta = zi.Attribute(
625 _generaldelta = interfaceutil.Attribute(
626 """Whether deltas can be against any parent revision.
626 """Whether deltas can be against any parent revision.
627
627
628 TODO this is used by changegroup code and it could probably be
628 TODO this is used by changegroup code and it could probably be
@@ -642,59 +642,59 b' class ifilestorage(ifileindex, ifiledata'
642 TODO this is used by verify and it should not be part of the interface.
642 TODO this is used by verify and it should not be part of the interface.
643 """
643 """
644
644
645 class completelocalrepository(zi.Interface):
645 class completelocalrepository(interfaceutil.Interface):
646 """Monolithic interface for local repositories.
646 """Monolithic interface for local repositories.
647
647
648 This currently captures the reality of things - not how things should be.
648 This currently captures the reality of things - not how things should be.
649 """
649 """
650
650
651 supportedformats = zi.Attribute(
651 supportedformats = interfaceutil.Attribute(
652 """Set of requirements that apply to stream clone.
652 """Set of requirements that apply to stream clone.
653
653
654 This is actually a class attribute and is shared among all instances.
654 This is actually a class attribute and is shared among all instances.
655 """)
655 """)
656
656
657 openerreqs = zi.Attribute(
657 openerreqs = interfaceutil.Attribute(
658 """Set of requirements that are passed to the opener.
658 """Set of requirements that are passed to the opener.
659
659
660 This is actually a class attribute and is shared among all instances.
660 This is actually a class attribute and is shared among all instances.
661 """)
661 """)
662
662
663 supported = zi.Attribute(
663 supported = interfaceutil.Attribute(
664 """Set of requirements that this repo is capable of opening.""")
664 """Set of requirements that this repo is capable of opening.""")
665
665
666 requirements = zi.Attribute(
666 requirements = interfaceutil.Attribute(
667 """Set of requirements this repo uses.""")
667 """Set of requirements this repo uses.""")
668
668
669 filtername = zi.Attribute(
669 filtername = interfaceutil.Attribute(
670 """Name of the repoview that is active on this repo.""")
670 """Name of the repoview that is active on this repo.""")
671
671
672 wvfs = zi.Attribute(
672 wvfs = interfaceutil.Attribute(
673 """VFS used to access the working directory.""")
673 """VFS used to access the working directory.""")
674
674
675 vfs = zi.Attribute(
675 vfs = interfaceutil.Attribute(
676 """VFS rooted at the .hg directory.
676 """VFS rooted at the .hg directory.
677
677
678 Used to access repository data not in the store.
678 Used to access repository data not in the store.
679 """)
679 """)
680
680
681 svfs = zi.Attribute(
681 svfs = interfaceutil.Attribute(
682 """VFS rooted at the store.
682 """VFS rooted at the store.
683
683
684 Used to access repository data in the store. Typically .hg/store.
684 Used to access repository data in the store. Typically .hg/store.
685 But can point elsewhere if the store is shared.
685 But can point elsewhere if the store is shared.
686 """)
686 """)
687
687
688 root = zi.Attribute(
688 root = interfaceutil.Attribute(
689 """Path to the root of the working directory.""")
689 """Path to the root of the working directory.""")
690
690
691 path = zi.Attribute(
691 path = interfaceutil.Attribute(
692 """Path to the .hg directory.""")
692 """Path to the .hg directory.""")
693
693
694 origroot = zi.Attribute(
694 origroot = interfaceutil.Attribute(
695 """The filesystem path that was used to construct the repo.""")
695 """The filesystem path that was used to construct the repo.""")
696
696
697 auditor = zi.Attribute(
697 auditor = interfaceutil.Attribute(
698 """A pathauditor for the working directory.
698 """A pathauditor for the working directory.
699
699
700 This checks if a path refers to a nested repository.
700 This checks if a path refers to a nested repository.
@@ -702,40 +702,40 b' class completelocalrepository(zi.Interfa'
702 Operates on the filesystem.
702 Operates on the filesystem.
703 """)
703 """)
704
704
705 nofsauditor = zi.Attribute(
705 nofsauditor = interfaceutil.Attribute(
706 """A pathauditor for the working directory.
706 """A pathauditor for the working directory.
707
707
708 This is like ``auditor`` except it doesn't do filesystem checks.
708 This is like ``auditor`` except it doesn't do filesystem checks.
709 """)
709 """)
710
710
711 baseui = zi.Attribute(
711 baseui = interfaceutil.Attribute(
712 """Original ui instance passed into constructor.""")
712 """Original ui instance passed into constructor.""")
713
713
714 ui = zi.Attribute(
714 ui = interfaceutil.Attribute(
715 """Main ui instance for this instance.""")
715 """Main ui instance for this instance.""")
716
716
717 sharedpath = zi.Attribute(
717 sharedpath = interfaceutil.Attribute(
718 """Path to the .hg directory of the repo this repo was shared from.""")
718 """Path to the .hg directory of the repo this repo was shared from.""")
719
719
720 store = zi.Attribute(
720 store = interfaceutil.Attribute(
721 """A store instance.""")
721 """A store instance.""")
722
722
723 spath = zi.Attribute(
723 spath = interfaceutil.Attribute(
724 """Path to the store.""")
724 """Path to the store.""")
725
725
726 sjoin = zi.Attribute(
726 sjoin = interfaceutil.Attribute(
727 """Alias to self.store.join.""")
727 """Alias to self.store.join.""")
728
728
729 cachevfs = zi.Attribute(
729 cachevfs = interfaceutil.Attribute(
730 """A VFS used to access the cache directory.
730 """A VFS used to access the cache directory.
731
731
732 Typically .hg/cache.
732 Typically .hg/cache.
733 """)
733 """)
734
734
735 filteredrevcache = zi.Attribute(
735 filteredrevcache = interfaceutil.Attribute(
736 """Holds sets of revisions to be filtered.""")
736 """Holds sets of revisions to be filtered.""")
737
737
738 names = zi.Attribute(
738 names = interfaceutil.Attribute(
739 """A ``namespaces`` instance.""")
739 """A ``namespaces`` instance.""")
740
740
741 def close():
741 def close():
@@ -750,19 +750,19 b' class completelocalrepository(zi.Interfa'
750 def filtered(name, visibilityexceptions=None):
750 def filtered(name, visibilityexceptions=None):
751 """Obtain a named view of this repository."""
751 """Obtain a named view of this repository."""
752
752
753 obsstore = zi.Attribute(
753 obsstore = interfaceutil.Attribute(
754 """A store of obsolescence data.""")
754 """A store of obsolescence data.""")
755
755
756 changelog = zi.Attribute(
756 changelog = interfaceutil.Attribute(
757 """A handle on the changelog revlog.""")
757 """A handle on the changelog revlog.""")
758
758
759 manifestlog = zi.Attribute(
759 manifestlog = interfaceutil.Attribute(
760 """A handle on the root manifest revlog.""")
760 """A handle on the root manifest revlog.""")
761
761
762 dirstate = zi.Attribute(
762 dirstate = interfaceutil.Attribute(
763 """Working directory state.""")
763 """Working directory state.""")
764
764
765 narrowpats = zi.Attribute(
765 narrowpats = interfaceutil.Attribute(
766 """Matcher patterns for this repository's narrowspec.""")
766 """Matcher patterns for this repository's narrowspec.""")
767
767
768 def narrowmatch():
768 def narrowmatch():
@@ -978,7 +978,7 b' class completelocalrepository(zi.Interfa'
978 def checkpush(pushop):
978 def checkpush(pushop):
979 pass
979 pass
980
980
981 prepushoutgoinghooks = zi.Attribute(
981 prepushoutgoinghooks = interfaceutil.Attribute(
982 """util.hooks instance.""")
982 """util.hooks instance.""")
983
983
984 def pushkey(namespace, key, old, new):
984 def pushkey(namespace, key, old, new):
@@ -15,9 +15,6 b' from .i18n import _'
15 from .thirdparty import (
15 from .thirdparty import (
16 cbor,
16 cbor,
17 )
17 )
18 from .thirdparty.zope import (
19 interface as zi,
20 )
21 from . import (
18 from . import (
22 encoding,
19 encoding,
23 error,
20 error,
@@ -29,6 +26,7 b' from . import ('
29 wireprotov2server,
26 wireprotov2server,
30 )
27 )
31 from .utils import (
28 from .utils import (
29 interfaceutil,
32 procutil,
30 procutil,
33 )
31 )
34
32
@@ -62,7 +60,7 b' def decodevaluefromheaders(req, headerpr'
62
60
63 return ''.join(chunks)
61 return ''.join(chunks)
64
62
65 @zi.implementer(wireprototypes.baseprotocolhandler)
63 @interfaceutil.implementer(wireprototypes.baseprotocolhandler)
66 class httpv1protocolhandler(object):
64 class httpv1protocolhandler(object):
67 def __init__(self, req, ui, checkperm):
65 def __init__(self, req, ui, checkperm):
68 self._req = req
66 self._req = req
@@ -489,7 +487,7 b' def _sshv1respondooberror(fout, ferr, rs'
489 fout.write(b'\n')
487 fout.write(b'\n')
490 fout.flush()
488 fout.flush()
491
489
492 @zi.implementer(wireprototypes.baseprotocolhandler)
490 @interfaceutil.implementer(wireprototypes.baseprotocolhandler)
493 class sshv1protocolhandler(object):
491 class sshv1protocolhandler(object):
494 """Handler for requests services via version 1 of SSH protocol."""
492 """Handler for requests services via version 1 of SSH protocol."""
495 def __init__(self, ui, fin, fout):
493 def __init__(self, ui, fin, fout):
@@ -9,14 +9,14 b' from .node import ('
9 bin,
9 bin,
10 hex,
10 hex,
11 )
11 )
12 from .thirdparty.zope import (
13 interface as zi,
14 )
15 from .i18n import _
12 from .i18n import _
16 from . import (
13 from . import (
17 error,
14 error,
18 util,
15 util,
19 )
16 )
17 from .utils import (
18 interfaceutil,
19 )
20
20
21 # Names of the SSH protocol implementations.
21 # Names of the SSH protocol implementations.
22 SSHV1 = 'ssh-v1'
22 SSHV1 = 'ssh-v1'
@@ -179,7 +179,7 b' GETBUNDLE_ARGUMENTS = {'
179 'stream': 'boolean',
179 'stream': 'boolean',
180 }
180 }
181
181
182 class baseprotocolhandler(zi.Interface):
182 class baseprotocolhandler(interfaceutil.Interface):
183 """Abstract base class for wire protocol handlers.
183 """Abstract base class for wire protocol handlers.
184
184
185 A wire protocol handler serves as an interface between protocol command
185 A wire protocol handler serves as an interface between protocol command
@@ -188,7 +188,7 b' class baseprotocolhandler(zi.Interface):'
188 the request, handle response types, etc.
188 the request, handle response types, etc.
189 """
189 """
190
190
191 name = zi.Attribute(
191 name = interfaceutil.Attribute(
192 """The name of the protocol implementation.
192 """The name of the protocol implementation.
193
193
194 Used for uniquely identifying the transport type.
194 Used for uniquely identifying the transport type.
@@ -15,9 +15,6 b' from .i18n import _'
15 from .node import (
15 from .node import (
16 bin,
16 bin,
17 )
17 )
18 from .thirdparty.zope import (
19 interface as zi,
20 )
21 from . import (
18 from . import (
22 bundle2,
19 bundle2,
23 changegroup as changegroupmod,
20 changegroup as changegroupmod,
@@ -29,6 +26,9 b' from . import ('
29 util,
26 util,
30 wireprototypes,
27 wireprototypes,
31 )
28 )
29 from .utils import (
30 interfaceutil,
31 )
32
32
33 urlreq = util.urlreq
33 urlreq = util.urlreq
34
34
@@ -110,7 +110,7 b' class unsentfuture(pycompat.futures.Futu'
110 # on that.
110 # on that.
111 return self.result(timeout)
111 return self.result(timeout)
112
112
113 @zi.implementer(repository.ipeercommandexecutor)
113 @interfaceutil.implementer(repository.ipeercommandexecutor)
114 class peerexecutor(object):
114 class peerexecutor(object):
115 def __init__(self, peer):
115 def __init__(self, peer):
116 self._peer = peer
116 self._peer = peer
@@ -308,7 +308,8 b' class peerexecutor(object):'
308 else:
308 else:
309 f.set_result(result)
309 f.set_result(result)
310
310
311 @zi.implementer(repository.ipeercommands, repository.ipeerlegacycommands)
311 @interfaceutil.implementer(repository.ipeercommands,
312 repository.ipeerlegacycommands)
312 class wirepeer(repository.peer):
313 class wirepeer(repository.peer):
313 """Client-side interface for communicating with a peer repository.
314 """Client-side interface for communicating with a peer repository.
314
315
@@ -12,9 +12,6 b' from .i18n import _'
12 from .thirdparty import (
12 from .thirdparty import (
13 cbor,
13 cbor,
14 )
14 )
15 from .thirdparty.zope import (
16 interface as zi,
17 )
18 from . import (
15 from . import (
19 encoding,
16 encoding,
20 error,
17 error,
@@ -24,6 +21,9 b' from . import ('
24 wireprotoframing,
21 wireprotoframing,
25 wireprototypes,
22 wireprototypes,
26 )
23 )
24 from .utils import (
25 interfaceutil,
26 )
27
27
28 FRAMINGTYPE = b'application/mercurial-exp-framing-0005'
28 FRAMINGTYPE = b'application/mercurial-exp-framing-0005'
29
29
@@ -340,7 +340,7 b' def dispatch(repo, proto, command):'
340
340
341 return func(repo, proto, **args)
341 return func(repo, proto, **args)
342
342
343 @zi.implementer(wireprototypes.baseprotocolhandler)
343 @interfaceutil.implementer(wireprototypes.baseprotocolhandler)
344 class httpv2protocolhandler(object):
344 class httpv2protocolhandler(object):
345 def __init__(self, req, ui, args=None):
345 def __init__(self, req, ui, args=None):
346 self._req = req
346 self._req = req
@@ -2,6 +2,9 b''
2
2
3 from __future__ import absolute_import, print_function
3 from __future__ import absolute_import, print_function
4
4
5 from mercurial import encoding
6 encoding.environ[b'HGREALINTERFACES'] = b'1'
7
5 import os
8 import os
6
9
7 from mercurial.thirdparty.zope import (
10 from mercurial.thirdparty.zope import (
@@ -27,6 +27,7 b' outputs, which should be fixed later.'
27 > -X i18n/posplit \
27 > -X i18n/posplit \
28 > -X mercurial/thirdparty \
28 > -X mercurial/thirdparty \
29 > -X tests/hypothesishelpers.py \
29 > -X tests/hypothesishelpers.py \
30 > -X tests/test-check-interfaces.py \
30 > -X tests/test-commit-interactive.t \
31 > -X tests/test-commit-interactive.t \
31 > -X tests/test-contrib-check-code.t \
32 > -X tests/test-contrib-check-code.t \
32 > -X tests/test-demandimport.py \
33 > -X tests/test-demandimport.py \
General Comments 0
You need to be logged in to leave comments. Login now