##// END OF EJS Templates
repository: define new interface for running commands...
Gregory Szorc -
r37647:fa038208 default
parent child Browse files
Show More
@@ -1,936 +1,1018
1 1 # repository.py - Interfaces and base classes for repositories and peers.
2 2 #
3 3 # Copyright 2017 Gregory Szorc <gregory.szorc@gmail.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 from .i18n import _
11 11 from .thirdparty.zope import (
12 12 interface as zi,
13 13 )
14 14 from . import (
15 15 error,
16 16 )
17 17
18 18 class ipeerconnection(zi.Interface):
19 19 """Represents a "connection" to a repository.
20 20
21 21 This is the base interface for representing a connection to a repository.
22 22 It holds basic properties and methods applicable to all peer types.
23 23
24 24 This is not a complete interface definition and should not be used
25 25 outside of this module.
26 26 """
27 27 ui = zi.Attribute("""ui.ui instance""")
28 28
29 29 def url():
30 30 """Returns a URL string representing this peer.
31 31
32 32 Currently, implementations expose the raw URL used to construct the
33 33 instance. It may contain credentials as part of the URL. The
34 34 expectations of the value aren't well-defined and this could lead to
35 35 data leakage.
36 36
37 37 TODO audit/clean consumers and more clearly define the contents of this
38 38 value.
39 39 """
40 40
41 41 def local():
42 42 """Returns a local repository instance.
43 43
44 44 If the peer represents a local repository, returns an object that
45 45 can be used to interface with it. Otherwise returns ``None``.
46 46 """
47 47
48 48 def peer():
49 49 """Returns an object conforming to this interface.
50 50
51 51 Most implementations will ``return self``.
52 52 """
53 53
54 54 def canpush():
55 55 """Returns a boolean indicating if this peer can be pushed to."""
56 56
57 57 def close():
58 58 """Close the connection to this peer.
59 59
60 60 This is called when the peer will no longer be used. Resources
61 61 associated with the peer should be cleaned up.
62 62 """
63 63
64 64 class ipeercapabilities(zi.Interface):
65 65 """Peer sub-interface related to capabilities."""
66 66
67 67 def capable(name):
68 68 """Determine support for a named capability.
69 69
70 70 Returns ``False`` if capability not supported.
71 71
72 72 Returns ``True`` if boolean capability is supported. Returns a string
73 73 if capability support is non-boolean.
74 74
75 75 Capability strings may or may not map to wire protocol capabilities.
76 76 """
77 77
78 78 def requirecap(name, purpose):
79 79 """Require a capability to be present.
80 80
81 81 Raises a ``CapabilityError`` if the capability isn't present.
82 82 """
83 83
84 84 class ipeercommands(zi.Interface):
85 85 """Client-side interface for communicating over the wire protocol.
86 86
87 87 This interface is used as a gateway to the Mercurial wire protocol.
88 88 methods commonly call wire protocol commands of the same name.
89 89 """
90 90
91 91 def branchmap():
92 92 """Obtain heads in named branches.
93 93
94 94 Returns a dict mapping branch name to an iterable of nodes that are
95 95 heads on that branch.
96 96 """
97 97
98 98 def capabilities():
99 99 """Obtain capabilities of the peer.
100 100
101 101 Returns a set of string capabilities.
102 102 """
103 103
104 104 def debugwireargs(one, two, three=None, four=None, five=None):
105 105 """Used to facilitate debugging of arguments passed over the wire."""
106 106
107 107 def getbundle(source, **kwargs):
108 108 """Obtain remote repository data as a bundle.
109 109
110 110 This command is how the bulk of repository data is transferred from
111 111 the peer to the local repository
112 112
113 113 Returns a generator of bundle data.
114 114 """
115 115
116 116 def heads():
117 117 """Determine all known head revisions in the peer.
118 118
119 119 Returns an iterable of binary nodes.
120 120 """
121 121
122 122 def known(nodes):
123 123 """Determine whether multiple nodes are known.
124 124
125 125 Accepts an iterable of nodes whose presence to check for.
126 126
127 127 Returns an iterable of booleans indicating of the corresponding node
128 128 at that index is known to the peer.
129 129 """
130 130
131 131 def listkeys(namespace):
132 132 """Obtain all keys in a pushkey namespace.
133 133
134 134 Returns an iterable of key names.
135 135 """
136 136
137 137 def lookup(key):
138 138 """Resolve a value to a known revision.
139 139
140 140 Returns a binary node of the resolved revision on success.
141 141 """
142 142
143 143 def pushkey(namespace, key, old, new):
144 144 """Set a value using the ``pushkey`` protocol.
145 145
146 146 Arguments correspond to the pushkey namespace and key to operate on and
147 147 the old and new values for that key.
148 148
149 149 Returns a string with the peer result. The value inside varies by the
150 150 namespace.
151 151 """
152 152
153 153 def stream_out():
154 154 """Obtain streaming clone data.
155 155
156 156 Successful result should be a generator of data chunks.
157 157 """
158 158
159 159 def unbundle(bundle, heads, url):
160 160 """Transfer repository data to the peer.
161 161
162 162 This is how the bulk of data during a push is transferred.
163 163
164 164 Returns the integer number of heads added to the peer.
165 165 """
166 166
167 167 class ipeerlegacycommands(zi.Interface):
168 168 """Interface for implementing support for legacy wire protocol commands.
169 169
170 170 Wire protocol commands transition to legacy status when they are no longer
171 171 used by modern clients. To facilitate identifying which commands are
172 172 legacy, the interfaces are split.
173 173 """
174 174
175 175 def between(pairs):
176 176 """Obtain nodes between pairs of nodes.
177 177
178 178 ``pairs`` is an iterable of node pairs.
179 179
180 180 Returns an iterable of iterables of nodes corresponding to each
181 181 requested pair.
182 182 """
183 183
184 184 def branches(nodes):
185 185 """Obtain ancestor changesets of specific nodes back to a branch point.
186 186
187 187 For each requested node, the peer finds the first ancestor node that is
188 188 a DAG root or is a merge.
189 189
190 190 Returns an iterable of iterables with the resolved values for each node.
191 191 """
192 192
193 193 def changegroup(nodes, kind):
194 194 """Obtain a changegroup with data for descendants of specified nodes."""
195 195
196 196 def changegroupsubset(bases, heads, kind):
197 197 pass
198 198
199 class ipeercommandexecutor(zi.Interface):
200 """Represents a mechanism to execute remote commands.
201
202 This is the primary interface for requesting that wire protocol commands
203 be executed. Instances of this interface are active in a context manager
204 and have a well-defined lifetime. When the context manager exits, all
205 outstanding requests are waited on.
206 """
207
208 def callcommand(name, args):
209 """Request that a named command be executed.
210
211 Receives the command name and a dictionary of command arguments.
212
213 Returns a ``concurrent.futures.Future`` that will resolve to the
214 result of that command request. That exact value is left up to
215 the implementation and possibly varies by command.
216
217 Not all commands can coexist with other commands in an executor
218 instance: it depends on the underlying wire protocol transport being
219 used and the command itself.
220
221 Implementations MAY call ``sendcommands()`` automatically if the
222 requested command can not coexist with other commands in this executor.
223
224 Implementations MAY call ``sendcommands()`` automatically when the
225 future's ``result()`` is called. So, consumers using multiple
226 commands with an executor MUST ensure that ``result()`` is not called
227 until all command requests have been issued.
228 """
229
230 def sendcommands():
231 """Trigger submission of queued command requests.
232
233 Not all transports submit commands as soon as they are requested to
234 run. When called, this method forces queued command requests to be
235 issued. It will no-op if all commands have already been sent.
236
237 When called, no more new commands may be issued with this executor.
238 """
239
240 def close():
241 """Signal that this command request is finished.
242
243 When called, no more new commands may be issued. All outstanding
244 commands that have previously been issued are waited on before
245 returning. This not only includes waiting for the futures to resolve,
246 but also waiting for all response data to arrive. In other words,
247 calling this waits for all on-wire state for issued command requests
248 to finish.
249
250 When used as a context manager, this method is called when exiting the
251 context manager.
252
253 This method may call ``sendcommands()`` if there are buffered commands.
254 """
255
256 class ipeerrequests(zi.Interface):
257 """Interface for executing commands on a peer."""
258
259 def commandexecutor():
260 """A context manager that resolves to an ipeercommandexecutor.
261
262 The object this resolves to can be used to issue command requests
263 to the peer.
264
265 Callers should call its ``callcommand`` method to issue command
266 requests.
267
268 A new executor should be obtained for each distinct set of commands
269 (possibly just a single command) that the consumer wants to execute
270 as part of a single operation or round trip. This is because some
271 peers are half-duplex and/or don't support persistent connections.
272 e.g. in the case of HTTP peers, commands sent to an executor represent
273 a single HTTP request. While some peers may support multiple command
274 sends over the wire per executor, consumers need to code to the least
275 capable peer. So it should be assumed that command executors buffer
276 called commands until they are told to send them and that each
277 command executor could result in a new connection or wire-level request
278 being issued.
279 """
280
199 281 class ipeerbase(ipeerconnection, ipeercapabilities, ipeercommands):
200 282 """Unified interface for peer repositories.
201 283
202 284 All peer instances must conform to this interface.
203 285 """
204 286 def iterbatch():
205 287 """Obtain an object to be used for multiple method calls.
206 288
207 289 Various operations call several methods on peer instances. If each
208 290 method call were performed immediately and serially, this would
209 291 require round trips to remote peers and/or would slow down execution.
210 292
211 293 Some peers have the ability to "batch" method calls to avoid costly
212 294 round trips or to facilitate concurrent execution.
213 295
214 296 This method returns an object that can be used to indicate intent to
215 297 perform batched method calls.
216 298
217 299 The returned object is a proxy of this peer. It intercepts calls to
218 300 batchable methods and queues them instead of performing them
219 301 immediately. This proxy object has a ``submit`` method that will
220 302 perform all queued batchable method calls. A ``results()`` method
221 303 exposes the results of queued/batched method calls. It is a generator
222 304 of results in the order they were called.
223 305
224 306 Not all peers or wire protocol implementations may actually batch method
225 307 calls. However, they must all support this API.
226 308 """
227 309
228 310 class ipeerbaselegacycommands(ipeerbase, ipeerlegacycommands):
229 311 """Unified peer interface that supports legacy commands."""
230 312
231 313 @zi.implementer(ipeerbase)
232 314 class peer(object):
233 315 """Base class for peer repositories."""
234 316
235 317 def capable(self, name):
236 318 caps = self.capabilities()
237 319 if name in caps:
238 320 return True
239 321
240 322 name = '%s=' % name
241 323 for cap in caps:
242 324 if cap.startswith(name):
243 325 return cap[len(name):]
244 326
245 327 return False
246 328
247 329 def requirecap(self, name, purpose):
248 330 if self.capable(name):
249 331 return
250 332
251 333 raise error.CapabilityError(
252 334 _('cannot %s; remote repository does not support the %r '
253 335 'capability') % (purpose, name))
254 336
255 337 @zi.implementer(ipeerbaselegacycommands)
256 338 class legacypeer(peer):
257 339 """peer but with support for legacy wire protocol commands."""
258 340
259 341 class ifilerevisionssequence(zi.Interface):
260 342 """Contains index data for all revisions of a file.
261 343
262 344 Types implementing this behave like lists of tuples. The index
263 345 in the list corresponds to the revision number. The values contain
264 346 index metadata.
265 347
266 348 The *null* revision (revision number -1) is always the last item
267 349 in the index.
268 350 """
269 351
270 352 def __len__():
271 353 """The total number of revisions."""
272 354
273 355 def __getitem__(rev):
274 356 """Returns the object having a specific revision number.
275 357
276 358 Returns an 8-tuple with the following fields:
277 359
278 360 offset+flags
279 361 Contains the offset and flags for the revision. 64-bit unsigned
280 362 integer where first 6 bytes are the offset and the next 2 bytes
281 363 are flags. The offset can be 0 if it is not used by the store.
282 364 compressed size
283 365 Size of the revision data in the store. It can be 0 if it isn't
284 366 needed by the store.
285 367 uncompressed size
286 368 Fulltext size. It can be 0 if it isn't needed by the store.
287 369 base revision
288 370 Revision number of revision the delta for storage is encoded
289 371 against. -1 indicates not encoded against a base revision.
290 372 link revision
291 373 Revision number of changelog revision this entry is related to.
292 374 p1 revision
293 375 Revision number of 1st parent. -1 if no 1st parent.
294 376 p2 revision
295 377 Revision number of 2nd parent. -1 if no 1st parent.
296 378 node
297 379 Binary node value for this revision number.
298 380
299 381 Negative values should index off the end of the sequence. ``-1``
300 382 should return the null revision. ``-2`` should return the most
301 383 recent revision.
302 384 """
303 385
304 386 def __contains__(rev):
305 387 """Whether a revision number exists."""
306 388
307 389 def insert(self, i, entry):
308 390 """Add an item to the index at specific revision."""
309 391
310 392 class ifileindex(zi.Interface):
311 393 """Storage interface for index data of a single file.
312 394
313 395 File storage data is divided into index metadata and data storage.
314 396 This interface defines the index portion of the interface.
315 397
316 398 The index logically consists of:
317 399
318 400 * A mapping between revision numbers and nodes.
319 401 * DAG data (storing and querying the relationship between nodes).
320 402 * Metadata to facilitate storage.
321 403 """
322 404 index = zi.Attribute(
323 405 """An ``ifilerevisionssequence`` instance.""")
324 406
325 407 def __len__():
326 408 """Obtain the number of revisions stored for this file."""
327 409
328 410 def __iter__():
329 411 """Iterate over revision numbers for this file."""
330 412
331 413 def revs(start=0, stop=None):
332 414 """Iterate over revision numbers for this file, with control."""
333 415
334 416 def parents(node):
335 417 """Returns a 2-tuple of parent nodes for a revision.
336 418
337 419 Values will be ``nullid`` if the parent is empty.
338 420 """
339 421
340 422 def parentrevs(rev):
341 423 """Like parents() but operates on revision numbers."""
342 424
343 425 def rev(node):
344 426 """Obtain the revision number given a node.
345 427
346 428 Raises ``error.LookupError`` if the node is not known.
347 429 """
348 430
349 431 def node(rev):
350 432 """Obtain the node value given a revision number.
351 433
352 434 Raises ``IndexError`` if the node is not known.
353 435 """
354 436
355 437 def lookup(node):
356 438 """Attempt to resolve a value to a node.
357 439
358 440 Value can be a binary node, hex node, revision number, or a string
359 441 that can be converted to an integer.
360 442
361 443 Raises ``error.LookupError`` if a node could not be resolved.
362 444 """
363 445
364 446 def linkrev(rev):
365 447 """Obtain the changeset revision number a revision is linked to."""
366 448
367 449 def flags(rev):
368 450 """Obtain flags used to affect storage of a revision."""
369 451
370 452 def iscensored(rev):
371 453 """Return whether a revision's content has been censored."""
372 454
373 455 def commonancestorsheads(node1, node2):
374 456 """Obtain an iterable of nodes containing heads of common ancestors.
375 457
376 458 See ``ancestor.commonancestorsheads()``.
377 459 """
378 460
379 461 def descendants(revs):
380 462 """Obtain descendant revision numbers for a set of revision numbers.
381 463
382 464 If ``nullrev`` is in the set, this is equivalent to ``revs()``.
383 465 """
384 466
385 467 def headrevs():
386 468 """Obtain a list of revision numbers that are DAG heads.
387 469
388 470 The list is sorted oldest to newest.
389 471
390 472 TODO determine if sorting is required.
391 473 """
392 474
393 475 def heads(start=None, stop=None):
394 476 """Obtain a list of nodes that are DAG heads, with control.
395 477
396 478 The set of revisions examined can be limited by specifying
397 479 ``start`` and ``stop``. ``start`` is a node. ``stop`` is an
398 480 iterable of nodes. DAG traversal starts at earlier revision
399 481 ``start`` and iterates forward until any node in ``stop`` is
400 482 encountered.
401 483 """
402 484
403 485 def children(node):
404 486 """Obtain nodes that are children of a node.
405 487
406 488 Returns a list of nodes.
407 489 """
408 490
409 491 def deltaparent(rev):
410 492 """"Return the revision that is a suitable parent to delta against."""
411 493
412 494 def candelta(baserev, rev):
413 495 """"Whether a delta can be generated between two revisions."""
414 496
415 497 class ifiledata(zi.Interface):
416 498 """Storage interface for data storage of a specific file.
417 499
418 500 This complements ``ifileindex`` and provides an interface for accessing
419 501 data for a tracked file.
420 502 """
421 503 def rawsize(rev):
422 504 """The size of the fulltext data for a revision as stored."""
423 505
424 506 def size(rev):
425 507 """Obtain the fulltext size of file data.
426 508
427 509 Any metadata is excluded from size measurements. Use ``rawsize()`` if
428 510 metadata size is important.
429 511 """
430 512
431 513 def checkhash(fulltext, node, p1=None, p2=None, rev=None):
432 514 """Validate the stored hash of a given fulltext and node.
433 515
434 516 Raises ``error.RevlogError`` is hash validation fails.
435 517 """
436 518
437 519 def revision(node, raw=False):
438 520 """"Obtain fulltext data for a node.
439 521
440 522 By default, any storage transformations are applied before the data
441 523 is returned. If ``raw`` is True, non-raw storage transformations
442 524 are not applied.
443 525
444 526 The fulltext data may contain a header containing metadata. Most
445 527 consumers should use ``read()`` to obtain the actual file data.
446 528 """
447 529
448 530 def read(node):
449 531 """Resolve file fulltext data.
450 532
451 533 This is similar to ``revision()`` except any metadata in the data
452 534 headers is stripped.
453 535 """
454 536
455 537 def renamed(node):
456 538 """Obtain copy metadata for a node.
457 539
458 540 Returns ``False`` if no copy metadata is stored or a 2-tuple of
459 541 (path, node) from which this revision was copied.
460 542 """
461 543
462 544 def cmp(node, fulltext):
463 545 """Compare fulltext to another revision.
464 546
465 547 Returns True if the fulltext is different from what is stored.
466 548
467 549 This takes copy metadata into account.
468 550
469 551 TODO better document the copy metadata and censoring logic.
470 552 """
471 553
472 554 def revdiff(rev1, rev2):
473 555 """Obtain a delta between two revision numbers.
474 556
475 557 Operates on raw data in the store (``revision(node, raw=True)``).
476 558
477 559 The returned data is the result of ``bdiff.bdiff`` on the raw
478 560 revision data.
479 561 """
480 562
481 563 class ifilemutation(zi.Interface):
482 564 """Storage interface for mutation events of a tracked file."""
483 565
484 566 def add(filedata, meta, transaction, linkrev, p1, p2):
485 567 """Add a new revision to the store.
486 568
487 569 Takes file data, dictionary of metadata, a transaction, linkrev,
488 570 and parent nodes.
489 571
490 572 Returns the node that was added.
491 573
492 574 May no-op if a revision matching the supplied data is already stored.
493 575 """
494 576
495 577 def addrevision(revisiondata, transaction, linkrev, p1, p2, node=None,
496 578 flags=0, cachedelta=None):
497 579 """Add a new revision to the store.
498 580
499 581 This is similar to ``add()`` except it operates at a lower level.
500 582
501 583 The data passed in already contains a metadata header, if any.
502 584
503 585 ``node`` and ``flags`` can be used to define the expected node and
504 586 the flags to use with storage.
505 587
506 588 ``add()`` is usually called when adding files from e.g. the working
507 589 directory. ``addrevision()`` is often called by ``add()`` and for
508 590 scenarios where revision data has already been computed, such as when
509 591 applying raw data from a peer repo.
510 592 """
511 593
512 594 def addgroup(deltas, linkmapper, transaction, addrevisioncb=None):
513 595 """Process a series of deltas for storage.
514 596
515 597 ``deltas`` is an iterable of 7-tuples of
516 598 (node, p1, p2, linknode, deltabase, delta, flags) defining revisions
517 599 to add.
518 600
519 601 The ``delta`` field contains ``mpatch`` data to apply to a base
520 602 revision, identified by ``deltabase``. The base node can be
521 603 ``nullid``, in which case the header from the delta can be ignored
522 604 and the delta used as the fulltext.
523 605
524 606 ``addrevisioncb`` should be called for each node as it is committed.
525 607
526 608 Returns a list of nodes that were processed. A node will be in the list
527 609 even if it existed in the store previously.
528 610 """
529 611
530 612 def getstrippoint(minlink):
531 613 """Find the minimum revision that must be stripped to strip a linkrev.
532 614
533 615 Returns a 2-tuple containing the minimum revision number and a set
534 616 of all revisions numbers that would be broken by this strip.
535 617
536 618 TODO this is highly revlog centric and should be abstracted into
537 619 a higher-level deletion API. ``repair.strip()`` relies on this.
538 620 """
539 621
540 622 def strip(minlink, transaction):
541 623 """Remove storage of items starting at a linkrev.
542 624
543 625 This uses ``getstrippoint()`` to determine the first node to remove.
544 626 Then it effectively truncates storage for all revisions after that.
545 627
546 628 TODO this is highly revlog centric and should be abstracted into a
547 629 higher-level deletion API.
548 630 """
549 631
550 632 class ifilestorage(ifileindex, ifiledata, ifilemutation):
551 633 """Complete storage interface for a single tracked file."""
552 634
553 635 version = zi.Attribute(
554 636 """Version number of storage.
555 637
556 638 TODO this feels revlog centric and could likely be removed.
557 639 """)
558 640
559 641 storedeltachains = zi.Attribute(
560 642 """Whether the store stores deltas.
561 643
562 644 TODO deltachains are revlog centric. This can probably removed
563 645 once there are better abstractions for obtaining/writing
564 646 data.
565 647 """)
566 648
567 649 _generaldelta = zi.Attribute(
568 650 """Whether deltas can be against any parent revision.
569 651
570 652 TODO this is used by changegroup code and it could probably be
571 653 folded into another API.
572 654 """)
573 655
574 656 def files():
575 657 """Obtain paths that are backing storage for this file.
576 658
577 659 TODO this is used heavily by verify code and there should probably
578 660 be a better API for that.
579 661 """
580 662
581 663 def checksize():
582 664 """Obtain the expected sizes of backing files.
583 665
584 666 TODO this is used by verify and it should not be part of the interface.
585 667 """
586 668
587 669 class completelocalrepository(zi.Interface):
588 670 """Monolithic interface for local repositories.
589 671
590 672 This currently captures the reality of things - not how things should be.
591 673 """
592 674
593 675 supportedformats = zi.Attribute(
594 676 """Set of requirements that apply to stream clone.
595 677
596 678 This is actually a class attribute and is shared among all instances.
597 679 """)
598 680
599 681 openerreqs = zi.Attribute(
600 682 """Set of requirements that are passed to the opener.
601 683
602 684 This is actually a class attribute and is shared among all instances.
603 685 """)
604 686
605 687 supported = zi.Attribute(
606 688 """Set of requirements that this repo is capable of opening.""")
607 689
608 690 requirements = zi.Attribute(
609 691 """Set of requirements this repo uses.""")
610 692
611 693 filtername = zi.Attribute(
612 694 """Name of the repoview that is active on this repo.""")
613 695
614 696 wvfs = zi.Attribute(
615 697 """VFS used to access the working directory.""")
616 698
617 699 vfs = zi.Attribute(
618 700 """VFS rooted at the .hg directory.
619 701
620 702 Used to access repository data not in the store.
621 703 """)
622 704
623 705 svfs = zi.Attribute(
624 706 """VFS rooted at the store.
625 707
626 708 Used to access repository data in the store. Typically .hg/store.
627 709 But can point elsewhere if the store is shared.
628 710 """)
629 711
630 712 root = zi.Attribute(
631 713 """Path to the root of the working directory.""")
632 714
633 715 path = zi.Attribute(
634 716 """Path to the .hg directory.""")
635 717
636 718 origroot = zi.Attribute(
637 719 """The filesystem path that was used to construct the repo.""")
638 720
639 721 auditor = zi.Attribute(
640 722 """A pathauditor for the working directory.
641 723
642 724 This checks if a path refers to a nested repository.
643 725
644 726 Operates on the filesystem.
645 727 """)
646 728
647 729 nofsauditor = zi.Attribute(
648 730 """A pathauditor for the working directory.
649 731
650 732 This is like ``auditor`` except it doesn't do filesystem checks.
651 733 """)
652 734
653 735 baseui = zi.Attribute(
654 736 """Original ui instance passed into constructor.""")
655 737
656 738 ui = zi.Attribute(
657 739 """Main ui instance for this instance.""")
658 740
659 741 sharedpath = zi.Attribute(
660 742 """Path to the .hg directory of the repo this repo was shared from.""")
661 743
662 744 store = zi.Attribute(
663 745 """A store instance.""")
664 746
665 747 spath = zi.Attribute(
666 748 """Path to the store.""")
667 749
668 750 sjoin = zi.Attribute(
669 751 """Alias to self.store.join.""")
670 752
671 753 cachevfs = zi.Attribute(
672 754 """A VFS used to access the cache directory.
673 755
674 756 Typically .hg/cache.
675 757 """)
676 758
677 759 filteredrevcache = zi.Attribute(
678 760 """Holds sets of revisions to be filtered.""")
679 761
680 762 names = zi.Attribute(
681 763 """A ``namespaces`` instance.""")
682 764
683 765 def close():
684 766 """Close the handle on this repository."""
685 767
686 768 def peer():
687 769 """Obtain an object conforming to the ``peer`` interface."""
688 770
689 771 def unfiltered():
690 772 """Obtain an unfiltered/raw view of this repo."""
691 773
692 774 def filtered(name, visibilityexceptions=None):
693 775 """Obtain a named view of this repository."""
694 776
695 777 obsstore = zi.Attribute(
696 778 """A store of obsolescence data.""")
697 779
698 780 changelog = zi.Attribute(
699 781 """A handle on the changelog revlog.""")
700 782
701 783 manifestlog = zi.Attribute(
702 784 """A handle on the root manifest revlog.""")
703 785
704 786 dirstate = zi.Attribute(
705 787 """Working directory state.""")
706 788
707 789 narrowpats = zi.Attribute(
708 790 """Matcher patterns for this repository's narrowspec.""")
709 791
710 792 def narrowmatch():
711 793 """Obtain a matcher for the narrowspec."""
712 794
713 795 def setnarrowpats(newincludes, newexcludes):
714 796 """Define the narrowspec for this repository."""
715 797
716 798 def __getitem__(changeid):
717 799 """Try to resolve a changectx."""
718 800
719 801 def __contains__(changeid):
720 802 """Whether a changeset exists."""
721 803
722 804 def __nonzero__():
723 805 """Always returns True."""
724 806 return True
725 807
726 808 __bool__ = __nonzero__
727 809
728 810 def __len__():
729 811 """Returns the number of changesets in the repo."""
730 812
731 813 def __iter__():
732 814 """Iterate over revisions in the changelog."""
733 815
734 816 def revs(expr, *args):
735 817 """Evaluate a revset.
736 818
737 819 Emits revisions.
738 820 """
739 821
740 822 def set(expr, *args):
741 823 """Evaluate a revset.
742 824
743 825 Emits changectx instances.
744 826 """
745 827
746 828 def anyrevs(specs, user=False, localalias=None):
747 829 """Find revisions matching one of the given revsets."""
748 830
749 831 def url():
750 832 """Returns a string representing the location of this repo."""
751 833
752 834 def hook(name, throw=False, **args):
753 835 """Call a hook."""
754 836
755 837 def tags():
756 838 """Return a mapping of tag to node."""
757 839
758 840 def tagtype(tagname):
759 841 """Return the type of a given tag."""
760 842
761 843 def tagslist():
762 844 """Return a list of tags ordered by revision."""
763 845
764 846 def nodetags(node):
765 847 """Return the tags associated with a node."""
766 848
767 849 def nodebookmarks(node):
768 850 """Return the list of bookmarks pointing to the specified node."""
769 851
770 852 def branchmap():
771 853 """Return a mapping of branch to heads in that branch."""
772 854
773 855 def revbranchcache():
774 856 pass
775 857
776 858 def branchtip(branchtip, ignoremissing=False):
777 859 """Return the tip node for a given branch."""
778 860
779 861 def lookup(key):
780 862 """Resolve the node for a revision."""
781 863
782 864 def lookupbranch(key):
783 865 """Look up the branch name of the given revision or branch name."""
784 866
785 867 def known(nodes):
786 868 """Determine whether a series of nodes is known.
787 869
788 870 Returns a list of bools.
789 871 """
790 872
791 873 def local():
792 874 """Whether the repository is local."""
793 875 return True
794 876
795 877 def publishing():
796 878 """Whether the repository is a publishing repository."""
797 879
798 880 def cancopy():
799 881 pass
800 882
801 883 def shared():
802 884 """The type of shared repository or None."""
803 885
804 886 def wjoin(f, *insidef):
805 887 """Calls self.vfs.reljoin(self.root, f, *insidef)"""
806 888
807 889 def file(f):
808 890 """Obtain a filelog for a tracked path."""
809 891
810 892 def setparents(p1, p2):
811 893 """Set the parent nodes of the working directory."""
812 894
813 895 def filectx(path, changeid=None, fileid=None):
814 896 """Obtain a filectx for the given file revision."""
815 897
816 898 def getcwd():
817 899 """Obtain the current working directory from the dirstate."""
818 900
819 901 def pathto(f, cwd=None):
820 902 """Obtain the relative path to a file."""
821 903
822 904 def adddatafilter(name, fltr):
823 905 pass
824 906
825 907 def wread(filename):
826 908 """Read a file from wvfs, using data filters."""
827 909
828 910 def wwrite(filename, data, flags, backgroundclose=False, **kwargs):
829 911 """Write data to a file in the wvfs, using data filters."""
830 912
831 913 def wwritedata(filename, data):
832 914 """Resolve data for writing to the wvfs, using data filters."""
833 915
834 916 def currenttransaction():
835 917 """Obtain the current transaction instance or None."""
836 918
837 919 def transaction(desc, report=None):
838 920 """Open a new transaction to write to the repository."""
839 921
840 922 def undofiles():
841 923 """Returns a list of (vfs, path) for files to undo transactions."""
842 924
843 925 def recover():
844 926 """Roll back an interrupted transaction."""
845 927
846 928 def rollback(dryrun=False, force=False):
847 929 """Undo the last transaction.
848 930
849 931 DANGEROUS.
850 932 """
851 933
852 934 def updatecaches(tr=None, full=False):
853 935 """Warm repo caches."""
854 936
855 937 def invalidatecaches():
856 938 """Invalidate cached data due to the repository mutating."""
857 939
858 940 def invalidatevolatilesets():
859 941 pass
860 942
861 943 def invalidatedirstate():
862 944 """Invalidate the dirstate."""
863 945
864 946 def invalidate(clearfilecache=False):
865 947 pass
866 948
867 949 def invalidateall():
868 950 pass
869 951
870 952 def lock(wait=True):
871 953 """Lock the repository store and return a lock instance."""
872 954
873 955 def wlock(wait=True):
874 956 """Lock the non-store parts of the repository."""
875 957
876 958 def currentwlock():
877 959 """Return the wlock if it's held or None."""
878 960
879 961 def checkcommitpatterns(wctx, vdirs, match, status, fail):
880 962 pass
881 963
882 964 def commit(text='', user=None, date=None, match=None, force=False,
883 965 editor=False, extra=None):
884 966 """Add a new revision to the repository."""
885 967
886 968 def commitctx(ctx, error=False):
887 969 """Commit a commitctx instance to the repository."""
888 970
889 971 def destroying():
890 972 """Inform the repository that nodes are about to be destroyed."""
891 973
892 974 def destroyed():
893 975 """Inform the repository that nodes have been destroyed."""
894 976
895 977 def status(node1='.', node2=None, match=None, ignored=False,
896 978 clean=False, unknown=False, listsubrepos=False):
897 979 """Convenience method to call repo[x].status()."""
898 980
899 981 def addpostdsstatus(ps):
900 982 pass
901 983
902 984 def postdsstatus():
903 985 pass
904 986
905 987 def clearpostdsstatus():
906 988 pass
907 989
908 990 def heads(start=None):
909 991 """Obtain list of nodes that are DAG heads."""
910 992
911 993 def branchheads(branch=None, start=None, closed=False):
912 994 pass
913 995
914 996 def branches(nodes):
915 997 pass
916 998
917 999 def between(pairs):
918 1000 pass
919 1001
920 1002 def checkpush(pushop):
921 1003 pass
922 1004
923 1005 prepushoutgoinghooks = zi.Attribute(
924 1006 """util.hooks instance.""")
925 1007
926 1008 def pushkey(namespace, key, old, new):
927 1009 pass
928 1010
929 1011 def listkeys(namespace):
930 1012 pass
931 1013
932 1014 def debugwireargs(one, two, three=None, four=None, five=None):
933 1015 pass
934 1016
935 1017 def savecommitmessage(text):
936 1018 pass
General Comments 0
You need to be logged in to leave comments. Login now