changeset 7267:6fd0e1193f25

hg: trivial refactorings of annotate functionality Prepare for changes coming up.
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 11 May 2018 14:26:48 +0200
parents b3ef9012be54
children 5e7bdf4fb156
files kallithea/lib/vcs/backends/hg/changeset.py
diffstat 1 files changed, 4 insertions(+), 5 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,15 +297,14 @@
             lineno, sha, changeset lazy loader and line
         """
 
-        fctx = self._get_filectx(path)
-        for i, (aline, l) in enumerate(fctx.annotate(linenumber=False)):
-            ln_no = i + 1
+        annotations = self._get_filectx(path).annotate(linenumber=False)
+        for i, (aline, l) in enumerate(annotations):
             try:
                 fctx = aline.fctx
             except AttributeError: # aline.fctx was introduced in Mercurial 4.4
                 fctx = aline[0]
-            sha = hex(fctx.node())
-            yield (ln_no, sha, lambda sha=sha, l=l: self.repository.get_changeset(sha), l)
+            sha = fctx.hex()
+            yield (i + 1, sha, lambda sha=sha, l=l: self.repository.get_changeset(sha), l)
 
     def fill_archive(self, stream=None, kind='tgz', prefix=None,
                      subrepos=False):