changeset 38556:0db41eb0a3ac

manifest: define and implement addgroup() on manifestlog Changegroup code was bypassing our manifest interface and calling a method on the private revlog attribute. This commit formalizes the interface for adding a group of revisions from deltas and changes the changegroup code to use it. This enables alternate manifest storage to work with changegroup application operations (like `hg unbundle` and `hg pull`). Differential Revision: https://phab.mercurial-scm.org/D3883
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 01 Jul 2018 14:25:44 -0700
parents f2f9bacf0587
children ad812004c94f
files mercurial/changegroup.py mercurial/manifest.py mercurial/repository.py
diffstat 3 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Wed Jul 04 12:12:49 2018 -0700
+++ b/mercurial/changegroup.py	Sun Jul 01 14:25:44 2018 -0700
@@ -245,7 +245,7 @@
         # be empty during the pull
         self.manifestheader()
         deltas = self.deltaiter()
-        repo.manifestlog._revlog.addgroup(deltas, revmap, trp)
+        repo.manifestlog.addgroup(deltas, revmap, trp)
         prog.complete()
         self.callback = None
 
--- a/mercurial/manifest.py	Wed Jul 04 12:12:49 2018 -0700
+++ b/mercurial/manifest.py	Sun Jul 01 14:25:44 2018 -0700
@@ -1351,6 +1351,9 @@
     def rev(self, node):
         return self._revlog.rev(node)
 
+    def addgroup(self, deltas, linkmapper, transaction):
+        return self._revlog.addgroup(deltas, linkmapper, transaction)
+
 @interfaceutil.implementer(repository.imanifestrevisionwritable)
 class memmanifestctx(object):
     def __init__(self, manifestlog):
--- a/mercurial/repository.py	Wed Jul 04 12:12:49 2018 -0700
+++ b/mercurial/repository.py	Sun Jul 01 14:25:44 2018 -0700
@@ -928,6 +928,22 @@
         Raises ``error.LookupError`` if the node is not known.
         """
 
+    def addgroup(deltas, linkmapper, transaction):
+        """Process a series of deltas for storage.
+
+        ``deltas`` is an iterable of 7-tuples of
+        (node, p1, p2, linknode, deltabase, delta, flags) defining revisions
+        to add.
+
+        The ``delta`` field contains ``mpatch`` data to apply to a base
+        revision, identified by ``deltabase``. The base node can be
+        ``nullid``, in which case the header from the delta can be ignored
+        and the delta used as the fulltext.
+
+        Returns a list of nodes that were processed. A node will be in the list
+        even if it existed in the store previously.
+        """
+
 class completelocalrepository(interfaceutil.Interface):
     """Monolithic interface for local repositories.