comparison mercurial/changegroup.py @ 38883:ee1ea96cf9c9

changegroup: move ellipsisdata() from narrow This is a pretty straightforward copy of the function. Differential Revision: https://phab.mercurial-scm.org/D4060
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 28 Jul 2018 17:52:21 -0700
parents a232e6744ba3
children a2f521773761
comparison
equal deleted inserted replaced
38882:ff42ec7845e4 38883:ee1ea96cf9c9
12 import weakref 12 import weakref
13 13
14 from .i18n import _ 14 from .i18n import _
15 from .node import ( 15 from .node import (
16 hex, 16 hex,
17 nullid,
17 nullrev, 18 nullrev,
18 short, 19 short,
19 ) 20 )
20 21
21 from . import ( 22 from . import (
25 match as matchmod, 26 match as matchmod,
26 mdiff, 27 mdiff,
27 phases, 28 phases,
28 pycompat, 29 pycompat,
29 repository, 30 repository,
31 revlog,
30 util, 32 util,
31 ) 33 )
32 34
33 from .utils import ( 35 from .utils import (
34 stringutil, 36 stringutil,
489 d, self._h = self._h[:n], self._h[n:] 491 d, self._h = self._h[:n], self._h[n:]
490 if len(d) < n: 492 if len(d) < n:
491 d += readexactly(self._fh, n - len(d)) 493 d += readexactly(self._fh, n - len(d))
492 return d 494 return d
493 return readexactly(self._fh, n) 495 return readexactly(self._fh, n)
496
497 def ellipsisdata(packer, rev, revlog_, p1, p2, data, linknode):
498 n = revlog_.node(rev)
499 p1n, p2n = revlog_.node(p1), revlog_.node(p2)
500 flags = revlog_.flags(rev)
501 flags |= revlog.REVIDX_ELLIPSIS
502 meta = packer.builddeltaheader(
503 n, p1n, p2n, nullid, linknode, flags)
504 # TODO: try and actually send deltas for ellipsis data blocks
505 diffheader = mdiff.trivialdiffheader(len(data))
506 l = len(meta) + len(diffheader) + len(data)
507 return ''.join((chunkheader(l),
508 meta,
509 diffheader,
510 data))
494 511
495 class cg1packer(object): 512 class cg1packer(object):
496 deltaheader = _CHANGEGROUPV1_DELTA_HEADER 513 deltaheader = _CHANGEGROUPV1_DELTA_HEADER
497 version = '01' 514 version = '01'
498 def __init__(self, repo, filematcher, bundlecaps=None): 515 def __init__(self, repo, filematcher, bundlecaps=None):