Modify ↓
#11431 closed defect (fixed)
[PATCH] branch:r1 leads AttributeError if the default repository is not a mercurial repository
| Reported by: | Jun Omae | Owned by: | Jun Omae |
|---|---|---|---|
| Priority: | normal | Milestone: | plugin - mercurial |
| Component: | plugin/mercurial | Version: | 0.12-stable |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: |
Fix |
||
| API Changes: | |||
| Internal Changes: | |||
Description
When the default repository is not a mercurial repository, branch:r1 in wiki leads an AttributeError.
2014-01-08 14:08:05,579 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/web/main.py", line 522, in _dispatch_request
dispatcher.dispatch(req)
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/web/main.py", line 264, in dispatch
content_type)
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/web/chrome.py", line 876, in render_template
encoding='utf-8')
...
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/ticket/templates/ticket_box.html", line 77, in <Expression u'wiki_to_html(context, ticket.description, escape_newlines=preserve_newlines)'>
${wiki_to_html(context, ticket.description, escape_newlines=preserve_newlines)}
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/util/compat.py", line 83, in newfunc
return func_(*(args + fargs), **dict(kwargs, **fkwargs))
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/wiki/formatter.py", line 1501, in format_to_html
return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/wiki/formatter.py", line 1456, in generate
escape_newlines)
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/wiki/formatter.py", line 1243, in format
result = re.sub(self.wikiparser.rules, self.replace, line)
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/sre.py", line 142, in sub
return _compile(pattern, 0).sub(repl, string, count)
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/wiki/formatter.py", line 1161, in replace
replacement = self.handle_match(fullmatch)
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/wiki/formatter.py", line 1157, in handle_match
return internal_handler(match, fullmatch)
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/wiki/formatter.py", line 533, in _shref_formatter
return self._make_link(ns, target, match, match, fullmatch)
File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/wiki/formatter.py", line 590, in _make_link
fullmatch)
File "/home/jun66j5/src/trac/edgewall/svn/plugins/0.12/mercurial-plugin/tracext/hg/backend.py", line 435, in _format_link
for b, n in repos.repo.branchtags().items():
AttributeError: 'SvnCachedRepository' object has no attribute 'repo'
Workaround:
-
tracext/hg/backend.py
430 430 break 431 431 context = context.parent 432 432 repos = rm.get_repository(reponame) 433 if repos:433 if isinstance(repos, MercurialRepository): 434 434 if ns == 'branch': 435 435 for b, n in repos.repo.branchtags().items(): 436 436 if repos.to_u(b) == rev:
Attachments (0)
Change History (8)
comment:1 by , 12 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
| Summary: | [PATCH] AttributeError: 'SvnCachedRepository' object has no attribute 'repo' → [PATCH] branch:r1 leads AttributeError if the default repository is not a mercurial repository |
comment:2 by , 12 years ago
| Owner: | changed from to |
|---|
comment:3 by , 10 years ago
| Component: | wiki system → plugin/mercurial |
|---|---|
| Owner: | changed from to |
follow-up: 5 comment:4 by , 10 years ago
| Release Notes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Committed in [7c49d0e31747/mercurial-plugin] on 0.12 branch and merged in [a311aa01ebcb/mercurial-plugin] on 1.0 branch.
follow-ups: 6 8 comment:5 by , 10 years ago
Replying to jomae:
Quickjump should list all bookmarks, not only those of current revision.
Also Repository.get_bookmarks() API would be useful.
comment:6 by , 10 years ago
comment:8 by , 10 years ago
Note:
See TracTickets
for help on using tickets.



I'll apply the patch.