##// END OF EJS Templates
hgweb: move another utility function into the webutil module
Dirkjan Ochtman -
r7311:de9c87fe default
parent child Browse files
Show More
@@ -270,12 +270,6 b' class hgweb(object):'
270 if i in allowed or self.configbool("web", "allow" + i):
270 if i in allowed or self.configbool("web", "allow" + i):
271 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
271 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
272
272
273 def listfilediffs(self, tmpl, files, changeset):
274 for f in files[:self.maxfiles]:
275 yield tmpl("filedifflink", node=hex(changeset), file=f)
276 if len(files) > self.maxfiles:
277 yield tmpl("fileellipses")
278
279 archive_specs = {
273 archive_specs = {
280 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None),
274 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None),
281 'gz': ('application/x-tar', 'tgz', '.tar.gz', None),
275 'gz': ('application/x-tar', 'tgz', '.tar.gz', None),
@@ -130,6 +130,7 b' def _search(web, tmpl, query):'
130 count += 1
130 count += 1
131 n = ctx.node()
131 n = ctx.node()
132 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
132 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
133 files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles)
133
134
134 yield tmpl('searchentry',
135 yield tmpl('searchentry',
135 parity=parity.next(),
136 parity=parity.next(),
@@ -139,7 +140,7 b' def _search(web, tmpl, query):'
139 changelogtag=showtags,
140 changelogtag=showtags,
140 desc=ctx.description(),
141 desc=ctx.description(),
141 date=ctx.date(),
142 date=ctx.date(),
142 files=web.listfilediffs(tmpl, ctx.files(), n),
143 files=files,
143 rev=ctx.rev(),
144 rev=ctx.rev(),
144 node=hex(n),
145 node=hex(n),
145 tags=webutil.nodetagsdict(web.repo, n),
146 tags=webutil.nodetagsdict(web.repo, n),
@@ -178,6 +179,7 b' def changelog(web, req, tmpl, shortlog ='
178 ctx = web.repo[i]
179 ctx = web.repo[i]
179 n = ctx.node()
180 n = ctx.node()
180 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
181 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
182 files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles)
181
183
182 l.insert(0, {"parity": parity.next(),
184 l.insert(0, {"parity": parity.next(),
183 "author": ctx.user(),
185 "author": ctx.user(),
@@ -186,7 +188,7 b' def changelog(web, req, tmpl, shortlog ='
186 "changelogtag": showtags,
188 "changelogtag": showtags,
187 "desc": ctx.description(),
189 "desc": ctx.description(),
188 "date": ctx.date(),
190 "date": ctx.date(),
189 "files": web.listfilediffs(tmpl, ctx.files(), n),
191 "files": files,
190 "rev": i,
192 "rev": i,
191 "node": hex(n),
193 "node": hex(n),
192 "tags": webutil.nodetagsdict(web.repo, n),
194 "tags": webutil.nodetagsdict(web.repo, n),
@@ -143,6 +143,12 b' def filectx(repo, req):'
143
143
144 return fctx
144 return fctx
145
145
146 def listfilediffs(tmpl, files, node, max):
147 for f in files[:max]:
148 yield tmpl('filedifflink', node=hex(node), file=f)
149 if len(files) > max:
150 yield tmpl('fileellipses')
151
146 def diffs(repo, tmpl, ctx, files, parity):
152 def diffs(repo, tmpl, ctx, files, parity):
147
153
148 def countgen():
154 def countgen():
General Comments 0
You need to be logged in to leave comments. Login now