From 7f6a1d67df59a5ccc4055cba6a315234a3f1123f Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 2 Feb 2012 10:34:56 +0100 Subject: [PATCH] fix repo link and add notice --- repolink/repolink.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/repolink/repolink.py b/repolink/repolink.py index 89b2c6c..3a4ba62 100644 --- a/repolink/repolink.py +++ b/repolink/repolink.py @@ -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:] - add_ctxtnav(req, "Repo", href = href) + 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)