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