##// END OF EJS Templates
interfaces: convert the repository zope interfaces to Protocol classes...
Matt Harbison -
r53342:26dd402c default
parent child Browse files
Show More
@@ -8,6 +8,10
8
8
9 from __future__ import annotations
9 from __future__ import annotations
10
10
11 from typing import (
12 Protocol,
13 )
14
11 from ..i18n import _
15 from ..i18n import _
12 from .. import error
16 from .. import error
13 from . import util as interfaceutil
17 from . import util as interfaceutil
@@ -98,7 +102,7 CACHES_POST_CLONE.discard(CACHE_FILE_NOD
98 CACHES_POST_CLONE.discard(CACHE_REV_BRANCH)
102 CACHES_POST_CLONE.discard(CACHE_REV_BRANCH)
99
103
100
104
101 class ipeerconnection(interfaceutil.Interface):
105 class ipeerconnection(Protocol):
102 """Represents a "connection" to a repository.
106 """Represents a "connection" to a repository.
103
107
104 This is the base interface for representing a connection to a repository.
108 This is the base interface for representing a connection to a repository.
@@ -141,7 +145,7 class ipeerconnection(interfaceutil.Inte
141 """
145 """
142
146
143
147
144 class ipeercapabilities(interfaceutil.Interface):
148 class ipeercapabilities(Protocol):
145 """Peer sub-interface related to capabilities."""
149 """Peer sub-interface related to capabilities."""
146
150
147 def capable(name):
151 def capable(name):
@@ -162,7 +166,7 class ipeercapabilities(interfaceutil.In
162 """
166 """
163
167
164
168
165 class ipeercommands(interfaceutil.Interface):
169 class ipeercommands(Protocol):
166 """Client-side interface for communicating over the wire protocol.
170 """Client-side interface for communicating over the wire protocol.
167
171
168 This interface is used as a gateway to the Mercurial wire protocol.
172 This interface is used as a gateway to the Mercurial wire protocol.
@@ -258,7 +262,7 class ipeercommands(interfaceutil.Interf
258 """
262 """
259
263
260
264
261 class ipeerlegacycommands(interfaceutil.Interface):
265 class ipeerlegacycommands(Protocol):
262 """Interface for implementing support for legacy wire protocol commands.
266 """Interface for implementing support for legacy wire protocol commands.
263
267
264 Wire protocol commands transition to legacy status when they are no longer
268 Wire protocol commands transition to legacy status when they are no longer
@@ -291,7 +295,7 class ipeerlegacycommands(interfaceutil.
291 pass
295 pass
292
296
293
297
294 class ipeercommandexecutor(interfaceutil.Interface):
298 class ipeercommandexecutor(Protocol):
295 """Represents a mechanism to execute remote commands.
299 """Represents a mechanism to execute remote commands.
296
300
297 This is the primary interface for requesting that wire protocol commands
301 This is the primary interface for requesting that wire protocol commands
@@ -349,7 +353,7 class ipeercommandexecutor(interfaceutil
349 """
353 """
350
354
351
355
352 class ipeerrequests(interfaceutil.Interface):
356 class ipeerrequests(Protocol):
353 """Interface for executing commands on a peer."""
357 """Interface for executing commands on a peer."""
354
358
355 limitedarguments = interfaceutil.Attribute(
359 limitedarguments = interfaceutil.Attribute(
@@ -431,7 +435,7 class peer:
431 )
435 )
432
436
433
437
434 class iverifyproblem(interfaceutil.Interface):
438 class iverifyproblem(Protocol):
435 """Represents a problem with the integrity of the repository.
439 """Represents a problem with the integrity of the repository.
436
440
437 Instances of this interface are emitted to describe an integrity issue
441 Instances of this interface are emitted to describe an integrity issue
@@ -454,7 +458,7 class iverifyproblem(interfaceutil.Inter
454 )
458 )
455
459
456
460
457 class irevisiondelta(interfaceutil.Interface):
461 class irevisiondelta(Protocol):
458 """Represents a delta between one revision and another.
462 """Represents a delta between one revision and another.
459
463
460 Instances convey enough information to allow a revision to be exchanged
464 Instances convey enough information to allow a revision to be exchanged
@@ -526,7 +530,7 class irevisiondelta(interfaceutil.Inter
526 )
530 )
527
531
528
532
529 class ifilerevisionssequence(interfaceutil.Interface):
533 class ifilerevisionssequence(Protocol):
530 """Contains index data for all revisions of a file.
534 """Contains index data for all revisions of a file.
531
535
532 Types implementing this behave like lists of tuples. The index
536 Types implementing this behave like lists of tuples. The index
@@ -578,7 +582,7 class ifilerevisionssequence(interfaceut
578 """Add an item to the index at specific revision."""
582 """Add an item to the index at specific revision."""
579
583
580
584
581 class ifileindex(interfaceutil.Interface):
585 class ifileindex(Protocol):
582 """Storage interface for index data of a single file.
586 """Storage interface for index data of a single file.
583
587
584 File storage data is divided into index metadata and data storage.
588 File storage data is divided into index metadata and data storage.
@@ -679,7 +683,7 class ifileindex(interfaceutil.Interface
679 """
683 """
680
684
681
685
682 class ifiledata(interfaceutil.Interface):
686 class ifiledata(Protocol):
683 """Storage interface for data storage of a specific file.
687 """Storage interface for data storage of a specific file.
684
688
685 This complements ``ifileindex`` and provides an interface for accessing
689 This complements ``ifileindex`` and provides an interface for accessing
@@ -786,7 +790,7 class ifiledata(interfaceutil.Interface)
786 """
790 """
787
791
788
792
789 class ifilemutation(interfaceutil.Interface):
793 class ifilemutation(Protocol):
790 """Storage interface for mutation events of a tracked file."""
794 """Storage interface for mutation events of a tracked file."""
791
795
792 def add(filedata, meta, transaction, linkrev, p1, p2):
796 def add(filedata, meta, transaction, linkrev, p1, p2):
@@ -968,7 +972,7 class ifilestorage(ifileindex, ifiledata
968 """
972 """
969
973
970
974
971 class idirs(interfaceutil.Interface):
975 class idirs(Protocol):
972 """Interface representing a collection of directories from paths.
976 """Interface representing a collection of directories from paths.
973
977
974 This interface is essentially a derived data structure representing
978 This interface is essentially a derived data structure representing
@@ -995,7 +999,7 class idirs(interfaceutil.Interface):
995 """Whether a specific directory is in this collection."""
999 """Whether a specific directory is in this collection."""
996
1000
997
1001
998 class imanifestdict(interfaceutil.Interface):
1002 class imanifestdict(Protocol):
999 """Interface representing a manifest data structure.
1003 """Interface representing a manifest data structure.
1000
1004
1001 A manifest is effectively a dict mapping paths to entries. Each entry
1005 A manifest is effectively a dict mapping paths to entries. Each entry
@@ -1145,7 +1149,7 class imanifestdict(interfaceutil.Interf
1145 """
1149 """
1146
1150
1147
1151
1148 class imanifestrevisionbase(interfaceutil.Interface):
1152 class imanifestrevisionbase(Protocol):
1149 """Base interface representing a single revision of a manifest.
1153 """Base interface representing a single revision of a manifest.
1150
1154
1151 Should not be used as a primary interface: should always be inherited
1155 Should not be used as a primary interface: should always be inherited
@@ -1276,7 +1280,7 class imanifestrevisionwritable(imanifes
1276 """
1280 """
1277
1281
1278
1282
1279 class imanifeststorage(interfaceutil.Interface):
1283 class imanifeststorage(Protocol):
1280 """Storage interface for manifest data."""
1284 """Storage interface for manifest data."""
1281
1285
1282 nodeconstants = interfaceutil.Attribute(
1286 nodeconstants = interfaceutil.Attribute(
@@ -1484,7 +1488,7 class imanifeststorage(interfaceutil.Int
1484 """
1488 """
1485
1489
1486
1490
1487 class imanifestlog(interfaceutil.Interface):
1491 class imanifestlog(Protocol):
1488 """Interface representing a collection of manifest snapshots.
1492 """Interface representing a collection of manifest snapshots.
1489
1493
1490 Represents the root manifest in a repository.
1494 Represents the root manifest in a repository.
@@ -1549,7 +1553,7 class imanifestlog(interfaceutil.Interfa
1549 """update whatever cache are relevant for the used storage."""
1553 """update whatever cache are relevant for the used storage."""
1550
1554
1551
1555
1552 class ilocalrepositoryfilestorage(interfaceutil.Interface):
1556 class ilocalrepositoryfilestorage(Protocol):
1553 """Local repository sub-interface providing access to tracked file storage.
1557 """Local repository sub-interface providing access to tracked file storage.
1554
1558
1555 This interface defines how a repository accesses storage for a single
1559 This interface defines how a repository accesses storage for a single
@@ -1563,7 +1567,7 class ilocalrepositoryfilestorage(interf
1563 """
1567 """
1564
1568
1565
1569
1566 class ilocalrepositorymain(interfaceutil.Interface):
1570 class ilocalrepositorymain(Protocol):
1567 """Main interface for local repositories.
1571 """Main interface for local repositories.
1568
1572
1569 This currently captures the reality of things - not how things should be.
1573 This currently captures the reality of things - not how things should be.
@@ -1989,7 +1993,7 class completelocalrepository(
1989 """Complete interface for a local repository."""
1993 """Complete interface for a local repository."""
1990
1994
1991
1995
1992 class iwireprotocolcommandcacher(interfaceutil.Interface):
1996 class iwireprotocolcommandcacher(Protocol):
1993 """Represents a caching backend for wire protocol commands.
1997 """Represents a caching backend for wire protocol commands.
1994
1998
1995 Wire protocol version 2 supports transparent caching of many commands.
1999 Wire protocol version 2 supports transparent caching of many commands.
General Comments 0
You need to be logged in to leave comments. Login now