get repolink from http://zoo.weinigel.se/trac/public/browser/trac/repolink/trunk/repolink
This commit is contained in:
commit
5229866cde
4 changed files with 61 additions and 0 deletions
12
README.txt
Normal file
12
README.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
This trac plugin adds a link to the repository in the source browser.
|
||||
|
||||
For an example of how it works, go to the following link and then
|
||||
click on "Repo" in the context navigation:
|
||||
|
||||
http://zoo.weinigel.se/trac/public/browser/trac/repolink/trunk
|
||||
|
||||
To activate the link you have to tell the plugin where the repository
|
||||
resides, for example, if the repository is reachable via http:
|
||||
|
||||
[trac]
|
||||
repository_url=http://svn.edgewall.com/repos/trac/
|
0
repolink/__init__.py
Normal file
0
repolink/__init__.py
Normal file
26
repolink/repolink.py
Normal file
26
repolink/repolink.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
#! /usr/bin/python
|
||||
from trac.core import *
|
||||
from trac.web.api import IRequestFilter
|
||||
|
||||
from trac.web.chrome import add_ctxtnav
|
||||
|
||||
class RepoLinkModule(Component):
|
||||
"""Show a link to the repository in the source browser."""
|
||||
|
||||
implements(IRequestFilter)
|
||||
|
||||
def __init__(self):
|
||||
Component.__init__(self)
|
||||
self.base = self.config.get('trac', 'repository_url')
|
||||
if self.base.endswith('/'):
|
||||
self.base = self.base[:-1]
|
||||
|
||||
def pre_process_request(self, req, handler):
|
||||
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)
|
||||
|
||||
return (template, data, content_type)
|
23
setup.py
Executable file
23
setup.py
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name = 'RepoLink',
|
||||
version = '0.1',
|
||||
packages = ['repolink'],
|
||||
|
||||
author = "Christer Weinigel",
|
||||
author_email = "christer@weinigel.se",
|
||||
description = "Show a link to the repository in the source browser",
|
||||
license = "BSD",
|
||||
keywords = "trac repolink",
|
||||
url = "http://zoo.weinigel.se/",
|
||||
|
||||
entry_points = {
|
||||
'trac.plugins': [
|
||||
'repolink.repolink = repolink.repolink'
|
||||
]
|
||||
}
|
||||
)
|
Loading…
Reference in a new issue