changeset 7268:5e7bdf4fb156

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.
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 11 May 2018 14:26:48 +0200
parents 6fd0e1193f25
children cc389e91a20a
files kallithea/lib/vcs/backends/hg/changeset.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/changeset.py	Fri May 11 14:26:48 2018 +0200
+++ b/kallithea/lib/vcs/backends/hg/changeset.py	Fri May 11 14:26:48 2018 +0200
@@ -296,13 +296,13 @@
         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)