Mercurial > hg
comparison mercurial/repository.py @ 39231:b41d023a412a
repository: establish API for emitting revision deltas
With our revision delta and revision delta request interfaces
defined, it is now time to define a method on storage interfaces
for using them.
So far, the only storage interface that is well-defined and used
is file storage. So that is the only interface we need to add a
method on.
We define an ``emitrevisiondeltas()`` method that takes an
iterable of ``irevisiondeltarequest``s and turns them into
``irevisiondelta`` instances.
changegroup._handlerevisiondeltarequest() and the looping logic
from changegroup.deltagroup() has effectively been moved to
revlog.emitrevisiondeltas().
Our filelog wrapper class proxies its emitrevisiondeltas() to
the internal revlog instance.
The simple store test extension used to verify sanity of storage
abstractions has also implemented emitrevisiondeltas() for
file storage and the test harness when run with this extension doesn't
seem to exhibit any regressions.
Rather than create a shared type to represent revision deltas,
each storage backend has its own type and the class name identifies
where the revision delta was derived from.
Differential Revision: https://phab.mercurial-scm.org/D4226
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 09 Aug 2018 16:02:14 -0700 |
parents | b518d495a560 |
children | 0a5b20c107a6 |
comparison
equal
deleted
inserted
replaced
39230:b518d495a560 | 39231:b41d023a412a |
---|---|
619 | 619 |
620 The returned data is the result of ``bdiff.bdiff`` on the raw | 620 The returned data is the result of ``bdiff.bdiff`` on the raw |
621 revision data. | 621 revision data. |
622 """ | 622 """ |
623 | 623 |
624 def emitrevisiondeltas(requests): | |
625 """Produce ``irevisiondelta`` from ``irevisiondeltarequest``s. | |
626 | |
627 Given an iterable of objects conforming to the ``irevisiondeltarequest`` | |
628 interface, emits objects conforming to the ``irevisiondelta`` | |
629 interface. | |
630 | |
631 This method is a generator. | |
632 | |
633 ``irevisiondelta`` should be emitted in the same order of | |
634 ``irevisiondeltarequest`` that was passed in. | |
635 | |
636 The emitted objects MUST conform by the results of | |
637 ``irevisiondeltarequest``. Namely, they must respect any requests | |
638 for building a delta from a specific ``basenode`` if defined. | |
639 | |
640 When sending deltas, implementations must take into account whether | |
641 the client has the base delta before encoding a delta against that | |
642 revision. A revision encountered previously in ``requests`` is | |
643 always a suitable base revision. An example of a bad delta is a delta | |
644 against a non-ancestor revision. Another example of a bad delta is a | |
645 delta against a censored revision. | |
646 """ | |
647 | |
624 class ifilemutation(interfaceutil.Interface): | 648 class ifilemutation(interfaceutil.Interface): |
625 """Storage interface for mutation events of a tracked file.""" | 649 """Storage interface for mutation events of a tracked file.""" |
626 | 650 |
627 def add(filedata, meta, transaction, linkrev, p1, p2): | 651 def add(filedata, meta, transaction, linkrev, p1, p2): |
628 """Add a new revision to the store. | 652 """Add a new revision to the store. |