Opened 14 years ago
Closed 14 years ago
#9840 closed defect (fixed)
Crash on navigating on a revision range reference
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | normal | Milestone: | 0.12.2 |
Component: | plugin/mercurial | Version: | 0.12 |
Severity: | normal | Keywords: | review |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I added a revision range reference to a ticket comment: r155:157
Saved the comment, then navigated on the link it created. Got the following exception:
Oops… Trac detected an internal error: TypeError: unsupported operand type(s) for -: 'str' and 'int' This is probably a local installation issue. Found a bug in Trac? If you think this should work and you can reproduce the problem, you should consider creating a bug report. Before you do that, though, please first try searching for similar issues, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac or its plugins, please try the mailing list instead of creating a ticket. Otherwise, please ==== How to Reproduce ==== While doing a GET operation on `/log/`, Trac issued an internal error. ''(please provide additional details here)'' Request parameters: {{{ {'path': u'/', 'revs': u'155-157'} }}} User agent: `Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12` ==== System Information ==== || '''`Trac`''' || `0.12.1` || || '''`Babel`''' || `0.9.5 (translations unavailable)` || || '''`Docutils`''' || `0.6` || || '''`Genshi`''' || `0.6` || || '''`Mercurial`''' || `1.7` || || '''`mod_wsgi`''' || `2.8 (WSGIProcessGroup wsgi_trac WSGIApplicationGroup %{GLOBAL})` || || '''`psycopg2`''' || `2.0.13` || || '''`Pygments`''' || `1.3.1` || || '''`Python`''' || `2.6.5 (r265:79063, Apr 16 2010, 13:28:26) ` [[br]] `[GCC 4.4.3]` || || '''`RPC`''' || `1.1.0-r9262` || || '''`setuptools`''' || `0.6` || || '''`Subversion`''' || `1.6.6 (r40053)` || || '''`jQuery`''' || `1.4.2` || ==== Enabled Plugins ==== || '''`timingandestimationplugin`''' || `1.0.6` || || '''`TracMercurial`''' || `0.12.0.23dev-r9953` || || '''`TracMercurialChangesetPlugin`''' || `0.4` || || '''`TracPaste`''' || `0.2.1` || || '''`TracPyDotOrgTheme`''' || `2.0` || || '''`TracThemeEngine`''' || `2.0.1` || || '''`TracXMLRPC`''' || `1.1.0-r9262` || ==== Python Traceback ==== {{{ Traceback (most recent call last): File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request dispatcher.dispatch(req) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 237, in dispatch resp = chosen_handler.process_request(req) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/versioncontrol/web_ui/log.py", line 163, in process_request for old_path, old_rev, old_chg in history(): File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/versioncontrol/web_ui/log.py", line 144, in history b = rev - 1 TypeError: unsupported operand type(s) for -: 'str' and 'int' }}} a new bug report describing the problem and explain how to reproduce it. Python Traceback Most recent call last: * File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request Code fragment: Line 506 try: 507 if not env and env_error: 508 raise HTTPInternalError(env_error) 509 try: 510 dispatcher = RequestDispatcher(env) 511 dispatcher.dispatch(req) 512 except RequestDone: 513 pass 514 resp = req._response or [] 515 516 except HTTPException, e: Local variables: Name Value dispatcher <trac.web.main.RequestDispatcher object at 0xb8b3522c> e TypeError("unsupported operand type(s) for -: 'str' and 'int'",) env <trac.env.Environment object at 0xb870958c> env_error None req <Request "GET '/log/'"> resp [] * File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 237, in dispatch Code fragment: Line 232 msg = _('Do you have cookies enabled?') 233 raise HTTPBadRequest(_('Missing or invalid form token.' 234 ' %(msg)s', msg=msg)) 235 236 # Process the request and render the template 237 resp = chosen_handler.process_request(req) 238 if resp: 239 if len(resp) == 2: # Clearsilver 240 chrome.populate_hdf(req) 241 template, content_type = \ 242 self._post_process_request(req, *resp) Local variables: Name Value chosen_handler <trac.versioncontrol.web_ui.log.LogModule object at 0xb8b3534c> chrome <trac.web.chrome.Chrome object at 0xb8a8c0ac> err (<type 'exceptions.TypeError'>, TypeError("unsupported operand type(s) for ... handler <trac.versioncontrol.web_ui.log.LogModule object at 0xb8b3534c> req <Request "GET '/log/'"> self <trac.web.main.RequestDispatcher object at 0xb8b3522c> * File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/versioncontrol/web_ui/log.py", line 163, in process_request Code fragment: Line 158 # -- retrieve history, asking for limit+1 results 159 info = [] 160 depth = 1 161 previous_path = normpath 162 count = 0 163 for old_path, old_rev, old_chg in history(): 164 if stop_rev and repos.rev_older_than(old_rev, stop_rev): 165 break 166 old_path = repos.normalize_path(old_path) 167 168 item = { Local variables: Name Value count 1 cset_resource <Resource 'repository, changeset'> depth 1 display_rev <bound method MercurialRepository.display_rev of ... format None history <function history at 0xb8fc3994> info [{'path': '', 'depth': 1, 'rev': ... item {'path': '', 'depth': 1, 'rev': ... limit 100 mode 'stop_on_copy' normpath '' old_chg 'edit' old_path '' old_rev 'b3b2aaab354846d3c39580fe7504da3c09e73409' path '/' previous_path '' reponame u'' repos <tracext.hg.backend.MercurialRepository object at 0xb8df1c4c> req <Request "GET '/log/'"> rev u'b3b2aaab354846d3c39580fe7504da3c09e73409' revranges <trac.util.Ranges object at 0xb8d5e6ec> revs u'155-157' rm <trac.versioncontrol.api.RepositoryManager object at 0xb8b3566c> self <trac.versioncontrol.web_ui.log.LogModule object at 0xb8b3534c> stop_limit 101 stop_rev None verbose None * File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/versioncontrol/web_ui/log.py", line 144, in history Code fragment: Line 139 np, nrev, nchg = expected_next_item 140 if rev != nrev: # no, we need a separator 141 yield (np, nrev, None) 142 yield node_history[0] 143 prevpath = node_history[-1][0] # follow copy 144 b = rev - 1 145 if len(node_history) > 1: 146 expected_next_item = node_history[-1] 147 else: 148 expected_next_item = None 149 if expected_next_item: Local variables: Name Value a 155 b 157 chg 'edit' cset_resource <Resource 'repository, changeset'> expected_next_item None node <tracext.hg.backend.MercurialNode object at 0xb8dcf68c> node_history [(u'', 'b3b2aaab354846d3c39580fe7504da3c09e73409', 'edit'), (u'', ... p u'' path '/' prevpath u'' ranges [(155, 157)] repos <tracext.hg.backend.MercurialRepository object at 0xb8df1c4c> req <Request "GET '/log/'"> rev 'b3b2aaab354846d3c39580fe7504da3c09e73409' revranges <trac.util.Ranges object at 0xb8d5e6ec> File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request dispatcher.dispatch(req) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 237, in dispatch resp = chosen_handler.process_request(req) File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/versioncontrol/web_ui/log.py", line 163, in process_request for old_path, old_rev, old_chg in history(): File "/usr/local/lib/python2.6/dist-packages/Trac-0.12.1-py2.6.egg/trac/versioncontrol/web_ui/log.py", line 144, in history b = rev - 1 System Information: User Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12 Trac 0.12.1 Babel 0.9.5 (translations unavailable) Docutils 0.6 Genshi 0.6 Mercurial 1.7 mod_wsgi 2.8 (WSGIProcessGroup wsgi_trac WSGIApplicationGroup %{GLOBAL}) psycopg2 2.0.13 Pygments 1.3.1 Python 2.6.5 (r265:79063, Apr 16 2010, 13:28:26) [GCC 4.4.3] RPC 1.1.0-r9262 setuptools 0.6 Subversion 1.6.6 (r40053) jQuery 1.4.2 Enabled Plugins: timingandestimationplugin 1.0.6 /usr/local/lib/python2.6/dist-packages/timingandestimationplugin-1.0.6-py2.6.egg TracMercurial 0.12.0.23dev-r9953 /usr/local/lib/python2.6/dist-packages/TracMercurial-0.12.0.23dev_r9953-py2.6.egg TracMercurialChangesetPlugin 0.4 /usr/local/lib/python2.6/dist-packages/TracMercurialChangesetPlugin-0.4-py2.6.egg TracPaste 0.2.1 /usr/local/lib/python2.6/dist-packages/TracPaste-0.2.1-py2.6.egg TracPyDotOrgTheme 2.0 /usr/local/lib/python2.6/dist-packages/TracPyDotOrgTheme-2.0-py2.6.egg TracThemeEngine 2.0.1 /usr/local/lib/python2.6/dist-packages/TracThemeEngine-2.0.1-py2.6.egg TracXMLRPC 1.1.0-r9262 /usr/local/lib/python2.6/dist-packages/TracXMLRPC-1.1.0_r9262-py2.6.egg TracGuide — The Trac User and Administration Guide
Attachments (2)
Change History (5)
comment:1 by , 14 years ago
Milestone: | → 0.12.2 |
---|---|
Owner: | set to |
by , 14 years ago
Attachment: | 9840-hg-node-history-r9953.patch added |
---|
Fix node.get_history()
in mercurial-plugin-0.12.
comment:2 by , 14 years ago
Keywords: | review added |
---|
9840-rev-log-r10416.patch (hopefully) fixes the revision log history generation for VCs without linear history. This in turn has revealed a bug in the Mercurial plugin, where node.get_history()
doesn't take the limit
parameter into account, which breaks history generation. This is fixed by 9840-hg-node-history-r9953.patch.
I'm not so familiar with that part of the code, so a review would be welcome.
comment:3 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
9840-hg-node-history-r9953.patch was applied on mercurial-plugin-0.12
in [10427], and 9840-rev-log-r10416.patch in [10429].
This seems to be related to using Mercurial. Let's see: r155:157/rblank
Right, same crash here. Scheduling for 0.12.2 if it's an easy fix, otherwise I'll push it back.