changeset 40430:6a917075535a

storage: also use `deltamode argument` for ifiledata Now that lower level uses such argument, we can propagate the change to higher layers.
author Boris Feld <boris.feld@octobus.net>
date Tue, 09 Oct 2018 23:26:35 +0200
parents 59a870a4ad6e
children 968dd7e02ac5
files mercurial/changegroup.py mercurial/filelog.py mercurial/manifest.py mercurial/repository.py mercurial/revlog.py mercurial/testing/storage.py
diffstat 6 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Tue Oct 09 22:02:01 2018 +0200
+++ b/mercurial/changegroup.py	Tue Oct 09 23:26:35 2018 +0200
@@ -697,12 +697,16 @@
         progress = repo.ui.makeprogress(topic, unit=_('chunks'),
                                         total=len(nodes))
 
+    deltamode = repository.CG_DELTAMODE_STD
+    if forcedeltaparentprev:
+        deltamode = repository.CG_DELTAMODE_PREV
+
     revisions = store.emitrevisions(
         nodes,
         nodesorder=nodesorder,
         revisiondata=True,
         assumehaveparentrevisions=not ellipses,
-        deltaprevious=forcedeltaparentprev)
+        deltamode=deltamode)
 
     for i, revision in enumerate(revisions):
         if progress:
--- a/mercurial/filelog.py	Tue Oct 09 22:02:01 2018 +0200
+++ b/mercurial/filelog.py	Tue Oct 09 23:26:35 2018 +0200
@@ -92,11 +92,11 @@
 
     def emitrevisions(self, nodes, nodesorder=None,
                       revisiondata=False, assumehaveparentrevisions=False,
-                      deltaprevious=False):
+                      deltamode=repository.CG_DELTAMODE_STD):
         return self._revlog.emitrevisions(
             nodes, nodesorder=nodesorder, revisiondata=revisiondata,
             assumehaveparentrevisions=assumehaveparentrevisions,
-            deltaprevious=deltaprevious)
+            deltamode=deltamode)
 
     def addrevision(self, revisiondata, transaction, linkrev, p1, p2,
                     node=None, flags=revlog.REVIDX_DEFAULT_FLAGS,
--- a/mercurial/manifest.py	Tue Oct 09 22:02:01 2018 +0200
+++ b/mercurial/manifest.py	Tue Oct 09 23:26:35 2018 +0200
@@ -1575,11 +1575,11 @@
 
     def emitrevisions(self, nodes, nodesorder=None,
                       revisiondata=False, assumehaveparentrevisions=False,
-                      deltaprevious=False):
+                      deltamode=repository.CG_DELTAMODE_STD):
         return self._revlog.emitrevisions(
             nodes, nodesorder=nodesorder, revisiondata=revisiondata,
             assumehaveparentrevisions=assumehaveparentrevisions,
-            deltaprevious=deltaprevious)
+            deltamode=deltamode)
 
     def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None):
         return self._revlog.addgroup(deltas, linkmapper, transaction,
--- a/mercurial/repository.py	Tue Oct 09 22:02:01 2018 +0200
+++ b/mercurial/repository.py	Tue Oct 09 23:26:35 2018 +0200
@@ -618,7 +618,7 @@
                       nodesorder=None,
                       revisiondata=False,
                       assumehaveparentrevisions=False,
-                      deltaprevious=False):
+                      deltamode=CG_DELTAMODE_STD):
         """Produce ``irevisiondelta`` for revisions.
 
         Given an iterable of nodes, emits objects conforming to the
@@ -661,10 +661,10 @@
         The ``linknode`` attribute on the returned ``irevisiondelta`` may not
         be set and it is the caller's responsibility to resolve it, if needed.
 
-        If ``deltaprevious`` is True and revision data is requested, all
-        revision data should be emitted as deltas against the revision
-        emitted just prior. The initial revision should be a delta against
-        its 1st parent.
+        If ``deltamode`` is CG_DELTAMODE_PREV and revision data is requested,
+        all revision data should be emitted as deltas against the revision
+        emitted just prior. The initial revision should be a delta against its
+        1st parent.
         """
 
 class ifilemutation(interfaceutil.Interface):
--- a/mercurial/revlog.py	Tue Oct 09 22:02:01 2018 +0200
+++ b/mercurial/revlog.py	Tue Oct 09 23:26:35 2018 +0200
@@ -2205,7 +2205,8 @@
         return res
 
     def emitrevisions(self, nodes, nodesorder=None, revisiondata=False,
-                      assumehaveparentrevisions=False, deltaprevious=False):
+                      assumehaveparentrevisions=False,
+                      deltamode=repository.CG_DELTAMODE_STD):
         if nodesorder not in ('nodes', 'storage', None):
             raise error.ProgrammingError('unhandled value for nodesorder: %s' %
                                          nodesorder)
@@ -2213,10 +2214,8 @@
         if nodesorder is None and not self._generaldelta:
             nodesorder = 'storage'
 
-        deltamode = repository.CG_DELTAMODE_STD
-        if deltaprevious:
-            deltamode = repository.CG_DELTAMODE_PREV
-        elif not self._storedeltachains:
+        if (not self._storedeltachains and
+                deltamode != repository.CG_DELTAMODE_PREV):
             deltamode = repository.CG_DELTAMODE_FULL
 
         return storageutil.emitrevisions(
--- a/mercurial/testing/storage.py	Tue Oct 09 22:02:01 2018 +0200
+++ b/mercurial/testing/storage.py	Tue Oct 09 23:26:35 2018 +0200
@@ -741,7 +741,8 @@
 
         # forceprevious=True forces a delta against the previous revision.
         # Special case for initial revision.
-        gen = f.emitrevisions([node0], revisiondata=True, deltaprevious=True)
+        gen = f.emitrevisions([node0], revisiondata=True,
+                              deltamode=repository.CG_DELTAMODE_PREV)
 
         rev = next(gen)
         self.assertEqual(rev.node, node0)
@@ -758,7 +759,7 @@
             next(gen)
 
         gen = f.emitrevisions([node0, node2], revisiondata=True,
-                              deltaprevious=True)
+                              deltamode=repository.CG_DELTAMODE_PREV)
 
         rev = next(gen)
         self.assertEqual(rev.node, node0)