# HG changeset patch # User Mads Kiilerich # Date 2018-05-11 14:26:48 # Node ID bc5e635afef78a7790104cf8e8bced5e3871bf59 # Parent cc389e91a20a5e764cb354dd7d980c978e1d9e0a 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. 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 @@ -297,7 +297,9 @@ class MercurialChangeset(BaseChangeset): 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