652 always a suitable base revision. An example of a bad delta is a delta |
652 always a suitable base revision. An example of a bad delta is a delta |
653 against a non-ancestor revision. Another example of a bad delta is a |
653 against a non-ancestor revision. Another example of a bad delta is a |
654 delta against a censored revision. |
654 delta against a censored revision. |
655 """ |
655 """ |
656 |
656 |
|
657 def emitrevisions(nodes, |
|
658 nodesorder=None, |
|
659 revisiondata=False, |
|
660 assumehaveparentrevisions=False, |
|
661 deltaprevious=False): |
|
662 """Produce ``irevisiondelta`` for revisions. |
|
663 |
|
664 Given an iterable of nodes, emits objects conforming to the |
|
665 ``irevisiondelta`` interface that describe revisions in storage. |
|
666 |
|
667 This method is a generator. |
|
668 |
|
669 The input nodes may be unordered. Implementations must ensure that a |
|
670 node's parents are emitted before the node itself. Transitively, this |
|
671 means that a node may only be emitted once all its ancestors in |
|
672 ``nodes`` have also been emitted. |
|
673 |
|
674 By default, emits "index" data (the ``node``, ``p1node``, and |
|
675 ``p2node`` attributes). If ``revisiondata`` is set, revision data |
|
676 will also be present on the emitted objects. |
|
677 |
|
678 With default argument values, implementations can choose to emit |
|
679 either fulltext revision data or a delta. When emitting deltas, |
|
680 implementations must consider whether the delta's base revision |
|
681 fulltext is available to the receiver. |
|
682 |
|
683 The base revision fulltext is guaranteed to be available if any of |
|
684 the following are met: |
|
685 |
|
686 * Its fulltext revision was emitted by this method call. |
|
687 * A delta for that revision was emitted by this method call. |
|
688 * ``assumehaveparentrevisions`` is True and the base revision is a |
|
689 parent of the node. |
|
690 |
|
691 ``nodesorder`` can be used to control the order that revisions are |
|
692 emitted. By default, revisions can be reordered as long as they are |
|
693 in DAG topological order (see above). If the value is ``nodes``, |
|
694 the iteration order from ``nodes`` should be used. If the value is |
|
695 ``storage``, then the native order from the backing storage layer |
|
696 is used. (Not all storage layers will have strong ordering and behavior |
|
697 of this mode is storage-dependent.) ``nodes`` ordering can force |
|
698 revisions to be emitted before their ancestors, so consumers should |
|
699 use it with care. |
|
700 |
|
701 The ``linknode`` attribute on the returned ``irevisiondelta`` may not |
|
702 be set and it is the caller's responsibility to resolve it, if needed. |
|
703 |
|
704 If ``deltaprevious`` is True and revision data is requested, all |
|
705 revision data should be emitted as deltas against the revision |
|
706 emitted just prior. The initial revision should be a delta against |
|
707 its 1st parent. |
|
708 """ |
|
709 |
657 class ifilemutation(interfaceutil.Interface): |
710 class ifilemutation(interfaceutil.Interface): |
658 """Storage interface for mutation events of a tracked file.""" |
711 """Storage interface for mutation events of a tracked file.""" |
659 |
712 |
660 def add(filedata, meta, transaction, linkrev, p1, p2): |
713 def add(filedata, meta, transaction, linkrev, p1, p2): |
661 """Add a new revision to the store. |
714 """Add a new revision to the store. |
1121 Returns True if the fulltext is different from what is stored. |
1174 Returns True if the fulltext is different from what is stored. |
1122 """ |
1175 """ |
1123 |
1176 |
1124 def emitrevisiondeltas(requests): |
1177 def emitrevisiondeltas(requests): |
1125 """Produce ``irevisiondelta`` from ``irevisiondeltarequest``s. |
1178 """Produce ``irevisiondelta`` from ``irevisiondeltarequest``s. |
|
1179 |
|
1180 See the documentation for ``ifiledata`` for more. |
|
1181 """ |
|
1182 |
|
1183 def emitrevisions(nodes, |
|
1184 nodesorder=None, |
|
1185 revisiondata=False, |
|
1186 assumehaveparentrevisions=False): |
|
1187 """Produce ``irevisiondelta`` describing revisions. |
1126 |
1188 |
1127 See the documentation for ``ifiledata`` for more. |
1189 See the documentation for ``ifiledata`` for more. |
1128 """ |
1190 """ |
1129 |
1191 |
1130 def addgroup(deltas, linkmapper, transaction, addrevisioncb=None): |
1192 def addgroup(deltas, linkmapper, transaction, addrevisioncb=None): |