Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11183 closed defect (duplicate)

Changeset display fails with Git commits that modify submodules

Reported by: dvdkhlng@… Owned by:
Priority: normal Milestone:
Component: plugin/git Version: 1.0.1
Severity: normal Keywords:
Cc: dvdkhlng@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Hi,

when viewing Git repository changeset items that contain submodule modifications, Trac 1.0.1 fails with

Oops…
Trac detected an internal error:

TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
[..]
Python Traceback
Most recent call last:

    File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py", line 497, in _dispatch_request
    File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py", line 214, in dispatch
    File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/versioncontrol/web_ui/changeset.py", line 353, in process_request
    File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/versioncontrol/web_ui/changeset.py", line 587, in _render_html
    File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/versioncontrol/web_ui/changeset.py", line 538, in _estimate_changes 

Looks like submodule changeset items are treated as FILE items, so _render_html attempts to call _estimate_changes(old_node, new_node) which in turn calls node.get_content_length() which returns NoneType for submodule changes.

As a quick workaround I hacked git_fs.py to treat submodule changes as type Changeset.ADD, _render_html won't try to call _estimate_changes()

  • Trac-1.0.1/tracopt/versioncontrol/git/git_fs.py

    old new  
    719719
    720720                action = GitChangeset.action_map[action[0]]
    721721
     722                # David's fix for submodule changes (else timeline's
     723                # render_html crashes)
     724                if mode2.startswith('1') or mode1.startswith('1'):
     725                    action = Changeset.ADD
     726
    722727                if action == Changeset.ADD:
    723728                    p_path = ''
    724729                    p_rev = None

Attachments (0)

Change History (2)

comment:1 by Jun Omae, 11 years ago

Resolution: duplicate
Status: newclosed

A duplicate of #10603. Thanks for the reporting!

comment:2 by dvdkhlng@…, 11 years ago

Note, that the patch above is broken. The file-mode needs to be checked for '16' not '1', so more correctly (but still hacky):

  • Trac-1.0.1/tracopt/versioncontrol/git/git_fs.py

    old new  
    719719
    720720                action = GitChangeset.action_map[action[0]]
    721721
     722                # David's fix for submodule changes (else timeline's
     723                # render_html crashes)
     724                if mode2.startswith('16') or mode1.startswith('16'):
     725                    action = Changeset.ADD
     726
    722727                if action == Changeset.ADD:
    723728                    p_path = ''
    724729                    p_rev = None

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.