changeset 40010:f5d819d84461

storageutil: pass nodes into emitrevisions() The main emitrevisions() uses nodes. So it makes sense to use nodes for the helper API. Not bothering with API since this function was introduced a few commits ago. Differential Revision: https://phab.mercurial-scm.org/D4805
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 28 Sep 2018 16:34:53 -0700
parents 631c6f5058b9
children e66a3ae8211a
files mercurial/revlog.py mercurial/utils/storageutil.py
diffstat 2 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Sep 28 16:16:09 2018 -0700
+++ b/mercurial/revlog.py	Fri Sep 28 16:34:53 2018 -0700
@@ -2192,19 +2192,8 @@
         if nodesorder is None and not self._generaldelta:
             nodesorder = 'storage'
 
-        frev = self.rev
-
-        if nodesorder == 'nodes':
-            revs = [frev(n) for n in nodes]
-        elif nodesorder == 'storage':
-            revs = sorted(frev(n) for n in nodes)
-        else:
-            assert self._generaldelta
-            revs = set(frev(n) for n in nodes)
-            revs = dagop.linearize(revs, self.parentrevs)
-
         return storageutil.emitrevisions(
-            self, revs, revlogrevisiondelta,
+            self, nodes, nodesorder, revlogrevisiondelta,
             deltaparentfn=self.deltaparent,
             candeltafn=self.candelta,
             rawsizefn=self.rawsize,
--- a/mercurial/utils/storageutil.py	Fri Sep 28 16:16:09 2018 -0700
+++ b/mercurial/utils/storageutil.py	Fri Sep 28 16:34:53 2018 -0700
@@ -17,6 +17,7 @@
     nullrev,
 )
 from .. import (
+    dagop,
     error,
     mdiff,
     pycompat,
@@ -264,8 +265,8 @@
 
     return strippoint, brokenrevs
 
-def emitrevisions(store, revs, resultcls, deltaparentfn=None, candeltafn=None,
-                  rawsizefn=None, revdifffn=None, flagsfn=None,
+def emitrevisions(store, nodes, nodesorder, resultcls, deltaparentfn=None,
+                  candeltafn=None, rawsizefn=None, revdifffn=None, flagsfn=None,
                   sendfulltext=False,
                   revisiondata=False, assumehaveparentrevisions=False,
                   deltaprevious=False):
@@ -277,8 +278,8 @@
     ``store``
        Object conforming to ``ifilestorage`` interface.
 
-    ``revs``
-       List of integer revision numbers whose data to emit.
+    ``nodes``
+       List of revision nodes whose data to emit.
 
     ``resultcls``
        A type implementing the ``irevisiondelta`` interface that will be
@@ -322,6 +323,7 @@
     ``sendfulltext``
        Whether to send fulltext revisions instead of deltas, if allowed.
 
+    ``nodesorder``
     ``revisiondata``
     ``assumehaveparentrevisions``
     ``deltaprevious``
@@ -329,6 +331,15 @@
     """
 
     fnode = store.node
+    frev = store.rev
+
+    if nodesorder == 'nodes':
+        revs = [frev(n) for n in nodes]
+    elif nodesorder == 'storage':
+        revs = sorted(frev(n) for n in nodes)
+    else:
+        revs = set(frev(n) for n in nodes)
+        revs = dagop.linearize(revs, store.parentrevs)
 
     prevrev = None