diff --git a/kallithea/lib/vcs/backends/git/changeset.py b/kallithea/lib/vcs/backends/git/changeset.py --- a/kallithea/lib/vcs/backends/git/changeset.py +++ b/kallithea/lib/vcs/backends/git/changeset.py @@ -321,11 +321,10 @@ class GitChangeset(BaseChangeset): """ Returns a generator of four element tuples with lineno, sha, changeset lazy loader and line - - TODO: This function now uses os underlying 'git' command which is - generally not good. Should be replaced with algorithm iterating - commits. """ + # TODO: This function now uses os underlying 'git' command which is + # generally not good. Should be replaced with algorithm iterating + # commits. cmd = ['blame', '-l', '--root', '-r', self.id, '--', path] # -l ==> outputs long shas (and we need all 40 characters) # --root ==> doesn't put '^' character for boundaries @@ -333,9 +332,8 @@ class GitChangeset(BaseChangeset): so = self.repository.run_git_command(cmd) for i, blame_line in enumerate(so.split('\n')[:-1]): - ln_no = i + 1 sha, line = re.split(r' ', blame_line, 1) - yield (ln_no, sha, lambda: self.repository.get_changeset(sha), line) + yield (i + 1, sha, lambda sha=sha: self.repository.get_changeset(sha), line) def fill_archive(self, stream=None, kind='tgz', prefix=None, subrepos=False): 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 @@ -287,9 +287,9 @@ class MercurialChangeset(BaseChangeset): """ annotations = self._get_filectx(path).annotate() annotation_lines = [(annotateline.fctx, annotateline.text) for annotateline in annotations] - for i, (fctx, l) in enumerate(annotation_lines): + for i, (fctx, line) in enumerate(annotation_lines): sha = ascii_str(fctx.hex()) - yield (i + 1, sha, lambda sha=sha, l=l: self.repository.get_changeset(sha), l) + yield (i + 1, sha, lambda sha=sha: self.repository.get_changeset(sha), line) def fill_archive(self, stream=None, kind='tgz', prefix=None, subrepos=False):