Changeset - c326db109854
[Not reviewed]
default
0 1 0
Mads Kiilerich - 8 years ago 2017-10-23 00:57:28
mads@kiilerich.com
vcs: add support for Mercurial annotate in Mercurial 4.4

Mercurial fctx.annotate() returns tuples with two elements: info about the
annotate line and the actual line. The code is changed to clarify that.

After Mercurial 4.4 with https://www.mercurial-scm.org/repo/hg/rev/2e32c6a31cc7 ,
the info is no longer a tuple but an attr object. Assume fctx is available as
an attribute, but catch exceptions and fall back to indexing as before.

That can't easily be done in hgcompat, so we do it inline.
1 file changed with 7 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/backends/hg/changeset.py
Show inline comments
 
@@ -294,10 +294,14 @@ class MercurialChangeset(BaseChangeset):
 
        """
 

	
 
        fctx = self._get_filectx(path)
 
        for i, annotate_data in enumerate(fctx.annotate(linenumber=False)):
 
        for i, (aline, l) in enumerate(fctx.annotate(linenumber=False)):
 
            ln_no = i + 1
 
            sha = hex(annotate_data[0][0].node())
 
            yield (ln_no, sha, lambda: self.repository.get_changeset(sha), annotate_data[1],)
 
            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: self.repository.get_changeset(sha), l)
 

	
 
    def fill_archive(self, stream=None, kind='tgz', prefix=None,
 
                     subrepos=False):
0 comments (0 inline, 0 general)