40
def file_change_summary(url, entry, modified_file_link):
48
def file_change_summary(url, entry, file_changes, style='normal', currently_showing=None):
49
if style == 'fragment':
50
def file_link(filename):
51
if currently_showing and filename == currently_showing:
52
return '<b><a href="#%s">%s</a></b>' % (
53
cgi.escape(filename), cgi.escape(filename))
56
url, entry.revno, filename, '#' + filename)
58
def file_link(filename):
59
return '<a href="%s%s" title="View changes to %s in revision %s">%s</a>' % (
60
url(['/revision', entry.revno]), '#' + filename, cgi.escape(filename),
61
cgi.escape(entry.revno), cgi.escape(filename))
41
62
return _pt('revisionfilechanges').expand(
42
url=url, entry=entry, modified_file_link=modified_file_link,
63
entry=entry, file_changes=file_changes, file_link=file_link, **templatefunctions)
47
def revisioninfo(url, branch, entry, modified_file_link=None):
67
def revisioninfo(url, branch, entry, file_changes=None, currently_showing=None, merged_in=None):
48
68
from loggerhead import util
49
69
return _pt('revisioninfo').expand(
50
70
url=url, change=entry, branch=branch, util=util,
51
modified_file_link=modified_file_link,
71
file_changes=file_changes, currently_showing=currently_showing,
72
merged_in=merged_in, **templatefunctions)
76
def branchinfo(branch):
77
if branch.served_url is not None:
78
return _pt('branchinfo').expand(branch=branch, **templatefunctions)
72
100
extra = ' ' + entry.branch_nick
75
return '(%s%s)'%(entry.revno, extra)
79
def modified_file_link_rev(url, entry, item):
80
return _pt('modified-file-link-rev').expand(
81
url=url, entry=entry, item=item,
86
def modified_file_link_log(url, entry, item):
87
return _pt('modified-file-link-log').expand(
88
url=url, entry=entry, item=item,
103
return '(%s%s)' % (entry.revno, extra)
104
118
def menu(branch, url, fileview_active=False):
105
119
return _pt('menu').expand(branch=branch, url=url,
106
120
fileview_active=fileview_active, **templatefunctions)
124
def annotate_link(url, revno, path):
125
return '<a href="%s" title="Annotate %s">%s</a>' % (
126
url(['/annotate', revno, path]), cgi.escape(path), cgi.escape(path))
129
def revision_link(url, revno, path, frag=''):
130
return '<a href="%s%s" title="View changes to %s in revision %s">%s</a>' % (
131
url(['/revision', revno, path]), frag, cgi.escape(path),
132
cgi.escape(revno), cgi.escape(path))
136
def loggerhead_version():
137
return loggerhead.__version__
139
_cached_generator_string = None
142
def generator_string():
143
global _cached_generator_string
144
if _cached_generator_string is None:
147
# TODO: Errors -- e.g. from a missing/invalid __version__ attribute, or
148
# ValueError accessing Distribution.version -- should be non-fatal.
150
versions.append(('Loggerhead', loggerhead.__version__))
153
python_version = bzrlib._format_version_tuple(sys.version_info)
154
versions.append(('Python', python_version))
156
versions.append(('Bazaar', bzrlib.__version__))
158
Paste = pkg_resources.get_distribution('Paste')
159
versions.append(('Paste', Paste.version))
162
PasteDeploy = pkg_resources.get_distribution('PasteDeploy')
163
except pkg_resources.DistributionNotFound:
166
versions.append(('PasteDeploy', PasteDeploy.version))
169
versions.append(('SimpleTAL', simpletal.__version__))
176
versions.append(('Pygments', pygments.__version__))
179
from bzrlib.plugins import search
183
bzr_search_version = bzrlib._format_version_tuple(
185
versions.append(('bzr-search', bzr_search_version))
187
# TODO: On old Python versions, elementtree may be used.
194
versions.append(('simplejson', simplejson.__version__))
197
Dozer = pkg_resources.get_distribution('Dozer')
198
except pkg_resources.DistributionNotFound:
201
versions.append(('Dozer', Dozer.version))
203
version_strings = ("%s/%s" % t for t in versions)
204
_cached_generator_string = ' '.join(version_strings)
205
return _cached_generator_string