Mercurial > kallithea
changeset 7266:b3ef9012be54
hg: fix continuation binding of callback variables
The get_file_annotate generator yields a callback. That callback happened to
look at the current state of the generator. It happened to work anyway,
apparently because the callback always was called immediately, before the
generator state changed. But for example if the get_file_annotate was buffered
into a list, the callback would return the same result each time.
Instead, bind the generator iterator variables as named parameter values for
the callback function. That will make sure the callback always returns the
right value.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 11 May 2018 14:26:48 +0200 |
parents | 205c0ed5b628 |
children | 6fd0e1193f25 |
files | kallithea/lib/vcs/backends/hg/changeset.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/changeset.py Thu Mar 15 19:56:37 2018 +0100 +++ b/kallithea/lib/vcs/backends/hg/changeset.py Fri May 11 14:26:48 2018 +0200 @@ -305,7 +305,7 @@ except AttributeError: # aline.fctx was introduced in Mercurial 4.4 fctx = aline[0] sha = hex(fctx.node()) - yield (ln_no, sha, lambda: self.repository.get_changeset(sha), l) + yield (ln_no, sha, lambda sha=sha, l=l: self.repository.get_changeset(sha), l) def fill_archive(self, stream=None, kind='tgz', prefix=None, subrepos=False):