Edgewall Software

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#11431 closed defect (fixed)

[PATCH] branch:r1 leads AttributeError if the default repository is not a mercurial repository — at Version 4

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 AttributeError raising from branch:r1 in wiki when default repository is not a mercurial repository.

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

     
    430430                        break
    431431                    context = context.parent
    432432                repos = rm.get_repository(reponame)
    433             if repos:
     433            if isinstance(repos, MercurialRepository):
    434434                if ns == 'branch':
    435435                    for b, n in repos.repo.branchtags().items():
    436436                        if repos.to_u(b) == rev:

Change History (4)

comment:1 by Jun Omae, 10 years ago

Owner: set to Jun Omae
Status: newassigned
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 Jun Omae, 10 years ago

Owner: changed from Jun Omae to Christian Boos

comment:3 by Jun Omae, 9 years ago

Component: wiki systemplugin/mercurial
Owner: changed from Christian Boos to Jun Omae

I'll apply the patch.

comment:4 by Jun Omae, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [7c49d0e31747/mercurial-plugin] on 0.12 branch and merged in [a311aa01ebcb/mercurial-plugin] on 1.0 branch.

Note: See TracTickets for help on using tickets.