##// END OF EJS Templates
interfaces: add the missing `self` arg to the repository Protocol classes...
Matt Harbison -
r53343:c1674551 default
parent child Browse files
Show More
@@ -115,7 +115,7 class ipeerconnection(Protocol):
115 ui = interfaceutil.Attribute("""ui.ui instance""")
115 ui = interfaceutil.Attribute("""ui.ui instance""")
116 path = interfaceutil.Attribute("""a urlutil.path instance or None""")
116 path = interfaceutil.Attribute("""a urlutil.path instance or None""")
117
117
118 def url():
118 def url(self):
119 """Returns a URL string representing this peer.
119 """Returns a URL string representing this peer.
120
120
121 Currently, implementations expose the raw URL used to construct the
121 Currently, implementations expose the raw URL used to construct the
@@ -127,17 +127,17 class ipeerconnection(Protocol):
127 value.
127 value.
128 """
128 """
129
129
130 def local():
130 def local(self):
131 """Returns a local repository instance.
131 """Returns a local repository instance.
132
132
133 If the peer represents a local repository, returns an object that
133 If the peer represents a local repository, returns an object that
134 can be used to interface with it. Otherwise returns ``None``.
134 can be used to interface with it. Otherwise returns ``None``.
135 """
135 """
136
136
137 def canpush():
137 def canpush(self):
138 """Returns a boolean indicating if this peer can be pushed to."""
138 """Returns a boolean indicating if this peer can be pushed to."""
139
139
140 def close():
140 def close(self):
141 """Close the connection to this peer.
141 """Close the connection to this peer.
142
142
143 This is called when the peer will no longer be used. Resources
143 This is called when the peer will no longer be used. Resources
@@ -148,7 +148,7 class ipeerconnection(Protocol):
148 class ipeercapabilities(Protocol):
148 class ipeercapabilities(Protocol):
149 """Peer sub-interface related to capabilities."""
149 """Peer sub-interface related to capabilities."""
150
150
151 def capable(name):
151 def capable(self, name):
152 """Determine support for a named capability.
152 """Determine support for a named capability.
153
153
154 Returns ``False`` if capability not supported.
154 Returns ``False`` if capability not supported.
@@ -159,7 +159,7 class ipeercapabilities(Protocol):
159 Capability strings may or may not map to wire protocol capabilities.
159 Capability strings may or may not map to wire protocol capabilities.
160 """
160 """
161
161
162 def requirecap(name, purpose):
162 def requirecap(self, name, purpose):
163 """Require a capability to be present.
163 """Require a capability to be present.
164
164
165 Raises a ``CapabilityError`` if the capability isn't present.
165 Raises a ``CapabilityError`` if the capability isn't present.
@@ -173,35 +173,35 class ipeercommands(Protocol):
173 methods commonly call wire protocol commands of the same name.
173 methods commonly call wire protocol commands of the same name.
174 """
174 """
175
175
176 def branchmap():
176 def branchmap(self):
177 """Obtain heads in named branches.
177 """Obtain heads in named branches.
178
178
179 Returns a dict mapping branch name to an iterable of nodes that are
179 Returns a dict mapping branch name to an iterable of nodes that are
180 heads on that branch.
180 heads on that branch.
181 """
181 """
182
182
183 def capabilities():
183 def capabilities(self):
184 """Obtain capabilities of the peer.
184 """Obtain capabilities of the peer.
185
185
186 Returns a set of string capabilities.
186 Returns a set of string capabilities.
187 """
187 """
188
188
189 def get_cached_bundle_inline(path):
189 def get_cached_bundle_inline(self, path):
190 """Retrieve a clonebundle across the wire.
190 """Retrieve a clonebundle across the wire.
191
191
192 Returns a chunkbuffer
192 Returns a chunkbuffer
193 """
193 """
194
194
195 def clonebundles():
195 def clonebundles(self):
196 """Obtains the clone bundles manifest for the repo.
196 """Obtains the clone bundles manifest for the repo.
197
197
198 Returns the manifest as unparsed bytes.
198 Returns the manifest as unparsed bytes.
199 """
199 """
200
200
201 def debugwireargs(one, two, three=None, four=None, five=None):
201 def debugwireargs(self, one, two, three=None, four=None, five=None):
202 """Used to facilitate debugging of arguments passed over the wire."""
202 """Used to facilitate debugging of arguments passed over the wire."""
203
203
204 def getbundle(source, **kwargs):
204 def getbundle(self, source, **kwargs):
205 """Obtain remote repository data as a bundle.
205 """Obtain remote repository data as a bundle.
206
206
207 This command is how the bulk of repository data is transferred from
207 This command is how the bulk of repository data is transferred from
@@ -210,13 +210,13 class ipeercommands(Protocol):
210 Returns a generator of bundle data.
210 Returns a generator of bundle data.
211 """
211 """
212
212
213 def heads():
213 def heads(self):
214 """Determine all known head revisions in the peer.
214 """Determine all known head revisions in the peer.
215
215
216 Returns an iterable of binary nodes.
216 Returns an iterable of binary nodes.
217 """
217 """
218
218
219 def known(nodes):
219 def known(self, nodes):
220 """Determine whether multiple nodes are known.
220 """Determine whether multiple nodes are known.
221
221
222 Accepts an iterable of nodes whose presence to check for.
222 Accepts an iterable of nodes whose presence to check for.
@@ -225,19 +225,19 class ipeercommands(Protocol):
225 at that index is known to the peer.
225 at that index is known to the peer.
226 """
226 """
227
227
228 def listkeys(namespace):
228 def listkeys(self, namespace):
229 """Obtain all keys in a pushkey namespace.
229 """Obtain all keys in a pushkey namespace.
230
230
231 Returns an iterable of key names.
231 Returns an iterable of key names.
232 """
232 """
233
233
234 def lookup(key):
234 def lookup(self, key):
235 """Resolve a value to a known revision.
235 """Resolve a value to a known revision.
236
236
237 Returns a binary node of the resolved revision on success.
237 Returns a binary node of the resolved revision on success.
238 """
238 """
239
239
240 def pushkey(namespace, key, old, new):
240 def pushkey(self, namespace, key, old, new):
241 """Set a value using the ``pushkey`` protocol.
241 """Set a value using the ``pushkey`` protocol.
242
242
243 Arguments correspond to the pushkey namespace and key to operate on and
243 Arguments correspond to the pushkey namespace and key to operate on and
@@ -247,13 +247,13 class ipeercommands(Protocol):
247 namespace.
247 namespace.
248 """
248 """
249
249
250 def stream_out():
250 def stream_out(self):
251 """Obtain streaming clone data.
251 """Obtain streaming clone data.
252
252
253 Successful result should be a generator of data chunks.
253 Successful result should be a generator of data chunks.
254 """
254 """
255
255
256 def unbundle(bundle, heads, url):
256 def unbundle(self, bundle, heads, url):
257 """Transfer repository data to the peer.
257 """Transfer repository data to the peer.
258
258
259 This is how the bulk of data during a push is transferred.
259 This is how the bulk of data during a push is transferred.
@@ -270,7 +270,7 class ipeerlegacycommands(Protocol):
270 legacy, the interfaces are split.
270 legacy, the interfaces are split.
271 """
271 """
272
272
273 def between(pairs):
273 def between(self, pairs):
274 """Obtain nodes between pairs of nodes.
274 """Obtain nodes between pairs of nodes.
275
275
276 ``pairs`` is an iterable of node pairs.
276 ``pairs`` is an iterable of node pairs.
@@ -279,7 +279,7 class ipeerlegacycommands(Protocol):
279 requested pair.
279 requested pair.
280 """
280 """
281
281
282 def branches(nodes):
282 def branches(self, nodes):
283 """Obtain ancestor changesets of specific nodes back to a branch point.
283 """Obtain ancestor changesets of specific nodes back to a branch point.
284
284
285 For each requested node, the peer finds the first ancestor node that is
285 For each requested node, the peer finds the first ancestor node that is
@@ -288,10 +288,10 class ipeerlegacycommands(Protocol):
288 Returns an iterable of iterables with the resolved values for each node.
288 Returns an iterable of iterables with the resolved values for each node.
289 """
289 """
290
290
291 def changegroup(nodes, source):
291 def changegroup(self, nodes, source):
292 """Obtain a changegroup with data for descendants of specified nodes."""
292 """Obtain a changegroup with data for descendants of specified nodes."""
293
293
294 def changegroupsubset(bases, heads, source):
294 def changegroupsubset(self, bases, heads, source):
295 pass
295 pass
296
296
297
297
@@ -304,7 +304,7 class ipeercommandexecutor(Protocol):
304 outstanding requests are waited on.
304 outstanding requests are waited on.
305 """
305 """
306
306
307 def callcommand(name, args):
307 def callcommand(self, name, args):
308 """Request that a named command be executed.
308 """Request that a named command be executed.
309
309
310 Receives the command name and a dictionary of command arguments.
310 Receives the command name and a dictionary of command arguments.
@@ -326,7 +326,7 class ipeercommandexecutor(Protocol):
326 until all command requests have been issued.
326 until all command requests have been issued.
327 """
327 """
328
328
329 def sendcommands():
329 def sendcommands(self):
330 """Trigger submission of queued command requests.
330 """Trigger submission of queued command requests.
331
331
332 Not all transports submit commands as soon as they are requested to
332 Not all transports submit commands as soon as they are requested to
@@ -336,7 +336,7 class ipeercommandexecutor(Protocol):
336 When called, no more new commands may be issued with this executor.
336 When called, no more new commands may be issued with this executor.
337 """
337 """
338
338
339 def close():
339 def close(self):
340 """Signal that this command request is finished.
340 """Signal that this command request is finished.
341
341
342 When called, no more new commands may be issued. All outstanding
342 When called, no more new commands may be issued. All outstanding
@@ -360,7 +360,7 class ipeerrequests(Protocol):
360 """True if the peer cannot receive large argument value for commands."""
360 """True if the peer cannot receive large argument value for commands."""
361 )
361 )
362
362
363 def commandexecutor():
363 def commandexecutor(self):
364 """A context manager that resolves to an ipeercommandexecutor.
364 """A context manager that resolves to an ipeercommandexecutor.
365
365
366 The object this resolves to can be used to issue command requests
366 The object this resolves to can be used to issue command requests
@@ -541,10 +541,10 class ifilerevisionssequence(Protocol):
541 in the index.
541 in the index.
542 """
542 """
543
543
544 def __len__():
544 def __len__(self):
545 """The total number of revisions."""
545 """The total number of revisions."""
546
546
547 def __getitem__(rev):
547 def __getitem__(self, rev):
548 """Returns the object having a specific revision number.
548 """Returns the object having a specific revision number.
549
549
550 Returns an 8-tuple with the following fields:
550 Returns an 8-tuple with the following fields:
@@ -575,7 +575,7 class ifilerevisionssequence(Protocol):
575 recent revision.
575 recent revision.
576 """
576 """
577
577
578 def __contains__(rev):
578 def __contains__(self, rev):
579 """Whether a revision number exists."""
579 """Whether a revision number exists."""
580
580
581 def insert(self, i, entry):
581 def insert(self, i, entry):
@@ -599,13 +599,13 class ifileindex(Protocol):
599 """node for the null revision for use as delta base."""
599 """node for the null revision for use as delta base."""
600 )
600 )
601
601
602 def __len__():
602 def __len__(self):
603 """Obtain the number of revisions stored for this file."""
603 """Obtain the number of revisions stored for this file."""
604
604
605 def __iter__():
605 def __iter__(self):
606 """Iterate over revision numbers for this file."""
606 """Iterate over revision numbers for this file."""
607
607
608 def hasnode(node):
608 def hasnode(self, node):
609 """Returns a bool indicating if a node is known to this store.
609 """Returns a bool indicating if a node is known to this store.
610
610
611 Implementations must only return True for full, binary node values:
611 Implementations must only return True for full, binary node values:
@@ -615,31 +615,31 class ifileindex(Protocol):
615 The null node is never present.
615 The null node is never present.
616 """
616 """
617
617
618 def revs(start=0, stop=None):
618 def revs(self, start=0, stop=None):
619 """Iterate over revision numbers for this file, with control."""
619 """Iterate over revision numbers for this file, with control."""
620
620
621 def parents(node):
621 def parents(self, node):
622 """Returns a 2-tuple of parent nodes for a revision.
622 """Returns a 2-tuple of parent nodes for a revision.
623
623
624 Values will be ``nullid`` if the parent is empty.
624 Values will be ``nullid`` if the parent is empty.
625 """
625 """
626
626
627 def parentrevs(rev):
627 def parentrevs(self, rev):
628 """Like parents() but operates on revision numbers."""
628 """Like parents() but operates on revision numbers."""
629
629
630 def rev(node):
630 def rev(self, node):
631 """Obtain the revision number given a node.
631 """Obtain the revision number given a node.
632
632
633 Raises ``error.LookupError`` if the node is not known.
633 Raises ``error.LookupError`` if the node is not known.
634 """
634 """
635
635
636 def node(rev):
636 def node(self, rev):
637 """Obtain the node value given a revision number.
637 """Obtain the node value given a revision number.
638
638
639 Raises ``IndexError`` if the node is not known.
639 Raises ``IndexError`` if the node is not known.
640 """
640 """
641
641
642 def lookup(node):
642 def lookup(self, node):
643 """Attempt to resolve a value to a node.
643 """Attempt to resolve a value to a node.
644
644
645 Value can be a binary node, hex node, revision number, or a string
645 Value can be a binary node, hex node, revision number, or a string
@@ -648,25 +648,25 class ifileindex(Protocol):
648 Raises ``error.LookupError`` if a node could not be resolved.
648 Raises ``error.LookupError`` if a node could not be resolved.
649 """
649 """
650
650
651 def linkrev(rev):
651 def linkrev(self, rev):
652 """Obtain the changeset revision number a revision is linked to."""
652 """Obtain the changeset revision number a revision is linked to."""
653
653
654 def iscensored(rev):
654 def iscensored(self, rev):
655 """Return whether a revision's content has been censored."""
655 """Return whether a revision's content has been censored."""
656
656
657 def commonancestorsheads(node1, node2):
657 def commonancestorsheads(self, node1, node2):
658 """Obtain an iterable of nodes containing heads of common ancestors.
658 """Obtain an iterable of nodes containing heads of common ancestors.
659
659
660 See ``ancestor.commonancestorsheads()``.
660 See ``ancestor.commonancestorsheads()``.
661 """
661 """
662
662
663 def descendants(revs):
663 def descendants(self, revs):
664 """Obtain descendant revision numbers for a set of revision numbers.
664 """Obtain descendant revision numbers for a set of revision numbers.
665
665
666 If ``nullrev`` is in the set, this is equivalent to ``revs()``.
666 If ``nullrev`` is in the set, this is equivalent to ``revs()``.
667 """
667 """
668
668
669 def heads(start=None, stop=None):
669 def heads(self, start=None, stop=None):
670 """Obtain a list of nodes that are DAG heads, with control.
670 """Obtain a list of nodes that are DAG heads, with control.
671
671
672 The set of revisions examined can be limited by specifying
672 The set of revisions examined can be limited by specifying
@@ -676,7 +676,7 class ifileindex(Protocol):
676 encountered.
676 encountered.
677 """
677 """
678
678
679 def children(node):
679 def children(self, node):
680 """Obtain nodes that are children of a node.
680 """Obtain nodes that are children of a node.
681
681
682 Returns a list of nodes.
682 Returns a list of nodes.
@@ -690,13 +690,13 class ifiledata(Protocol):
690 data for a tracked file.
690 data for a tracked file.
691 """
691 """
692
692
693 def size(rev):
693 def size(self, rev):
694 """Obtain the fulltext size of file data.
694 """Obtain the fulltext size of file data.
695
695
696 Any metadata is excluded from size measurements.
696 Any metadata is excluded from size measurements.
697 """
697 """
698
698
699 def revision(node):
699 def revision(self, node):
700 """Obtain fulltext data for a node.
700 """Obtain fulltext data for a node.
701
701
702 By default, any storage transformations are applied before the data
702 By default, any storage transformations are applied before the data
@@ -707,24 +707,24 class ifiledata(Protocol):
707 consumers should use ``read()`` to obtain the actual file data.
707 consumers should use ``read()`` to obtain the actual file data.
708 """
708 """
709
709
710 def rawdata(node):
710 def rawdata(self, node):
711 """Obtain raw data for a node."""
711 """Obtain raw data for a node."""
712
712
713 def read(node):
713 def read(self, node):
714 """Resolve file fulltext data.
714 """Resolve file fulltext data.
715
715
716 This is similar to ``revision()`` except any metadata in the data
716 This is similar to ``revision()`` except any metadata in the data
717 headers is stripped.
717 headers is stripped.
718 """
718 """
719
719
720 def renamed(node):
720 def renamed(self, node):
721 """Obtain copy metadata for a node.
721 """Obtain copy metadata for a node.
722
722
723 Returns ``False`` if no copy metadata is stored or a 2-tuple of
723 Returns ``False`` if no copy metadata is stored or a 2-tuple of
724 (path, node) from which this revision was copied.
724 (path, node) from which this revision was copied.
725 """
725 """
726
726
727 def cmp(node, fulltext):
727 def cmp(self, node, fulltext):
728 """Compare fulltext to another revision.
728 """Compare fulltext to another revision.
729
729
730 Returns True if the fulltext is different from what is stored.
730 Returns True if the fulltext is different from what is stored.
@@ -735,6 +735,7 class ifiledata(Protocol):
735 """
735 """
736
736
737 def emitrevisions(
737 def emitrevisions(
738 self,
738 nodes,
739 nodes,
739 nodesorder=None,
740 nodesorder=None,
740 revisiondata=False,
741 revisiondata=False,
@@ -793,7 +794,7 class ifiledata(Protocol):
793 class ifilemutation(Protocol):
794 class ifilemutation(Protocol):
794 """Storage interface for mutation events of a tracked file."""
795 """Storage interface for mutation events of a tracked file."""
795
796
796 def add(filedata, meta, transaction, linkrev, p1, p2):
797 def add(self, filedata, meta, transaction, linkrev, p1, p2):
797 """Add a new revision to the store.
798 """Add a new revision to the store.
798
799
799 Takes file data, dictionary of metadata, a transaction, linkrev,
800 Takes file data, dictionary of metadata, a transaction, linkrev,
@@ -805,6 +806,7 class ifilemutation(Protocol):
805 """
806 """
806
807
807 def addrevision(
808 def addrevision(
809 self,
808 revisiondata,
810 revisiondata,
809 transaction,
811 transaction,
810 linkrev,
812 linkrev,
@@ -831,6 +833,7 class ifilemutation(Protocol):
831 """
833 """
832
834
833 def addgroup(
835 def addgroup(
836 self,
834 deltas,
837 deltas,
835 linkmapper,
838 linkmapper,
836 transaction,
839 transaction,
@@ -867,7 +870,7 class ifilemutation(Protocol):
867 even if it existed in the store previously.
870 even if it existed in the store previously.
868 """
871 """
869
872
870 def censorrevision(tr, node, tombstone=b''):
873 def censorrevision(self, tr, node, tombstone=b''):
871 """Remove the content of a single revision.
874 """Remove the content of a single revision.
872
875
873 The specified ``node`` will have its content purged from storage.
876 The specified ``node`` will have its content purged from storage.
@@ -884,7 +887,7 class ifilemutation(Protocol):
884 that they no longer reference the deleted content.
887 that they no longer reference the deleted content.
885 """
888 """
886
889
887 def getstrippoint(minlink):
890 def getstrippoint(self, minlink):
888 """Find the minimum revision that must be stripped to strip a linkrev.
891 """Find the minimum revision that must be stripped to strip a linkrev.
889
892
890 Returns a 2-tuple containing the minimum revision number and a set
893 Returns a 2-tuple containing the minimum revision number and a set
@@ -894,7 +897,7 class ifilemutation(Protocol):
894 a higher-level deletion API. ``repair.strip()`` relies on this.
897 a higher-level deletion API. ``repair.strip()`` relies on this.
895 """
898 """
896
899
897 def strip(minlink, transaction):
900 def strip(self, minlink, transaction):
898 """Remove storage of items starting at a linkrev.
901 """Remove storage of items starting at a linkrev.
899
902
900 This uses ``getstrippoint()`` to determine the first node to remove.
903 This uses ``getstrippoint()`` to determine the first node to remove.
@@ -908,7 +911,7 class ifilemutation(Protocol):
908 class ifilestorage(ifileindex, ifiledata, ifilemutation):
911 class ifilestorage(ifileindex, ifiledata, ifilemutation):
909 """Complete storage interface for a single tracked file."""
912 """Complete storage interface for a single tracked file."""
910
913
911 def files():
914 def files(self):
912 """Obtain paths that are backing storage for this file.
915 """Obtain paths that are backing storage for this file.
913
916
914 TODO this is used heavily by verify code and there should probably
917 TODO this is used heavily by verify code and there should probably
@@ -916,6 +919,7 class ifilestorage(ifileindex, ifiledata
916 """
919 """
917
920
918 def storageinfo(
921 def storageinfo(
922 self,
919 exclusivefiles=False,
923 exclusivefiles=False,
920 sharedfiles=False,
924 sharedfiles=False,
921 revisionscount=False,
925 revisionscount=False,
@@ -954,7 +958,7 class ifilestorage(ifileindex, ifiledata
954 callers are expected to handle this special value.
958 callers are expected to handle this special value.
955 """
959 """
956
960
957 def verifyintegrity(state):
961 def verifyintegrity(self, state):
958 """Verifies the integrity of file storage.
962 """Verifies the integrity of file storage.
959
963
960 ``state`` is a dict holding state of the verifier process. It can be
964 ``state`` is a dict holding state of the verifier process. It can be
@@ -979,23 +983,23 class idirs(Protocol):
979 directories from a collection of paths.
983 directories from a collection of paths.
980 """
984 """
981
985
982 def addpath(path):
986 def addpath(self, path):
983 """Add a path to the collection.
987 """Add a path to the collection.
984
988
985 All directories in the path will be added to the collection.
989 All directories in the path will be added to the collection.
986 """
990 """
987
991
988 def delpath(path):
992 def delpath(self, path):
989 """Remove a path from the collection.
993 """Remove a path from the collection.
990
994
991 If the removal was the last path in a particular directory, the
995 If the removal was the last path in a particular directory, the
992 directory is removed from the collection.
996 directory is removed from the collection.
993 """
997 """
994
998
995 def __iter__():
999 def __iter__(self):
996 """Iterate over the directories in this collection of paths."""
1000 """Iterate over the directories in this collection of paths."""
997
1001
998 def __contains__(path):
1002 def __contains__(self, path):
999 """Whether a specific directory is in this collection."""
1003 """Whether a specific directory is in this collection."""
1000
1004
1001
1005
@@ -1006,7 +1010,7 class imanifestdict(Protocol):
1006 consists of a binary node and extra flags affecting that entry.
1010 consists of a binary node and extra flags affecting that entry.
1007 """
1011 """
1008
1012
1009 def __getitem__(path):
1013 def __getitem__(self, path):
1010 """Returns the binary node value for a path in the manifest.
1014 """Returns the binary node value for a path in the manifest.
1011
1015
1012 Raises ``KeyError`` if the path does not exist in the manifest.
1016 Raises ``KeyError`` if the path does not exist in the manifest.
@@ -1014,7 +1018,7 class imanifestdict(Protocol):
1014 Equivalent to ``self.find(path)[0]``.
1018 Equivalent to ``self.find(path)[0]``.
1015 """
1019 """
1016
1020
1017 def find(path):
1021 def find(self, path):
1018 """Returns the entry for a path in the manifest.
1022 """Returns the entry for a path in the manifest.
1019
1023
1020 Returns a 2-tuple of (node, flags).
1024 Returns a 2-tuple of (node, flags).
@@ -1022,46 +1026,46 class imanifestdict(Protocol):
1022 Raises ``KeyError`` if the path does not exist in the manifest.
1026 Raises ``KeyError`` if the path does not exist in the manifest.
1023 """
1027 """
1024
1028
1025 def __len__():
1029 def __len__(self):
1026 """Return the number of entries in the manifest."""
1030 """Return the number of entries in the manifest."""
1027
1031
1028 def __nonzero__():
1032 def __nonzero__(self):
1029 """Returns True if the manifest has entries, False otherwise."""
1033 """Returns True if the manifest has entries, False otherwise."""
1030
1034
1031 __bool__ = __nonzero__
1035 __bool__ = __nonzero__
1032
1036
1033 def set(path, node, flags):
1037 def set(self, path, node, flags):
1034 """Define the node value and flags for a path in the manifest.
1038 """Define the node value and flags for a path in the manifest.
1035
1039
1036 Equivalent to __setitem__ followed by setflag, but can be more efficient.
1040 Equivalent to __setitem__ followed by setflag, but can be more efficient.
1037 """
1041 """
1038
1042
1039 def __setitem__(path, node):
1043 def __setitem__(self, path, node):
1040 """Define the node value for a path in the manifest.
1044 """Define the node value for a path in the manifest.
1041
1045
1042 If the path is already in the manifest, its flags will be copied to
1046 If the path is already in the manifest, its flags will be copied to
1043 the new entry.
1047 the new entry.
1044 """
1048 """
1045
1049
1046 def __contains__(path):
1050 def __contains__(self, path):
1047 """Whether a path exists in the manifest."""
1051 """Whether a path exists in the manifest."""
1048
1052
1049 def __delitem__(path):
1053 def __delitem__(self, path):
1050 """Remove a path from the manifest.
1054 """Remove a path from the manifest.
1051
1055
1052 Raises ``KeyError`` if the path is not in the manifest.
1056 Raises ``KeyError`` if the path is not in the manifest.
1053 """
1057 """
1054
1058
1055 def __iter__():
1059 def __iter__(self):
1056 """Iterate over paths in the manifest."""
1060 """Iterate over paths in the manifest."""
1057
1061
1058 def iterkeys():
1062 def iterkeys(self):
1059 """Iterate over paths in the manifest."""
1063 """Iterate over paths in the manifest."""
1060
1064
1061 def keys():
1065 def keys(self):
1062 """Obtain a list of paths in the manifest."""
1066 """Obtain a list of paths in the manifest."""
1063
1067
1064 def filesnotin(other, match=None):
1068 def filesnotin(self, other, match=None):
1065 """Obtain the set of paths in this manifest but not in another.
1069 """Obtain the set of paths in this manifest but not in another.
1066
1070
1067 ``match`` is an optional matcher function to be applied to both
1071 ``match`` is an optional matcher function to be applied to both
@@ -1070,20 +1074,20 class imanifestdict(Protocol):
1070 Returns a set of paths.
1074 Returns a set of paths.
1071 """
1075 """
1072
1076
1073 def dirs():
1077 def dirs(self):
1074 """Returns an object implementing the ``idirs`` interface."""
1078 """Returns an object implementing the ``idirs`` interface."""
1075
1079
1076 def hasdir(dir):
1080 def hasdir(self, dir):
1077 """Returns a bool indicating if a directory is in this manifest."""
1081 """Returns a bool indicating if a directory is in this manifest."""
1078
1082
1079 def walk(match):
1083 def walk(self, match):
1080 """Generator of paths in manifest satisfying a matcher.
1084 """Generator of paths in manifest satisfying a matcher.
1081
1085
1082 If the matcher has explicit files listed and they don't exist in
1086 If the matcher has explicit files listed and they don't exist in
1083 the manifest, ``match.bad()`` is called for each missing file.
1087 the manifest, ``match.bad()`` is called for each missing file.
1084 """
1088 """
1085
1089
1086 def diff(other, match=None, clean=False):
1090 def diff(self, other, match=None, clean=False):
1087 """Find differences between this manifest and another.
1091 """Find differences between this manifest and another.
1088
1092
1089 This manifest is compared to ``other``.
1093 This manifest is compared to ``other``.
@@ -1100,41 +1104,41 class imanifestdict(Protocol):
1100 are the same for the other manifest.
1104 are the same for the other manifest.
1101 """
1105 """
1102
1106
1103 def setflag(path, flag):
1107 def setflag(self, path, flag):
1104 """Set the flag value for a given path.
1108 """Set the flag value for a given path.
1105
1109
1106 Raises ``KeyError`` if the path is not already in the manifest.
1110 Raises ``KeyError`` if the path is not already in the manifest.
1107 """
1111 """
1108
1112
1109 def get(path, default=None):
1113 def get(self, path, default=None):
1110 """Obtain the node value for a path or a default value if missing."""
1114 """Obtain the node value for a path or a default value if missing."""
1111
1115
1112 def flags(path):
1116 def flags(self, path):
1113 """Return the flags value for a path (default: empty bytestring)."""
1117 """Return the flags value for a path (default: empty bytestring)."""
1114
1118
1115 def copy():
1119 def copy(self):
1116 """Return a copy of this manifest."""
1120 """Return a copy of this manifest."""
1117
1121
1118 def items():
1122 def items(self):
1119 """Returns an iterable of (path, node) for items in this manifest."""
1123 """Returns an iterable of (path, node) for items in this manifest."""
1120
1124
1121 def iteritems():
1125 def iteritems(self):
1122 """Identical to items()."""
1126 """Identical to items()."""
1123
1127
1124 def iterentries():
1128 def iterentries(self):
1125 """Returns an iterable of (path, node, flags) for this manifest.
1129 """Returns an iterable of (path, node, flags) for this manifest.
1126
1130
1127 Similar to ``iteritems()`` except items are a 3-tuple and include
1131 Similar to ``iteritems()`` except items are a 3-tuple and include
1128 flags.
1132 flags.
1129 """
1133 """
1130
1134
1131 def text():
1135 def text(self):
1132 """Obtain the raw data representation for this manifest.
1136 """Obtain the raw data representation for this manifest.
1133
1137
1134 Result is used to create a manifest revision.
1138 Result is used to create a manifest revision.
1135 """
1139 """
1136
1140
1137 def fastdelta(base, changes):
1141 def fastdelta(self, base, changes):
1138 """Obtain a delta between this manifest and another given changes.
1142 """Obtain a delta between this manifest and another given changes.
1139
1143
1140 ``base`` in the raw data representation for another manifest.
1144 ``base`` in the raw data representation for another manifest.
@@ -1156,7 +1160,7 class imanifestrevisionbase(Protocol):
1156 as part of a larger interface.
1160 as part of a larger interface.
1157 """
1161 """
1158
1162
1159 def copy():
1163 def copy(self):
1160 """Obtain a copy of this manifest instance.
1164 """Obtain a copy of this manifest instance.
1161
1165
1162 Returns an object conforming to the ``imanifestrevisionwritable``
1166 Returns an object conforming to the ``imanifestrevisionwritable``
@@ -1164,7 +1168,7 class imanifestrevisionbase(Protocol):
1164 ``imanifestlog`` collection as this instance.
1168 ``imanifestlog`` collection as this instance.
1165 """
1169 """
1166
1170
1167 def read():
1171 def read(self):
1168 """Obtain the parsed manifest data structure.
1172 """Obtain the parsed manifest data structure.
1169
1173
1170 The returned object conforms to the ``imanifestdict`` interface.
1174 The returned object conforms to the ``imanifestdict`` interface.
@@ -1174,14 +1178,14 class imanifestrevisionbase(Protocol):
1174 class imanifestrevisionstored(imanifestrevisionbase):
1178 class imanifestrevisionstored(imanifestrevisionbase):
1175 """Interface representing a manifest revision committed to storage."""
1179 """Interface representing a manifest revision committed to storage."""
1176
1180
1177 def node():
1181 def node(self):
1178 """The binary node for this manifest."""
1182 """The binary node for this manifest."""
1179
1183
1180 parents = interfaceutil.Attribute(
1184 parents = interfaceutil.Attribute(
1181 """List of binary nodes that are parents for this manifest revision."""
1185 """List of binary nodes that are parents for this manifest revision."""
1182 )
1186 )
1183
1187
1184 def readdelta(shallow=False):
1188 def readdelta(self, shallow=False):
1185 """Obtain the manifest data structure representing changes from parent.
1189 """Obtain the manifest data structure representing changes from parent.
1186
1190
1187 This manifest is compared to its 1st parent. A new manifest
1191 This manifest is compared to its 1st parent. A new manifest
@@ -1196,7 +1200,7 class imanifestrevisionstored(imanifestr
1196 The returned object conforms to the ``imanifestdict`` interface.
1200 The returned object conforms to the ``imanifestdict`` interface.
1197 """
1201 """
1198
1202
1199 def read_any_fast_delta(valid_bases=None, *, shallow=False):
1203 def read_any_fast_delta(self, valid_bases=None, *, shallow=False):
1200 """read some manifest information as fast if possible
1204 """read some manifest information as fast if possible
1201
1205
1202 This might return a "delta", a manifest object containing only file
1206 This might return a "delta", a manifest object containing only file
@@ -1219,7 +1223,7 class imanifestrevisionstored(imanifestr
1219 The returned object conforms to the ``imanifestdict`` interface.
1223 The returned object conforms to the ``imanifestdict`` interface.
1220 """
1224 """
1221
1225
1222 def read_delta_parents(*, shallow=False, exact=True):
1226 def read_delta_parents(self, *, shallow=False, exact=True):
1223 """return a diff from this revision against both parents.
1227 """return a diff from this revision against both parents.
1224
1228
1225 If `exact` is False, this might return a superset of the diff, containing
1229 If `exact` is False, this might return a superset of the diff, containing
@@ -1233,7 +1237,7 class imanifestrevisionstored(imanifestr
1233
1237
1234 The returned object conforms to the ``imanifestdict`` interface."""
1238 The returned object conforms to the ``imanifestdict`` interface."""
1235
1239
1236 def read_delta_new_entries(*, shallow=False):
1240 def read_delta_new_entries(self, *, shallow=False):
1237 """Return a manifest containing just the entries that might be new to
1241 """Return a manifest containing just the entries that might be new to
1238 the repository.
1242 the repository.
1239
1243
@@ -1248,13 +1252,13 class imanifestrevisionstored(imanifestr
1248
1252
1249 The returned object conforms to the ``imanifestdict`` interface."""
1253 The returned object conforms to the ``imanifestdict`` interface."""
1250
1254
1251 def readfast(shallow=False):
1255 def readfast(self, shallow=False):
1252 """Calls either ``read()`` or ``readdelta()``.
1256 """Calls either ``read()`` or ``readdelta()``.
1253
1257
1254 The faster of the two options is called.
1258 The faster of the two options is called.
1255 """
1259 """
1256
1260
1257 def find(key):
1261 def find(self, key):
1258 """Calls self.read().find(key)``.
1262 """Calls self.read().find(key)``.
1259
1263
1260 Returns a 2-tuple of ``(node, flags)`` or raises ``KeyError``.
1264 Returns a 2-tuple of ``(node, flags)`` or raises ``KeyError``.
@@ -1264,7 +1268,9 class imanifestrevisionstored(imanifestr
1264 class imanifestrevisionwritable(imanifestrevisionbase):
1268 class imanifestrevisionwritable(imanifestrevisionbase):
1265 """Interface representing a manifest revision that can be committed."""
1269 """Interface representing a manifest revision that can be committed."""
1266
1270
1267 def write(transaction, linkrev, p1node, p2node, added, removed, match=None):
1271 def write(
1272 self, transaction, linkrev, p1node, p2node, added, removed, match=None
1273 ):
1268 """Add this revision to storage.
1274 """Add this revision to storage.
1269
1275
1270 Takes a transaction object, the changeset revision number it will
1276 Takes a transaction object, the changeset revision number it will
@@ -1312,25 +1318,25 class imanifeststorage(Protocol):
1312 """
1318 """
1313 )
1319 )
1314
1320
1315 def __len__():
1321 def __len__(self):
1316 """Obtain the number of revisions stored for this manifest."""
1322 """Obtain the number of revisions stored for this manifest."""
1317
1323
1318 def __iter__():
1324 def __iter__(self):
1319 """Iterate over revision numbers for this manifest."""
1325 """Iterate over revision numbers for this manifest."""
1320
1326
1321 def rev(node):
1327 def rev(self, node):
1322 """Obtain the revision number given a binary node.
1328 """Obtain the revision number given a binary node.
1323
1329
1324 Raises ``error.LookupError`` if the node is not known.
1330 Raises ``error.LookupError`` if the node is not known.
1325 """
1331 """
1326
1332
1327 def node(rev):
1333 def node(self, rev):
1328 """Obtain the node value given a revision number.
1334 """Obtain the node value given a revision number.
1329
1335
1330 Raises ``error.LookupError`` if the revision is not known.
1336 Raises ``error.LookupError`` if the revision is not known.
1331 """
1337 """
1332
1338
1333 def lookup(value):
1339 def lookup(self, value):
1334 """Attempt to resolve a value to a node.
1340 """Attempt to resolve a value to a node.
1335
1341
1336 Value can be a binary node, hex node, revision number, or a bytes
1342 Value can be a binary node, hex node, revision number, or a bytes
@@ -1339,38 +1345,39 class imanifeststorage(Protocol):
1339 Raises ``error.LookupError`` if a ndoe could not be resolved.
1345 Raises ``error.LookupError`` if a ndoe could not be resolved.
1340 """
1346 """
1341
1347
1342 def parents(node):
1348 def parents(self, node):
1343 """Returns a 2-tuple of parent nodes for a node.
1349 """Returns a 2-tuple of parent nodes for a node.
1344
1350
1345 Values will be ``nullid`` if the parent is empty.
1351 Values will be ``nullid`` if the parent is empty.
1346 """
1352 """
1347
1353
1348 def parentrevs(rev):
1354 def parentrevs(self, rev):
1349 """Like parents() but operates on revision numbers."""
1355 """Like parents() but operates on revision numbers."""
1350
1356
1351 def linkrev(rev):
1357 def linkrev(self, rev):
1352 """Obtain the changeset revision number a revision is linked to."""
1358 """Obtain the changeset revision number a revision is linked to."""
1353
1359
1354 def revision(node):
1360 def revision(self, node):
1355 """Obtain fulltext data for a node."""
1361 """Obtain fulltext data for a node."""
1356
1362
1357 def rawdata(node):
1363 def rawdata(self, node):
1358 """Obtain raw data for a node."""
1364 """Obtain raw data for a node."""
1359
1365
1360 def revdiff(rev1, rev2):
1366 def revdiff(self, rev1, rev2):
1361 """Obtain a delta between two revision numbers.
1367 """Obtain a delta between two revision numbers.
1362
1368
1363 The returned data is the result of ``bdiff.bdiff()`` on the raw
1369 The returned data is the result of ``bdiff.bdiff()`` on the raw
1364 revision data.
1370 revision data.
1365 """
1371 """
1366
1372
1367 def cmp(node, fulltext):
1373 def cmp(self, node, fulltext):
1368 """Compare fulltext to another revision.
1374 """Compare fulltext to another revision.
1369
1375
1370 Returns True if the fulltext is different from what is stored.
1376 Returns True if the fulltext is different from what is stored.
1371 """
1377 """
1372
1378
1373 def emitrevisions(
1379 def emitrevisions(
1380 self,
1374 nodes,
1381 nodes,
1375 nodesorder=None,
1382 nodesorder=None,
1376 revisiondata=False,
1383 revisiondata=False,
@@ -1382,6 +1389,7 class imanifeststorage(Protocol):
1382 """
1389 """
1383
1390
1384 def addgroup(
1391 def addgroup(
1392 self,
1385 deltas,
1393 deltas,
1386 linkmapper,
1394 linkmapper,
1387 transaction,
1395 transaction,
@@ -1393,7 +1401,7 class imanifeststorage(Protocol):
1393 See the documentation in ``ifilemutation`` for more.
1401 See the documentation in ``ifilemutation`` for more.
1394 """
1402 """
1395
1403
1396 def rawsize(rev):
1404 def rawsize(self, rev):
1397 """Obtain the size of tracked data.
1405 """Obtain the size of tracked data.
1398
1406
1399 Is equivalent to ``len(m.rawdata(node))``.
1407 Is equivalent to ``len(m.rawdata(node))``.
@@ -1401,49 +1409,58 class imanifeststorage(Protocol):
1401 TODO this method is only used by upgrade code and may be removed.
1409 TODO this method is only used by upgrade code and may be removed.
1402 """
1410 """
1403
1411
1404 def getstrippoint(minlink):
1412 def getstrippoint(self, minlink):
1405 """Find minimum revision that must be stripped to strip a linkrev.
1413 """Find minimum revision that must be stripped to strip a linkrev.
1406
1414
1407 See the documentation in ``ifilemutation`` for more.
1415 See the documentation in ``ifilemutation`` for more.
1408 """
1416 """
1409
1417
1410 def strip(minlink, transaction):
1418 def strip(self, minlink, transaction):
1411 """Remove storage of items starting at a linkrev.
1419 """Remove storage of items starting at a linkrev.
1412
1420
1413 See the documentation in ``ifilemutation`` for more.
1421 See the documentation in ``ifilemutation`` for more.
1414 """
1422 """
1415
1423
1416 def checksize():
1424 def checksize(self):
1417 """Obtain the expected sizes of backing files.
1425 """Obtain the expected sizes of backing files.
1418
1426
1419 TODO this is used by verify and it should not be part of the interface.
1427 TODO this is used by verify and it should not be part of the interface.
1420 """
1428 """
1421
1429
1422 def files():
1430 def files(self):
1423 """Obtain paths that are backing storage for this manifest.
1431 """Obtain paths that are backing storage for this manifest.
1424
1432
1425 TODO this is used by verify and there should probably be a better API
1433 TODO this is used by verify and there should probably be a better API
1426 for this functionality.
1434 for this functionality.
1427 """
1435 """
1428
1436
1429 def deltaparent(rev):
1437 def deltaparent(self, rev):
1430 """Obtain the revision that a revision is delta'd against.
1438 """Obtain the revision that a revision is delta'd against.
1431
1439
1432 TODO delta encoding is an implementation detail of storage and should
1440 TODO delta encoding is an implementation detail of storage and should
1433 not be exposed to the storage interface.
1441 not be exposed to the storage interface.
1434 """
1442 """
1435
1443
1436 def clone(tr, dest, **kwargs):
1444 def clone(self, tr, dest, **kwargs):
1437 """Clone this instance to another."""
1445 """Clone this instance to another."""
1438
1446
1439 def clearcaches(clear_persisted_data=False):
1447 def clearcaches(self, clear_persisted_data=False):
1440 """Clear any caches associated with this instance."""
1448 """Clear any caches associated with this instance."""
1441
1449
1442 def dirlog(d):
1450 def dirlog(self, d):
1443 """Obtain a manifest storage instance for a tree."""
1451 """Obtain a manifest storage instance for a tree."""
1444
1452
1445 def add(
1453 def add(
1446 m, transaction, link, p1, p2, added, removed, readtree=None, match=None
1454 self,
1455 m,
1456 transaction,
1457 link,
1458 p1,
1459 p2,
1460 added,
1461 removed,
1462 readtree=None,
1463 match=None,
1447 ):
1464 ):
1448 """Add a revision to storage.
1465 """Add a revision to storage.
1449
1466
@@ -1467,6 +1484,7 class imanifeststorage(Protocol):
1467 """
1484 """
1468
1485
1469 def storageinfo(
1486 def storageinfo(
1487 self,
1470 exclusivefiles=False,
1488 exclusivefiles=False,
1471 sharedfiles=False,
1489 sharedfiles=False,
1472 revisionscount=False,
1490 revisionscount=False,
@@ -1479,7 +1497,7 class imanifeststorage(Protocol):
1479 This one behaves the same way, except for manifest data.
1497 This one behaves the same way, except for manifest data.
1480 """
1498 """
1481
1499
1482 def get_revlog():
1500 def get_revlog(self):
1483 """return an actual revlog instance if any
1501 """return an actual revlog instance if any
1484
1502
1485 This exist because a lot of code leverage the fact the underlying
1503 This exist because a lot of code leverage the fact the underlying
@@ -1505,7 +1523,7 class imanifestlog(Protocol):
1505 """True, is the manifest is narrowed by a matcher"""
1523 """True, is the manifest is narrowed by a matcher"""
1506 )
1524 )
1507
1525
1508 def __getitem__(node):
1526 def __getitem__(self, node):
1509 """Obtain a manifest instance for a given binary node.
1527 """Obtain a manifest instance for a given binary node.
1510
1528
1511 Equivalent to calling ``self.get('', node)``.
1529 Equivalent to calling ``self.get('', node)``.
@@ -1514,7 +1532,7 class imanifestlog(Protocol):
1514 interface.
1532 interface.
1515 """
1533 """
1516
1534
1517 def get(tree, node, verify=True):
1535 def get(self, tree, node, verify=True):
1518 """Retrieve the manifest instance for a given directory and binary node.
1536 """Retrieve the manifest instance for a given directory and binary node.
1519
1537
1520 ``node`` always refers to the node of the root manifest (which will be
1538 ``node`` always refers to the node of the root manifest (which will be
@@ -1531,7 +1549,7 class imanifestlog(Protocol):
1531 interface.
1549 interface.
1532 """
1550 """
1533
1551
1534 def getstorage(tree):
1552 def getstorage(self, tree):
1535 """Retrieve an interface to storage for a particular tree.
1553 """Retrieve an interface to storage for a particular tree.
1536
1554
1537 If ``tree`` is the empty bytestring, storage for the root manifest will
1555 If ``tree`` is the empty bytestring, storage for the root manifest will
@@ -1540,16 +1558,16 class imanifestlog(Protocol):
1540 TODO formalize interface for returned object.
1558 TODO formalize interface for returned object.
1541 """
1559 """
1542
1560
1543 def clearcaches(clear_persisted_data: bool = False) -> None:
1561 def clearcaches(self, clear_persisted_data: bool = False) -> None:
1544 """Clear caches associated with this collection."""
1562 """Clear caches associated with this collection."""
1545
1563
1546 def rev(node):
1564 def rev(self, node):
1547 """Obtain the revision number for a binary node.
1565 """Obtain the revision number for a binary node.
1548
1566
1549 Raises ``error.LookupError`` if the node is not known.
1567 Raises ``error.LookupError`` if the node is not known.
1550 """
1568 """
1551
1569
1552 def update_caches(transaction):
1570 def update_caches(self, transaction):
1553 """update whatever cache are relevant for the used storage."""
1571 """update whatever cache are relevant for the used storage."""
1554
1572
1555
1573
@@ -1560,7 +1578,7 class ilocalrepositoryfilestorage(Protoc
1560 tracked file path.
1578 tracked file path.
1561 """
1579 """
1562
1580
1563 def file(f):
1581 def file(self, f):
1564 """Obtain a filelog for a tracked path.
1582 """Obtain a filelog for a tracked path.
1565
1583
1566 The returned type conforms to the ``ifilestorage`` interface.
1584 The returned type conforms to the ``ifilestorage`` interface.
@@ -1700,16 +1718,16 class ilocalrepositorymain(Protocol):
1700 """The way files copies should be dealt with in this repo."""
1718 """The way files copies should be dealt with in this repo."""
1701 )
1719 )
1702
1720
1703 def close():
1721 def close(self):
1704 """Close the handle on this repository."""
1722 """Close the handle on this repository."""
1705
1723
1706 def peer(path=None):
1724 def peer(self, path=None):
1707 """Obtain an object conforming to the ``peer`` interface."""
1725 """Obtain an object conforming to the ``peer`` interface."""
1708
1726
1709 def unfiltered():
1727 def unfiltered(self):
1710 """Obtain an unfiltered/raw view of this repo."""
1728 """Obtain an unfiltered/raw view of this repo."""
1711
1729
1712 def filtered(name, visibilityexceptions=None):
1730 def filtered(self, name, visibilityexceptions=None):
1713 """Obtain a named view of this repository."""
1731 """Obtain a named view of this repository."""
1714
1732
1715 obsstore = interfaceutil.Attribute("""A store of obsolescence data.""")
1733 obsstore = interfaceutil.Attribute("""A store of obsolescence data.""")
@@ -1729,73 +1747,73 class ilocalrepositorymain(Protocol):
1729 """Matcher patterns for this repository's narrowspec."""
1747 """Matcher patterns for this repository's narrowspec."""
1730 )
1748 )
1731
1749
1732 def narrowmatch(match=None, includeexact=False):
1750 def narrowmatch(self, match=None, includeexact=False):
1733 """Obtain a matcher for the narrowspec."""
1751 """Obtain a matcher for the narrowspec."""
1734
1752
1735 def setnarrowpats(newincludes, newexcludes):
1753 def setnarrowpats(self, newincludes, newexcludes):
1736 """Define the narrowspec for this repository."""
1754 """Define the narrowspec for this repository."""
1737
1755
1738 def __getitem__(changeid):
1756 def __getitem__(self, changeid):
1739 """Try to resolve a changectx."""
1757 """Try to resolve a changectx."""
1740
1758
1741 def __contains__(changeid):
1759 def __contains__(self, changeid):
1742 """Whether a changeset exists."""
1760 """Whether a changeset exists."""
1743
1761
1744 def __nonzero__():
1762 def __nonzero__(self):
1745 """Always returns True."""
1763 """Always returns True."""
1746 return True
1764 return True
1747
1765
1748 __bool__ = __nonzero__
1766 __bool__ = __nonzero__
1749
1767
1750 def __len__():
1768 def __len__(self):
1751 """Returns the number of changesets in the repo."""
1769 """Returns the number of changesets in the repo."""
1752
1770
1753 def __iter__():
1771 def __iter__(self):
1754 """Iterate over revisions in the changelog."""
1772 """Iterate over revisions in the changelog."""
1755
1773
1756 def revs(expr, *args):
1774 def revs(self, expr, *args):
1757 """Evaluate a revset.
1775 """Evaluate a revset.
1758
1776
1759 Emits revisions.
1777 Emits revisions.
1760 """
1778 """
1761
1779
1762 def set(expr, *args):
1780 def set(self, expr, *args):
1763 """Evaluate a revset.
1781 """Evaluate a revset.
1764
1782
1765 Emits changectx instances.
1783 Emits changectx instances.
1766 """
1784 """
1767
1785
1768 def anyrevs(specs, user=False, localalias=None):
1786 def anyrevs(self, specs, user=False, localalias=None):
1769 """Find revisions matching one of the given revsets."""
1787 """Find revisions matching one of the given revsets."""
1770
1788
1771 def url():
1789 def url(self):
1772 """Returns a string representing the location of this repo."""
1790 """Returns a string representing the location of this repo."""
1773
1791
1774 def hook(name, throw=False, **args):
1792 def hook(self, name, throw=False, **args):
1775 """Call a hook."""
1793 """Call a hook."""
1776
1794
1777 def tags():
1795 def tags(self):
1778 """Return a mapping of tag to node."""
1796 """Return a mapping of tag to node."""
1779
1797
1780 def tagtype(tagname):
1798 def tagtype(self, tagname):
1781 """Return the type of a given tag."""
1799 """Return the type of a given tag."""
1782
1800
1783 def tagslist():
1801 def tagslist(self):
1784 """Return a list of tags ordered by revision."""
1802 """Return a list of tags ordered by revision."""
1785
1803
1786 def nodetags(node):
1804 def nodetags(self, node):
1787 """Return the tags associated with a node."""
1805 """Return the tags associated with a node."""
1788
1806
1789 def nodebookmarks(node):
1807 def nodebookmarks(self, node):
1790 """Return the list of bookmarks pointing to the specified node."""
1808 """Return the list of bookmarks pointing to the specified node."""
1791
1809
1792 def branchmap():
1810 def branchmap(self):
1793 """Return a mapping of branch to heads in that branch."""
1811 """Return a mapping of branch to heads in that branch."""
1794
1812
1795 def revbranchcache():
1813 def revbranchcache(self):
1796 pass
1814 pass
1797
1815
1798 def register_changeset(rev, changelogrevision):
1816 def register_changeset(self, rev, changelogrevision):
1799 """Extension point for caches for new nodes.
1817 """Extension point for caches for new nodes.
1800
1818
1801 Multiple consumers are expected to need parts of the changelogrevision,
1819 Multiple consumers are expected to need parts of the changelogrevision,
@@ -1803,113 +1821,114 class ilocalrepositorymain(Protocol):
1803 cache would be fragile when other revisions are accessed, too."""
1821 cache would be fragile when other revisions are accessed, too."""
1804 pass
1822 pass
1805
1823
1806 def branchtip(branchtip, ignoremissing=False):
1824 def branchtip(self, branchtip, ignoremissing=False):
1807 """Return the tip node for a given branch."""
1825 """Return the tip node for a given branch."""
1808
1826
1809 def lookup(key):
1827 def lookup(self, key):
1810 """Resolve the node for a revision."""
1828 """Resolve the node for a revision."""
1811
1829
1812 def lookupbranch(key):
1830 def lookupbranch(self, key):
1813 """Look up the branch name of the given revision or branch name."""
1831 """Look up the branch name of the given revision or branch name."""
1814
1832
1815 def known(nodes):
1833 def known(self, nodes):
1816 """Determine whether a series of nodes is known.
1834 """Determine whether a series of nodes is known.
1817
1835
1818 Returns a list of bools.
1836 Returns a list of bools.
1819 """
1837 """
1820
1838
1821 def local():
1839 def local(self):
1822 """Whether the repository is local."""
1840 """Whether the repository is local."""
1823 return True
1841 return True
1824
1842
1825 def publishing():
1843 def publishing(self):
1826 """Whether the repository is a publishing repository."""
1844 """Whether the repository is a publishing repository."""
1827
1845
1828 def cancopy():
1846 def cancopy(self):
1829 pass
1847 pass
1830
1848
1831 def shared():
1849 def shared(self):
1832 """The type of shared repository or None."""
1850 """The type of shared repository or None."""
1833
1851
1834 def wjoin(f, *insidef):
1852 def wjoin(self, f, *insidef):
1835 """Calls self.vfs.reljoin(self.root, f, *insidef)"""
1853 """Calls self.vfs.reljoin(self.root, f, *insidef)"""
1836
1854
1837 def setparents(p1, p2):
1855 def setparents(self, p1, p2):
1838 """Set the parent nodes of the working directory."""
1856 """Set the parent nodes of the working directory."""
1839
1857
1840 def filectx(path, changeid=None, fileid=None):
1858 def filectx(self, path, changeid=None, fileid=None):
1841 """Obtain a filectx for the given file revision."""
1859 """Obtain a filectx for the given file revision."""
1842
1860
1843 def getcwd():
1861 def getcwd(self):
1844 """Obtain the current working directory from the dirstate."""
1862 """Obtain the current working directory from the dirstate."""
1845
1863
1846 def pathto(f, cwd=None):
1864 def pathto(self, f, cwd=None):
1847 """Obtain the relative path to a file."""
1865 """Obtain the relative path to a file."""
1848
1866
1849 def adddatafilter(name, fltr):
1867 def adddatafilter(self, name, fltr):
1850 pass
1868 pass
1851
1869
1852 def wread(filename):
1870 def wread(self, filename):
1853 """Read a file from wvfs, using data filters."""
1871 """Read a file from wvfs, using data filters."""
1854
1872
1855 def wwrite(filename, data, flags, backgroundclose=False, **kwargs):
1873 def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs):
1856 """Write data to a file in the wvfs, using data filters."""
1874 """Write data to a file in the wvfs, using data filters."""
1857
1875
1858 def wwritedata(filename, data):
1876 def wwritedata(self, filename, data):
1859 """Resolve data for writing to the wvfs, using data filters."""
1877 """Resolve data for writing to the wvfs, using data filters."""
1860
1878
1861 def currenttransaction():
1879 def currenttransaction(self):
1862 """Obtain the current transaction instance or None."""
1880 """Obtain the current transaction instance or None."""
1863
1881
1864 def transaction(desc, report=None):
1882 def transaction(self, desc, report=None):
1865 """Open a new transaction to write to the repository."""
1883 """Open a new transaction to write to the repository."""
1866
1884
1867 def undofiles():
1885 def undofiles(self):
1868 """Returns a list of (vfs, path) for files to undo transactions."""
1886 """Returns a list of (vfs, path) for files to undo transactions."""
1869
1887
1870 def recover():
1888 def recover(self):
1871 """Roll back an interrupted transaction."""
1889 """Roll back an interrupted transaction."""
1872
1890
1873 def rollback(dryrun=False, force=False):
1891 def rollback(self, dryrun=False, force=False):
1874 """Undo the last transaction.
1892 """Undo the last transaction.
1875
1893
1876 DANGEROUS.
1894 DANGEROUS.
1877 """
1895 """
1878
1896
1879 def updatecaches(tr=None, full=False, caches=None):
1897 def updatecaches(self, tr=None, full=False, caches=None):
1880 """Warm repo caches."""
1898 """Warm repo caches."""
1881
1899
1882 def invalidatecaches():
1900 def invalidatecaches(self):
1883 """Invalidate cached data due to the repository mutating."""
1901 """Invalidate cached data due to the repository mutating."""
1884
1902
1885 def invalidatevolatilesets():
1903 def invalidatevolatilesets(self):
1886 pass
1904 pass
1887
1905
1888 def invalidatedirstate():
1906 def invalidatedirstate(self):
1889 """Invalidate the dirstate."""
1907 """Invalidate the dirstate."""
1890
1908
1891 def invalidate(clearfilecache=False):
1909 def invalidate(self, clearfilecache=False):
1892 pass
1910 pass
1893
1911
1894 def invalidateall():
1912 def invalidateall(self):
1895 pass
1913 pass
1896
1914
1897 def lock(wait=True):
1915 def lock(self, wait=True):
1898 """Lock the repository store and return a lock instance."""
1916 """Lock the repository store and return a lock instance."""
1899
1917
1900 def currentlock():
1918 def currentlock(self):
1901 """Return the lock if it's held or None."""
1919 """Return the lock if it's held or None."""
1902
1920
1903 def wlock(wait=True):
1921 def wlock(self, wait=True):
1904 """Lock the non-store parts of the repository."""
1922 """Lock the non-store parts of the repository."""
1905
1923
1906 def currentwlock():
1924 def currentwlock(self):
1907 """Return the wlock if it's held or None."""
1925 """Return the wlock if it's held or None."""
1908
1926
1909 def checkcommitpatterns(wctx, match, status, fail):
1927 def checkcommitpatterns(self, wctx, match, status, fail):
1910 pass
1928 pass
1911
1929
1912 def commit(
1930 def commit(
1931 self,
1913 text=b'',
1932 text=b'',
1914 user=None,
1933 user=None,
1915 date=None,
1934 date=None,
@@ -1920,16 +1939,17 class ilocalrepositorymain(Protocol):
1920 ):
1939 ):
1921 """Add a new revision to the repository."""
1940 """Add a new revision to the repository."""
1922
1941
1923 def commitctx(ctx, error=False, origctx=None):
1942 def commitctx(self, ctx, error=False, origctx=None):
1924 """Commit a commitctx instance to the repository."""
1943 """Commit a commitctx instance to the repository."""
1925
1944
1926 def destroying():
1945 def destroying(self):
1927 """Inform the repository that nodes are about to be destroyed."""
1946 """Inform the repository that nodes are about to be destroyed."""
1928
1947
1929 def destroyed():
1948 def destroyed(self):
1930 """Inform the repository that nodes have been destroyed."""
1949 """Inform the repository that nodes have been destroyed."""
1931
1950
1932 def status(
1951 def status(
1952 self,
1933 node1=b'.',
1953 node1=b'.',
1934 node2=None,
1954 node2=None,
1935 match=None,
1955 match=None,
@@ -1940,50 +1960,50 class ilocalrepositorymain(Protocol):
1940 ):
1960 ):
1941 """Convenience method to call repo[x].status()."""
1961 """Convenience method to call repo[x].status()."""
1942
1962
1943 def addpostdsstatus(ps):
1963 def addpostdsstatus(self, ps):
1944 pass
1964 pass
1945
1965
1946 def postdsstatus():
1966 def postdsstatus(self):
1947 pass
1967 pass
1948
1968
1949 def clearpostdsstatus():
1969 def clearpostdsstatus(self):
1950 pass
1970 pass
1951
1971
1952 def heads(start=None):
1972 def heads(self, start=None):
1953 """Obtain list of nodes that are DAG heads."""
1973 """Obtain list of nodes that are DAG heads."""
1954
1974
1955 def branchheads(branch=None, start=None, closed=False):
1975 def branchheads(self, branch=None, start=None, closed=False):
1956 pass
1976 pass
1957
1977
1958 def branches(nodes):
1978 def branches(self, nodes):
1959 pass
1979 pass
1960
1980
1961 def between(pairs):
1981 def between(self, pairs):
1962 pass
1982 pass
1963
1983
1964 def checkpush(pushop):
1984 def checkpush(self, pushop):
1965 pass
1985 pass
1966
1986
1967 prepushoutgoinghooks = interfaceutil.Attribute("""util.hooks instance.""")
1987 prepushoutgoinghooks = interfaceutil.Attribute("""util.hooks instance.""")
1968
1988
1969 def pushkey(namespace, key, old, new):
1989 def pushkey(self, namespace, key, old, new):
1970 pass
1990 pass
1971
1991
1972 def listkeys(namespace):
1992 def listkeys(self, namespace):
1973 pass
1993 pass
1974
1994
1975 def debugwireargs(one, two, three=None, four=None, five=None):
1995 def debugwireargs(self, one, two, three=None, four=None, five=None):
1976 pass
1996 pass
1977
1997
1978 def savecommitmessage(text):
1998 def savecommitmessage(self, text):
1979 pass
1999 pass
1980
2000
1981 def register_sidedata_computer(
2001 def register_sidedata_computer(
1982 kind, category, keys, computer, flags, replace=False
2002 self, kind, category, keys, computer, flags, replace=False
1983 ):
2003 ):
1984 pass
2004 pass
1985
2005
1986 def register_wanted_sidedata(category):
2006 def register_wanted_sidedata(self, category):
1987 pass
2007 pass
1988
2008
1989
2009
@@ -2076,20 +2096,20 class iwireprotocolcommandcacher(Protoco
2076 instances to avoid this overhead.
2096 instances to avoid this overhead.
2077 """
2097 """
2078
2098
2079 def __enter__():
2099 def __enter__(self):
2080 """Marks the instance as active.
2100 """Marks the instance as active.
2081
2101
2082 Should return self.
2102 Should return self.
2083 """
2103 """
2084
2104
2085 def __exit__(exctype, excvalue, exctb):
2105 def __exit__(self, exctype, excvalue, exctb):
2086 """Called when cacher is no longer used.
2106 """Called when cacher is no longer used.
2087
2107
2088 This can be used by implementations to perform cleanup actions (e.g.
2108 This can be used by implementations to perform cleanup actions (e.g.
2089 disconnecting network sockets, aborting a partially cached response.
2109 disconnecting network sockets, aborting a partially cached response.
2090 """
2110 """
2091
2111
2092 def adjustcachekeystate(state):
2112 def adjustcachekeystate(self, state):
2093 """Influences cache key derivation by adjusting state to derive key.
2113 """Influences cache key derivation by adjusting state to derive key.
2094
2114
2095 A dict defining the state used to derive the cache key is passed.
2115 A dict defining the state used to derive the cache key is passed.
@@ -2101,7 +2121,7 class iwireprotocolcommandcacher(Protoco
2101 existing keys.
2121 existing keys.
2102 """
2122 """
2103
2123
2104 def setcachekey(key):
2124 def setcachekey(self, key):
2105 """Record the derived cache key for this request.
2125 """Record the derived cache key for this request.
2106
2126
2107 Instances may mutate the key for internal usage, as desired. e.g.
2127 Instances may mutate the key for internal usage, as desired. e.g.
@@ -2113,7 +2133,7 class iwireprotocolcommandcacher(Protoco
2113 instance.
2133 instance.
2114 """
2134 """
2115
2135
2116 def lookup():
2136 def lookup(self):
2117 """Attempt to resolve an entry in the cache.
2137 """Attempt to resolve an entry in the cache.
2118
2138
2119 The instance is instructed to look for the cache key that it was
2139 The instance is instructed to look for the cache key that it was
@@ -2131,7 +2151,7 class iwireprotocolcommandcacher(Protoco
2131 would return if invoked or an equivalent representation thereof.
2151 would return if invoked or an equivalent representation thereof.
2132 """
2152 """
2133
2153
2134 def onobject(obj):
2154 def onobject(self, obj):
2135 """Called when a new object is emitted from the command function.
2155 """Called when a new object is emitted from the command function.
2136
2156
2137 Receives as its argument the object that was emitted from the
2157 Receives as its argument the object that was emitted from the
@@ -2142,7 +2162,7 class iwireprotocolcommandcacher(Protoco
2142 ``yield obj``.
2162 ``yield obj``.
2143 """
2163 """
2144
2164
2145 def onfinished():
2165 def onfinished(self):
2146 """Called after all objects have been emitted from the command function.
2166 """Called after all objects have been emitted from the command function.
2147
2167
2148 Implementations should return an iterator of objects to forward to
2168 Implementations should return an iterator of objects to forward to
General Comments 0
You need to be logged in to leave comments. Login now