# HG changeset patch # User Mads Kiilerich # Date 2018-05-11 14:26:48 # Node ID 5e7bdf4fb156cfc456599a660ac14b1ab29a7da0 # Parent 6fd0e1193f25cf7caf2f3d8c96562450e2b80f44 hg: refactor annotation to generate a list of normalized annotation lines before iterating This makes it easier to add support for future annotion structures. Temporarily add redundant conditional to preserve formatting and reduce churn. diff --git a/kallithea/lib/vcs/backends/hg/changeset.py b/kallithea/lib/vcs/backends/hg/changeset.py --- a/kallithea/lib/vcs/backends/hg/changeset.py +++ b/kallithea/lib/vcs/backends/hg/changeset.py @@ -296,13 +296,13 @@ class MercurialChangeset(BaseChangeset): Returns a generator of four element tuples with lineno, sha, changeset lazy loader and line """ - annotations = self._get_filectx(path).annotate(linenumber=False) - for i, (aline, l) in enumerate(annotations): + if True: try: - fctx = aline.fctx + annotation_lines = [(aline.fctx, l) for aline, l in annotations] except AttributeError: # aline.fctx was introduced in Mercurial 4.4 - fctx = aline[0] + annotation_lines = [(aline[0], l) for aline, l in annotations] + for i, (fctx, l) in enumerate(annotation_lines): sha = fctx.hex() yield (i + 1, sha, lambda sha=sha, l=l: self.repository.get_changeset(sha), l)