Show More
@@ -70,14 +70,12 b' class hgweb(object):' | |||||
70 | if len(files) > self.maxfiles: |
|
70 | if len(files) > self.maxfiles: | |
71 | yield self.t("fileellipses") |
|
71 | yield self.t("fileellipses") | |
72 |
|
72 | |||
73 |
def siblings(self, siblings=[], |
|
73 | def siblings(self, siblings=[], hiderev=None, **args): | |
74 | if not rev: |
|
74 | siblings = [s for s in siblings if s.node() != nullid] | |
75 | rev = lambda x: "" |
|
75 | if len(siblings) == 1 and siblings[0].rev() == hiderev: | |
76 | siblings = [s for s in siblings if s != nullid] |
|
|||
77 | if len(siblings) == 1 and rev(siblings[0]) == hiderev: |
|
|||
78 | return |
|
76 | return | |
79 | for s in siblings: |
|
77 | for s in siblings: | |
80 |
yield dict(node=hex(s), rev=rev( |
|
78 | yield dict(node=hex(s.node()), rev=s.rev(), **args) | |
81 |
|
79 | |||
82 | def renamelink(self, fl, node): |
|
80 | def renamelink(self, fl, node): | |
83 | r = fl.renamed(node) |
|
81 | r = fl.renamed(node) | |
@@ -191,22 +189,19 b' class hgweb(object):' | |||||
191 | cl = self.repo.changelog |
|
189 | cl = self.repo.changelog | |
192 | l = [] # build a list in forward order for efficiency |
|
190 | l = [] # build a list in forward order for efficiency | |
193 | for i in range(start, end): |
|
191 | for i in range(start, end): | |
194 |
|
|
192 | ctx = self.repo.changectx(i) | |
195 |
|
|
193 | n = ctx.node() | |
196 | hn = hex(n) |
|
|||
197 |
|
194 | |||
198 | l.insert(0, {"parity": parity, |
|
195 | l.insert(0, {"parity": parity, | |
199 |
"author": c |
|
196 | "author": ctx.user(), | |
200 |
"parent": self.siblings(c |
|
197 | "parent": self.siblings(ctx.parents(), i - 1), | |
201 | cl.rev(n) - 1), |
|
198 | "child": self.siblings(ctx.children(), i + 1), | |
202 | "child": self.siblings(cl.children(n), cl.rev, |
|
|||
203 | cl.rev(n) + 1), |
|
|||
204 | "changelogtag": self.showtag("changelogtag",n), |
|
199 | "changelogtag": self.showtag("changelogtag",n), | |
205 |
"desc": c |
|
200 | "desc": ctx.description(), | |
206 |
"date": c |
|
201 | "date": ctx.date(), | |
207 |
"files": self.listfilediffs(c |
|
202 | "files": self.listfilediffs(ctx.files(), n), | |
208 | "rev": i, |
|
203 | "rev": i, | |
209 | "node": hn}) |
|
204 | "node": hex(n)}) | |
210 | parity = 1 - parity |
|
205 | parity = 1 - parity | |
211 |
|
206 | |||
212 | for e in l: |
|
207 | for e in l: | |
@@ -237,44 +232,42 b' class hgweb(object):' | |||||
237 | for i in range(cl.count() - 1, 0, -100): |
|
232 | for i in range(cl.count() - 1, 0, -100): | |
238 | l = [] |
|
233 | l = [] | |
239 | for j in range(max(0, i - 100), i): |
|
234 | for j in range(max(0, i - 100), i): | |
240 |
|
|
235 | ctx = self.repo.changectx(j) | |
241 |
|
|
236 | l.append(ctx) | |
242 | l.append((n, j, changes)) |
|
|||
243 | l.reverse() |
|
237 | l.reverse() | |
244 | for e in l: |
|
238 | for e in l: | |
245 | yield e |
|
239 | yield e | |
246 |
|
240 | |||
247 |
for |
|
241 | for ctx in revgen(): | |
248 | miss = 0 |
|
242 | miss = 0 | |
249 | for q in qw: |
|
243 | for q in qw: | |
250 |
if not (q in c |
|
244 | if not (q in ctx.user().lower() or | |
251 |
q in c |
|
245 | q in ctx.description().lower() or | |
252 |
q in " ".join(c |
|
246 | q in " ".join(ctx.files()[:20]).lower()): | |
253 | miss = 1 |
|
247 | miss = 1 | |
254 | break |
|
248 | break | |
255 | if miss: |
|
249 | if miss: | |
256 | continue |
|
250 | continue | |
257 |
|
251 | |||
258 | count += 1 |
|
252 | count += 1 | |
259 |
|
|
253 | n = ctx.node() | |
260 |
|
254 | |||
261 | yield self.t('searchentry', |
|
255 | yield self.t('searchentry', | |
262 | parity=self.stripes(count), |
|
256 | parity=self.stripes(count), | |
263 |
author=c |
|
257 | author=ctx.user(), | |
264 |
parent=self.siblings(c |
|
258 | parent=self.siblings(ctx.parents()), | |
265 |
child=self.siblings(c |
|
259 | child=self.siblings(ctx.children()), | |
266 | changelogtag=self.showtag("changelogtag",n), |
|
260 | changelogtag=self.showtag("changelogtag",n), | |
267 |
desc=c |
|
261 | desc=ctx.description(), | |
268 |
date=c |
|
262 | date=ctx.date(), | |
269 |
files=self.listfilediffs(c |
|
263 | files=self.listfilediffs(ctx.files(), n), | |
270 |
rev= |
|
264 | rev=ctx.rev(), | |
271 | node=hn) |
|
265 | node=hex(n)) | |
272 |
|
266 | |||
273 | if count >= self.maxchanges: |
|
267 | if count >= self.maxchanges: | |
274 | break |
|
268 | break | |
275 |
|
269 | |||
276 | cl = self.repo.changelog |
|
270 | cl = self.repo.changelog | |
277 | mf = cl.read(cl.tip())[0] |
|
|||
278 |
|
271 | |||
279 | yield self.t('search', |
|
272 | yield self.t('search', | |
280 | query=query, |
|
273 | query=query, | |
@@ -282,16 +275,14 b' class hgweb(object):' | |||||
282 | entries=changelist) |
|
275 | entries=changelist) | |
283 |
|
276 | |||
284 | def changeset(self, nodeid): |
|
277 | def changeset(self, nodeid): | |
285 |
c |
|
278 | ctx = self.repo.changectx(nodeid) | |
286 |
n = |
|
279 | n = ctx.node() | |
287 | nodeid = hex(n) |
|
280 | parents = ctx.parents() | |
288 | changes = cl.read(n) |
|
281 | p1 = parents[0].node() | |
289 | p1 = cl.parents(n)[0] |
|
|||
290 |
|
282 | |||
291 | files = [] |
|
283 | files = [] | |
292 | mf = self.repo.manifest.read(changes[0]) |
|
|||
293 | parity = 0 |
|
284 | parity = 0 | |
294 |
for f in c |
|
285 | for f in ctx.files(): | |
295 | files.append(self.t("filenodelink", |
|
286 | files.append(self.t("filenodelink", | |
296 | node=hex(n), file=f, |
|
287 | node=hex(n), file=f, | |
297 | parity=parity)) |
|
288 | parity=parity)) | |
@@ -302,14 +293,14 b' class hgweb(object):' | |||||
302 |
|
293 | |||
303 | yield self.t('changeset', |
|
294 | yield self.t('changeset', | |
304 | diff=diff, |
|
295 | diff=diff, | |
305 |
rev=c |
|
296 | rev=ctx.rev(), | |
306 |
node= |
|
297 | node=hex(n), | |
307 |
parent=self.siblings( |
|
298 | parent=self.siblings(parents), | |
308 |
child=self.siblings(c |
|
299 | child=self.siblings(ctx.children()), | |
309 | changesettag=self.showtag("changesettag",n), |
|
300 | changesettag=self.showtag("changesettag",n), | |
310 |
author=c |
|
301 | author=ctx.user(), | |
311 |
desc=c |
|
302 | desc=ctx.description(), | |
312 |
date=c |
|
303 | date=ctx.date(), | |
313 | files=files, |
|
304 | files=files, | |
314 | archives=self.archivelist(nodeid)) |
|
305 | archives=self.archivelist(nodeid)) | |
315 |
|
306 | |||
@@ -324,9 +315,8 b' class hgweb(object):' | |||||
324 | parity = (count - 1) & 1 |
|
315 | parity = (count - 1) & 1 | |
325 |
|
316 | |||
326 | for i in range(count): |
|
317 | for i in range(count): | |
|
318 | ctx = fctx.filectx(i) | |||
327 | n = fl.node(i) |
|
319 | n = fl.node(i) | |
328 | lr = fl.linkrev(n) |
|
|||
329 | ctx = self.repo.changectx(lr) |
|
|||
330 |
|
320 | |||
331 | l.insert(0, {"parity": parity, |
|
321 | l.insert(0, {"parity": parity, | |
332 | "filerev": i, |
|
322 | "filerev": i, | |
@@ -335,10 +325,8 b' class hgweb(object):' | |||||
335 | "author": ctx.user(), |
|
325 | "author": ctx.user(), | |
336 | "date": ctx.date(), |
|
326 | "date": ctx.date(), | |
337 | "rename": self.renamelink(fl, n), |
|
327 | "rename": self.renamelink(fl, n), | |
338 |
"parent": self.siblings(f |
|
328 | "parent": self.siblings(fctx.parents(), file=f), | |
339 |
|
|
329 | "child": self.siblings(fctx.children(), file=f), | |
340 | "child": self.siblings(fl.children(n), |
|
|||
341 | fl.rev, file=f), |
|
|||
342 | "desc": ctx.description()}) |
|
330 | "desc": ctx.description()}) | |
343 | parity = 1 - parity |
|
331 | parity = 1 - parity | |
344 |
|
332 | |||
@@ -376,8 +364,8 b' class hgweb(object):' | |||||
376 | node=hex(fctx.node()), |
|
364 | node=hex(fctx.node()), | |
377 | author=fctx.user(), |
|
365 | author=fctx.user(), | |
378 | date=fctx.date(), |
|
366 | date=fctx.date(), | |
379 |
parent=self.siblings(f |
|
367 | parent=self.siblings(fctx.parents(), file=f), | |
380 |
child=self.siblings(f |
|
368 | child=self.siblings(fctx.children(), file=f), | |
381 | rename=self.renamelink(fl, n), |
|
369 | rename=self.renamelink(fl, n), | |
382 | permissions=fctx.manifest().execf(f)) |
|
370 | permissions=fctx.manifest().execf(f)) | |
383 |
|
371 | |||
@@ -413,8 +401,8 b' class hgweb(object):' | |||||
413 | author=fctx.user(), |
|
401 | author=fctx.user(), | |
414 | date=fctx.date(), |
|
402 | date=fctx.date(), | |
415 | rename=self.renamelink(fl, n), |
|
403 | rename=self.renamelink(fl, n), | |
416 |
parent=self.siblings(f |
|
404 | parent=self.siblings(fctx.parents(), file=f), | |
417 |
child=self.siblings(f |
|
405 | child=self.siblings(fctx.children(), file=f), | |
418 | permissions=fctx.manifest().execf(f)) |
|
406 | permissions=fctx.manifest().execf(f)) | |
419 |
|
407 | |||
420 | def manifest(self, ctx, path): |
|
408 | def manifest(self, ctx, path): | |
@@ -565,23 +553,20 b' class hgweb(object):' | |||||
565 | archives=self.archivelist("tip")) |
|
553 | archives=self.archivelist("tip")) | |
566 |
|
554 | |||
567 | def filediff(self, file, changeset): |
|
555 | def filediff(self, file, changeset): | |
568 |
c |
|
556 | ctx = self.repo.changectx(changeset) | |
569 | n = self.repo.lookup(changeset) |
|
557 | n = ctx.node() | |
570 | changeset = hex(n) |
|
558 | parents = ctx.parents() | |
571 |
p1 = |
|
559 | p1 = parents[0].node() | |
572 | cs = cl.read(n) |
|
|||
573 | mf = self.repo.manifest.read(cs[0]) |
|
|||
574 |
|
560 | |||
575 | def diff(**map): |
|
561 | def diff(**map): | |
576 | yield self.diff(p1, n, [file]) |
|
562 | yield self.diff(p1, n, [file]) | |
577 |
|
563 | |||
578 | yield self.t("filediff", |
|
564 | yield self.t("filediff", | |
579 | file=file, |
|
565 | file=file, | |
580 |
|
|
566 | node=hex(n), | |
581 |
|
|
567 | rev=ctx.rev(), | |
582 |
|
|
568 | parent=self.siblings(parents), | |
583 |
|
|
569 | child=self.siblings(ctx.children()), | |
584 | child=self.siblings(cl.children(n), cl.rev), |
|
|||
585 | diff=diff) |
|
570 | diff=diff) | |
586 |
|
571 | |||
587 | archive_specs = { |
|
572 | archive_specs = { |
General Comments 0
You need to be logged in to leave comments.
Login now