# HG changeset patch # User Durham Goode # Date 2017-09-13 17:43:16 # Node ID b96cfc309ac526dbaee6e9066dc52cd2b9e51dc0 # Parent 9e4f82bc2b0b2bf14dda60a2d714b34fcd8b3395 revlog: refactor chain variable Previously the addgroup loop would set chain to be the result of self._addrevision(node,...). Since _addrevision now always returns the passed in node, we can drop that behavior and just always set chain = node in the loop. This will be useful in a future patch where we refactor the cg.deltachunk logic to another function and therefore chain disappears entirely from this function. Differential Revision: https://phab.mercurial-scm.org/D699 diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1916,11 +1916,11 @@ class revlog(object): flags = chunkdata['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 - chain = node continue for p in (p1, p2): @@ -1954,13 +1954,13 @@ class revlog(object): # We're only using addgroup() in the context of changegroup # generation so the revision data can always be handled as raw # by the flagprocessor. - chain = self._addrevision(node, None, transaction, link, - p1, p2, flags, (baserev, delta), - ifh, dfh, - alwayscache=bool(addrevisioncb)) + self._addrevision(node, None, transaction, link, + p1, p2, flags, (baserev, delta), + ifh, dfh, + alwayscache=bool(addrevisioncb)) if addrevisioncb: - addrevisioncb(self, chain) + addrevisioncb(self, node) if not dfh and not self._inline: # addrevision switched from inline to conventional