42
50
if style == 'fragment':
43
51
def file_link(filename):
44
52
if currently_showing and filename == currently_showing:
45
return '<b><a href="#%s">%s</a></b>' % (
46
cgi.escape(filename), cgi.escape(filename))
54
'<b><a href="#%s">%s</a></b>',
55
urllib.quote(filename.encode('utf-8')), filename)
48
57
return revision_link(
49
url, entry.revno, filename, '#' + filename)
58
url, entry.revno, filename,
59
'#' + urllib.quote(filename.encode('utf-8')))
51
61
def file_link(filename):
52
return '<a href="%s%s" title="View changes to %s in revision %s">%s</a>'%(
53
url(['/revision', entry.revno]), '#' + filename, cgi.escape(filename),
54
cgi.escape(entry.revno), cgi.escape(filename))
63
'<a href="%s%s" title="View changes to %s in revision %s">'
65
url(['/revision', entry.revno]),
66
'#' + urllib.quote(filename.encode('utf-8')),
67
filename, entry.revno, filename)
55
68
return _pt('revisionfilechanges').expand(
56
69
entry=entry, file_changes=file_changes, file_link=file_link, **templatefunctions)
60
def revisioninfo(url, branch, entry, file_changes=None, currently_showing=None):
73
def revisioninfo(url, branch, entry, file_changes=None, currently_showing=None, merged_in=None):
61
74
from loggerhead import util
62
75
return _pt('revisioninfo').expand(
63
76
url=url, change=entry, branch=branch, util=util,
64
77
file_changes=file_changes, currently_showing=currently_showing,
78
merged_in=merged_in, **templatefunctions)
117
def annotate_link(url, revno, path):
118
return '<a href="%s" title="Annotate %s">%s</a>'%(
119
url(['/annotate', revno, path]), cgi.escape(path), cgi.escape(path))
130
def view_link(url, revno, path):
132
'<a href="%s" title="Annotate %s">%s</a>',
133
url(['/view', revno, path]), path, path)
122
137
def revision_link(url, revno, path, frag=''):
123
return '<a href="%s%s" title="View changes to %s in revision %s">%s</a>'%(
124
url(['/revision', revno, path]), frag, cgi.escape(path),
125
cgi.escape(revno), cgi.escape(path))
139
'<a href="%s%s" title="View changes to %s in revision %s">%s</a>',
140
url(['/revision', revno, path]), frag, path, revno, path)
144
def loggerhead_version():
145
return loggerhead.__version__
147
_cached_generator_string = None
150
def generator_string():
151
global _cached_generator_string
152
if _cached_generator_string is None:
155
# TODO: Errors -- e.g. from a missing/invalid __version__ attribute, or
156
# ValueError accessing Distribution.version -- should be non-fatal.
158
versions.append(('Loggerhead', loggerhead.__version__))
161
python_version = bzrlib._format_version_tuple(sys.version_info)
162
versions.append(('Python', python_version))
164
versions.append(('Bazaar', bzrlib.__version__))
166
Paste = pkg_resources.get_distribution('Paste')
167
versions.append(('Paste', Paste.version))
170
PasteDeploy = pkg_resources.get_distribution('PasteDeploy')
171
except pkg_resources.DistributionNotFound:
174
versions.append(('PasteDeploy', PasteDeploy.version))
177
versions.append(('SimpleTAL', simpletal.__version__))
184
versions.append(('Pygments', pygments.__version__))
187
from bzrlib.plugins import search
191
bzr_search_version = bzrlib._format_version_tuple(
193
versions.append(('bzr-search', bzr_search_version))
195
# TODO: On old Python versions, elementtree may be used.
198
versions.append(('simplejson', simplejson.__version__))
201
Dozer = pkg_resources.get_distribution('Dozer')
202
except pkg_resources.DistributionNotFound:
205
versions.append(('Dozer', Dozer.version))
207
version_strings = ("%s/%s" % t for t in versions)
208
_cached_generator_string = ' '.join(version_strings)
209
return _cached_generator_string