Mercurial > hg-stable
changeset 46725:e8c11a2c96c0
delta: add sidedata field to revision delta
When emitting revision delta, we need to also emit the sidedata information just
added in the revlogv2 format if appropriate.
Differential Revision: https://phab.mercurial-scm.org/D10027
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Thu, 18 Feb 2021 18:18:35 +0100 |
parents | a41565bef69f |
children | bc2519513ae0 |
files | hgext/sqlitestore.py mercurial/changegroup.py mercurial/interfaces/repository.py mercurial/revlog.py mercurial/testing/storage.py mercurial/utils/storageutil.py |
diffstat | 6 files changed, 26 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/sqlitestore.py Thu Feb 18 17:36:52 2021 +0100 +++ b/hgext/sqlitestore.py Thu Feb 18 18:18:35 2021 +0100 @@ -288,6 +288,7 @@ baserevisionsize = attr.ib() revision = attr.ib() delta = attr.ib() + sidedata = attr.ib() linknode = attr.ib(default=None) @@ -908,6 +909,10 @@ def files(self): return [] + def sidedata(self, nodeorrev, _df=None): + # Not supported for now + return {} + def storageinfo( self, exclusivefiles=False,
--- a/mercurial/changegroup.py Thu Feb 18 17:36:52 2021 +0100 +++ b/mercurial/changegroup.py Thu Feb 18 18:18:35 2021 +0100 @@ -618,6 +618,13 @@ yield prefix yield data + sidedata = delta.sidedata + if sidedata is not None: + # Need a separate chunk for sidedata to be able to differentiate + # "raw delta" length and sidedata length + yield chunkheader(len(sidedata)) + yield sidedata + def _sortnodesellipsis(store, nodes, cl, lookup): """Sort nodes for changegroup generation."""
--- a/mercurial/interfaces/repository.py Thu Feb 18 17:36:52 2021 +0100 +++ b/mercurial/interfaces/repository.py Thu Feb 18 18:18:35 2021 +0100 @@ -453,6 +453,10 @@ """ ) + sidedata = interfaceutil.Attribute( + """Raw sidedata bytes for the given revision.""" + ) + class ifilerevisionssequence(interfaceutil.Interface): """Contains index data for all revisions of a file.
--- a/mercurial/revlog.py Thu Feb 18 17:36:52 2021 +0100 +++ b/mercurial/revlog.py Thu Feb 18 18:18:35 2021 +0100 @@ -204,6 +204,7 @@ baserevisionsize = attr.ib() revision = attr.ib() delta = attr.ib() + sidedata = attr.ib() linknode = attr.ib(default=None) @@ -2587,6 +2588,7 @@ dfh, alwayscache=alwayscache, deltacomputer=deltacomputer, + sidedata=sidedata, ) if addrevisioncb:
--- a/mercurial/testing/storage.py Thu Feb 18 17:36:52 2021 +0100 +++ b/mercurial/testing/storage.py Thu Feb 18 18:18:35 2021 +0100 @@ -1158,7 +1158,7 @@ f = self._makefilefn() deltas = [ - (node0, nullid, nullid, nullid, nullid, delta0, 0), + (node0, nullid, nullid, nullid, nullid, delta0, 0, {}), ] with self._maketransactionfn() as tr: @@ -1214,7 +1214,9 @@ for i, fulltext in enumerate(fulltexts): delta = mdiff.trivialdiffheader(len(fulltext)) + fulltext - deltas.append((nodes[i], nullid, nullid, nullid, nullid, delta, 0)) + deltas.append( + (nodes[i], nullid, nullid, nullid, nullid, delta, 0, {}) + ) with self._maketransactionfn() as tr: newnodes = [] @@ -1262,7 +1264,9 @@ ) delta = mdiff.textdiff(b'bar\n' * 30, (b'bar\n' * 30) + b'baz\n') - deltas = [(b'\xcc' * 20, node1, nullid, b'\x01' * 20, node1, delta, 0)] + deltas = [ + (b'\xcc' * 20, node1, nullid, b'\x01' * 20, node1, delta, 0, {}) + ] with self._maketransactionfn() as tr: with self.assertRaises(error.CensoredBaseError):