Opened 8 years ago

Closed 2 years ago

StopIteration error with some repositories

Reported by: Owned by: anonymous eblot normal RevtreePlugin normal 0.11

Description

We run a number of trac projects and have installed this plugin so that it can be used in any of them. In one of the projects it seems to work fine, but in another project I always get the following error messages:

Trac detected an internal error:

StopIteration:

Python Traceback Most recent call last:

• File "/usr/lib/python2.4/site-packages/Trac-0.11.2.1-py2.4.egg/trac/web/main.py", line 432, in _dispatch_request
• File "/usr/lib/python2.4/site-packages/Trac-0.11.2.1-py2.4.egg/trac/web/main.py", line 204, in dispatch
• File "build/bdist.linux-x86_64/egg/revtree/web_ui.py", line 246, in process_request
• File "build/bdist.linux-x86_64/egg/revtree/web_ui.py", line 356, in _process_revtree
• File "build/bdist.linux-x86_64/egg/revtree/model.py", line 446, in build
• File "build/bdist.linux-x86_64/egg/revtree/model.py", line 51, in get_chgset_info

Regards, Dan

comment:1 Changed 8 years ago by eblot

Would you have a log of the related changesets to help understanding the issue?

comment:2 Changed 8 years ago by anonymous

Well, the repository is for a commercial software product and so I cannot just post changeset data here in the public domain.

Perhaps you could give me some information such that I could locate what might be the cause myself. For a start I do not know how far back the plugin is looking (it would be the default setting I guess since it has been displaying this error ever since enabling it). Is it likely to be something in the commit logs themselves that is causing the problem?

comment:3 Changed 8 years ago by anonymous

Ok, I've made some progress. I checked out the plugin myself and modified it slightly. It seems that the plugin was getting itself mixed up for that particular repository on its initial attempt to render the graph, once I could get it past that first failed attempt it seemed to work normally. The method I used to get it past that first failure was as follows:

In the file "model.py", function "get_chgset_info" (around line 51) there is a call to "chgit.next()", but if "chgit" happens to be empty the call will throw an exception which is not caught by the plugin. By adding a try/except around the call and if it throws the StopIteration exception then simply return an empty "info" array, it allows the plugin to continue functioning normally.

Example:

    def get_chgset_info(tracchgset):
info = {}
chgit = tracchgset.get_changes()
try:
item = chgit.next()
except StopIteration:
return info

try:
chgit.next()
except StopIteration:
info['unique'] = True
else:
# more changes are available, i.e. this is not a simple changeset
info['unique'] = False
enum = ('path', 'kind', 'change', 'base_path', 'base_rev')
for (pos, name) in enumerate(enum):
info[name] = item[pos]
return info


Hope this helps!

Regards, Dan

comment:4 Changed 7 years ago by martin_s

Hi think this error occurs if an empty revision (produced by filtering a dumpfile) is rendered. See ticket #4763.

comment:5 Changed 7 years ago by toddecus

This code change resolved our issue as well.

comment:6 Changed 7 years ago by kovan

I'm also having this problem, but I'm reluctant to patch my plugin. If the fix proposed by Dan really fixes the issue I'd love to see it included in the distribution.

comment:7 Changed 7 years ago by kavehv

I'm getting this error with the latest version 0.6.3.xx on Trac 0.11.5 on a changeset where a user deleted files, but trac indicates that there are no changes. Any fix for this?

comment:8 Changed 2 years ago by eblot

• Resolution set to duplicate
• Status changed from new to closed

Duplicated/tracked as #9231