changeset 7270:bc5e635afef7

hg: support annotate refactoring in Mercurial 4.6 for returning annotateline objeccts Attempts at using annotateline.fctx will fail with AttributeError if we didn't get an annotateline but an old tuple.
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 11 May 2018 14:26:48 +0200
parents cc389e91a20a
children 03dfcbe52906
files kallithea/lib/vcs/backends/hg/changeset.py
diffstat 1 files changed, 3 insertions(+), 1 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
@@ -297,7 +297,9 @@
             lineno, sha, changeset lazy loader and line
         """
         annotations = self._get_filectx(path).annotate()
-        if True:
+        try:
+            annotation_lines = [(annotateline.fctx, annotateline.text) for annotateline in annotations]
+        except AttributeError: # annotateline was introduced in Mercurial 4.6 (b33b91ca2ec2)
             try:
                 annotation_lines = [(aline.fctx, l) for aline, l in annotations]
             except AttributeError: # aline.fctx was introduced in Mercurial 4.4