Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 34160:c8b6ed51386b
changegroup: remove changegroup dependency from revlog.addgroup
Previously revlog.addgroup would accept a changegroup and a linkmapper and use
it to iterate of the deltas. As part of untangling the revlog-changegroup
interdependency, let's move the changegroup delta iteration logic to it's own
function and pass the simple iterator to the revlog instead.
This will make it easier to introduce non-revlogs stores in the future, without
reinventing any changegroup specific logic.
Differential Revision: https://phab.mercurial-scm.org/D688
author | Durham Goode <durham@fb.com> |
---|---|
date | Wed, 13 Sep 2017 10:43:44 -0700 |
parents | b96cfc309ac5 |
children | 448725a2ef73 |
line wrap: on
line diff
--- a/mercurial/revlog.py Wed Sep 13 10:43:16 2017 -0700 +++ b/mercurial/revlog.py Wed Sep 13 10:43:44 2017 -0700 @@ -1872,7 +1872,7 @@ ifh.write(data[1]) self.checkinlinesize(transaction, ifh) - def addgroup(self, cg, linkmapper, transaction, addrevisioncb=None): + def addgroup(self, deltas, transaction, addrevisioncb=None): """ add a delta group @@ -1905,20 +1905,12 @@ ifh.flush() try: # loop through our set of deltas - chain = None - for chunkdata in iter(lambda: cg.deltachunk(chain), {}): - node = chunkdata['node'] - p1 = chunkdata['p1'] - p2 = chunkdata['p2'] - cs = chunkdata['cs'] - deltabase = chunkdata['deltabase'] - delta = chunkdata['delta'] - flags = chunkdata['flags'] or REVIDX_DEFAULT_FLAGS + for data in deltas: + node, p1, p2, link, deltabase, delta, flags = data + flags = flags or REVIDX_DEFAULT_FLAGS nodes.append(node) - chain = node - link = linkmapper(cs) if node in self.nodemap: # this can happen if two branches make the same change continue