Edgewall Software
Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#13047 closed defect (duplicate)

TypeError: 'annotateline' object is not iterable

Reported by: anonymous Owned by:
Priority: normal Milestone:
Component: plugin/mercurial Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

After upgrading Mercurial, Trac blame doesn't work anymore:

2018-06-19 10:29:04,944 Trac[api] WARNING: HTML preview using PygmentsRenderer with <RenderingContext <Resource u'repository:R1, source:R1/a.c@deba02c781bc32a84b7f1d63e216912306ae71fd8a6'>> failed: 
Traceback (most recent call last):
  File "build\bdist.win32\egg\trac\mimeview\api.py", line 811, in render
    return self._render_source(context, result, annotations)
  File "build\bdist.win32\egg\trac\mimeview\api.py", line 848, in _render_source
    data = (annotator, annotator.get_annotation_data(context))
  File "build\bdist.win32\egg\trac\versioncontrol\web_ui\browser.py", line 875, in get_annotation_data
    return BlameAnnotator(self.env, context)
  File "build\bdist.win32\egg\trac\versioncontrol\web_ui\browser.py", line 981, in __init__
    self.reset()
  File "build\bdist.win32\egg\trac\versioncontrol\web_ui\browser.py", line 988, in reset
    self.annotations = node.get_annotations()
  File "build\bdist.win32\egg\tracext\hg\backend.py", line 1225, in get_annotations
    for fc, line in self.filectx.annotate(follow=True):
TypeError: 'annotateline' object is not iterable
2018-06-19 10:29:05,010 Trac[api] WARNING: HTML preview using PlainTextRenderer with <RenderingContext <Resource u'repository:R1, source:R1/a.c@a02c781bc32a84b7f1d63e216912306ae71fd8a6'>> failed: 
Traceback (most recent call last):
  File "build\bdist.win32\egg\trac\mimeview\api.py", line 811, in render
    return self._render_source(context, result, annotations)
  File "build\bdist.win32\egg\trac\mimeview\api.py", line 848, in _render_source
    data = (annotator, annotator.get_annotation_data(context))
  File "build\bdist.win32\egg\trac\versioncontrol\web_ui\browser.py", line 875, in get_annotation_data
    return BlameAnnotator(self.env, context)
  File "build\bdist.win32\egg\trac\versioncontrol\web_ui\browser.py", line 981, in __init__
    self.reset()
  File "build\bdist.win32\egg\trac\versioncontrol\web_ui\browser.py", line 988, in reset
    self.annotations = node.get_annotations()
  File "build\bdist.win32\egg\tracext\hg\backend.py", line 1225, in get_annotations
    for fc, line in self.filectx.annotate(follow=True):
TypeError: 'annotateline' object is not iterable

Attachments (0)

Change History (7)

comment:1 by anonymous, 6 years ago

Guessing from https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/context.py#l888 I tried this change:

  • tracext/hg/backend.py

    diff -r d9139f9a3601 tracext/hg/backend.py
    a b  
    12221222    def get_annotations(self):
    12231223        annotations = []
    12241224        if self.filectx:
    1225             for fc, line in self.filectx.annotate(follow=True):
    1226                 if isinstance(fc, tuple):
    1227                     fc = fc[0]
     1225            for annotateline in self.filectx.annotate(follow=True):
     1226                if isinstance(annotateline, tuple):
     1227                    fc = annotateline[0]
     1228                    if isinstance(fc, tuple):
     1229                        fc = fc[0]
     1230                else:
     1231                    fc = annotateline.fctx
    12281232                annotations.append(fc.rev() or '0')
    12291233        return annotations

And it seems to work.

comment:2 by Jun Omae, 6 years ago

Milestone: plugin - mercurial
Resolution: duplicate
Status: newclosed

A duplicate of #13036.

in reply to:  1 comment:3 by Jun Omae, 6 years ago

Guessing from https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/context.py#l888 I tried this change: […]

The patch seems to be good with all versions of mercurial (3.8, 3.9, 4.6). Thanks.

comment:4 by anonymous, 6 years ago

(I only searched search:annotateline+iterable and missed the other ticket.)

comment:5 by anonymous, 6 years ago

BTW is there a reason TracMercurial#Releases does not mention version 1.0.0.5 to 1.0.0.8, compatibility with Trac 1.2+ / hg 3.2+?

in reply to:  5 comment:6 by Ryan J Ollos, 6 years ago

Replying to anonymous:

BTW is there a reason TracMercurial#Releases does not mention version 1.0.0.5 to 1.0.0.8, compatibility with Trac 1.2+ / hg 3.2+?

I suspect the page hasn't been updated with recent releases. Please feel free to update it.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.