fix repo link and add notice

This commit is contained in:
j 2012-02-02 10:34:56 +01:00
parent 5229866cde
commit 7f6a1d67df

View file

@ -2,7 +2,7 @@
from trac.core import *
from trac.web.api import IRequestFilter
from trac.web.chrome import add_ctxtnav
from trac.web.chrome import add_ctxtnav, add_notice
class RepoLinkModule(Component):
"""Show a link to the repository in the source browser."""
@ -19,8 +19,11 @@ class RepoLinkModule(Component):
return (handler)
def post_process_request(self, req, template, data, content_type):
if self.base and req.path_info.startswith('/browser'):
href = self.base + req.path_info[8:]
if self.base and req.path_info.startswith('/browser/'):
name = req.path_info[9:].split('/')[0]
if name:
href = self.base + '/' + name
add_ctxtnav(req, "Repo", href = href)
add_notice(req, "checkout %s with: bzr branch %s"%(name, href))
return (template, data, content_type)