mercurial/utils/storageutil.py
changeset 40010 f5d819d84461
parent 40009 631c6f5058b9
child 40321 6994a8be3663
equal deleted inserted replaced
40009:631c6f5058b9 40010:f5d819d84461
    15     bin,
    15     bin,
    16     nullid,
    16     nullid,
    17     nullrev,
    17     nullrev,
    18 )
    18 )
    19 from .. import (
    19 from .. import (
       
    20     dagop,
    20     error,
    21     error,
    21     mdiff,
    22     mdiff,
    22     pycompat,
    23     pycompat,
    23 )
    24 )
    24 
    25 
   262                 if plinkrev >= minlinkrev:
   263                 if plinkrev >= minlinkrev:
   263                     futurelargelinkrevs.add(plinkrev)
   264                     futurelargelinkrevs.add(plinkrev)
   264 
   265 
   265     return strippoint, brokenrevs
   266     return strippoint, brokenrevs
   266 
   267 
   267 def emitrevisions(store, revs, resultcls, deltaparentfn=None, candeltafn=None,
   268 def emitrevisions(store, nodes, nodesorder, resultcls, deltaparentfn=None,
   268                   rawsizefn=None, revdifffn=None, flagsfn=None,
   269                   candeltafn=None, rawsizefn=None, revdifffn=None, flagsfn=None,
   269                   sendfulltext=False,
   270                   sendfulltext=False,
   270                   revisiondata=False, assumehaveparentrevisions=False,
   271                   revisiondata=False, assumehaveparentrevisions=False,
   271                   deltaprevious=False):
   272                   deltaprevious=False):
   272     """Generic implementation of ifiledata.emitrevisions().
   273     """Generic implementation of ifiledata.emitrevisions().
   273 
   274 
   275     encapsulate all the logic for doing so in a backend-agnostic way.
   276     encapsulate all the logic for doing so in a backend-agnostic way.
   276 
   277 
   277     ``store``
   278     ``store``
   278        Object conforming to ``ifilestorage`` interface.
   279        Object conforming to ``ifilestorage`` interface.
   279 
   280 
   280     ``revs``
   281     ``nodes``
   281        List of integer revision numbers whose data to emit.
   282        List of revision nodes whose data to emit.
   282 
   283 
   283     ``resultcls``
   284     ``resultcls``
   284        A type implementing the ``irevisiondelta`` interface that will be
   285        A type implementing the ``irevisiondelta`` interface that will be
   285        constructed and returned.
   286        constructed and returned.
   286 
   287 
   320        value for it. If not defined, flags value will be 0.
   321        value for it. If not defined, flags value will be 0.
   321 
   322 
   322     ``sendfulltext``
   323     ``sendfulltext``
   323        Whether to send fulltext revisions instead of deltas, if allowed.
   324        Whether to send fulltext revisions instead of deltas, if allowed.
   324 
   325 
       
   326     ``nodesorder``
   325     ``revisiondata``
   327     ``revisiondata``
   326     ``assumehaveparentrevisions``
   328     ``assumehaveparentrevisions``
   327     ``deltaprevious``
   329     ``deltaprevious``
   328        See ``ifiledata.emitrevisions()`` interface documentation.
   330        See ``ifiledata.emitrevisions()`` interface documentation.
   329     """
   331     """
   330 
   332 
   331     fnode = store.node
   333     fnode = store.node
       
   334     frev = store.rev
       
   335 
       
   336     if nodesorder == 'nodes':
       
   337         revs = [frev(n) for n in nodes]
       
   338     elif nodesorder == 'storage':
       
   339         revs = sorted(frev(n) for n in nodes)
       
   340     else:
       
   341         revs = set(frev(n) for n in nodes)
       
   342         revs = dagop.linearize(revs, store.parentrevs)
   332 
   343 
   333     prevrev = None
   344     prevrev = None
   334 
   345 
   335     if deltaprevious or assumehaveparentrevisions:
   346     if deltaprevious or assumehaveparentrevisions:
   336         prevrev = store.parentrevs(revs[0])[0]
   347         prevrev = store.parentrevs(revs[0])[0]