#11183 closed defect (duplicate)
Changeset display fails with Git commits that modify submodules
Reported by: | 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 719 719 720 720 action = GitChangeset.action_map[action[0]] 721 721 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 722 727 if action == Changeset.ADD: 723 728 p_path = '' 724 729 p_rev = None
Attachments (0)
Change History (2)
comment:1 by , 12 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 by , 12 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 719 719 720 720 action = GitChangeset.action_map[action[0]] 721 721 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 722 727 if action == Changeset.ADD: 723 728 p_path = '' 724 729 p_rev = None
A duplicate of #10603. Thanks for the reporting!