Strange code -- needs cleanup
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Trac-Bzr |
Fix Released
|
Low
|
Martin von Gagern |
Bug Description
This code has been in the trac-bzr codebase for a long while:
Line 237:
revid = urllib.unquote(rev)
if revid in ('current:', 'null:'):
return None, revid
return None, revid
if self.repo.
return None, revid
# Unsupported format.
raise versioncontrol.
Either this code should always return None, revid in which case, it should just look like this:
revid = urllib.unquote(rev)
return None, revid
Or the code should go through the whole sequence and raise the NoSuchChangeset exception if nothing else is found.
I talked to abentley a long time ago and he thought the latter was the correct case but he wasn't sure why the return was there in the first place. Attaching a patch to remove the return.
Related branches
- Trac-bzr-team: Pending requested
-
Diff: 32 lines (+2/-7)1 file modifiedtracbzr/backend.py (+2/-7)
Changed in trac-bzr: | |
status: | Fix Committed → Fix Released |
With bzr-1.7 this appears to cause a traceback (whereas it worked with bzr-1.3). However, the Exception is the same as:
https:/ /bugs.launchpad .net/trac- bzr/+bug/ 267700
so I think that we may be running into something that was deprecated and removed.
Traceback (most recent call last): python2. 5/site- packages/ trac/web/ main.py" , line 406, in dispatch_request dispatch( req) python2. 5/site- packages/ trac/web/ main.py" , line 237, in dispatch handler. process_ request( req) python2. 5/site- packages/ trac/versioncon trol/web_ ui/browser. py", line 148, in process_request _render_ directory( req, repos, node, rev) python2. 5/site- packages/ trac/versioncon trol/web_ ui/browser. py", line 173, in _render_directory self.env, repos, [i['rev'] for i in info]) python2. 5/site- packages/ trac/versioncon trol/web_ ui/util. py", line 37, in get_changes changeset( rev) python2. 5/site- packages/ tracbzr/ backend. py", line 312, in get_changeset rev(rev) python2. 5/site- packages/ tracbzr/ backend. py", line 240, in _parse_rev has_revision( revid):
File "/usr/lib/
dispatcher.
File "/usr/lib/
resp = chosen_
File "/usr/lib/
self.
File "/usr/lib/
changes = get_changes(
File "/usr/lib/
changeset = repos.get_
File "/usr/lib/
branch, revid = self._parse_
File "/usr/lib/
if self.repo.
AttributeError: 'BzrRepository' object has no attribute 'repo'