Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgweb_mod.py @ 5269:46c5e1ee8aaa
Added support for the Atom syndication format
author | Robert Bachmann <rbach@rbach.priv.at> |
---|---|
date | Thu, 30 Aug 2007 16:42:17 +0200 |
parents | 79373ec3f27d |
children | 6e0f05f6f68d |
comparison
equal
deleted
inserted
replaced
5268:980da86fc66a | 5269:46c5e1ee8aaa |
---|---|
204 tn = None | 204 tn = None |
205 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f, | 205 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f, |
206 opts=diffopts), f, tn) | 206 opts=diffopts), f, tn) |
207 | 207 |
208 def changelog(self, ctx, shortlog=False): | 208 def changelog(self, ctx, shortlog=False): |
209 def changelist(**map): | 209 def changelist(limit=0,**map): |
210 cl = self.repo.changelog | 210 cl = self.repo.changelog |
211 l = [] # build a list in forward order for efficiency | 211 l = [] # build a list in forward order for efficiency |
212 for i in xrange(start, end): | 212 for i in xrange(start, end): |
213 ctx = self.repo.changectx(i) | 213 ctx = self.repo.changectx(i) |
214 n = ctx.node() | 214 n = ctx.node() |
224 "rev": i, | 224 "rev": i, |
225 "node": hex(n), | 225 "node": hex(n), |
226 "tags": self.nodetagsdict(n), | 226 "tags": self.nodetagsdict(n), |
227 "branches": self.nodebranchdict(ctx)}) | 227 "branches": self.nodebranchdict(ctx)}) |
228 | 228 |
229 if limit > 0: | |
230 l = l[:limit] | |
231 | |
229 for e in l: | 232 for e in l: |
230 yield e | 233 yield e |
231 | 234 |
232 maxchanges = shortlog and self.maxshortchanges or self.maxchanges | 235 maxchanges = shortlog and self.maxshortchanges or self.maxchanges |
233 cl = self.repo.changelog | 236 cl = self.repo.changelog |
241 changenav = revnavgen(pos, maxchanges, count, self.repo.changectx) | 244 changenav = revnavgen(pos, maxchanges, count, self.repo.changectx) |
242 | 245 |
243 yield self.t(shortlog and 'shortlog' or 'changelog', | 246 yield self.t(shortlog and 'shortlog' or 'changelog', |
244 changenav=changenav, | 247 changenav=changenav, |
245 node=hex(cl.tip()), | 248 node=hex(cl.tip()), |
246 rev=pos, changesets=count, entries=changelist, | 249 rev=pos, changesets=count, |
250 entries=lambda **x: changelist(limit=0,**x), | |
251 latestentry=lambda **x: changelist(limit=1,**x), | |
247 archives=self.archivelist("tip")) | 252 archives=self.archivelist("tip")) |
248 | 253 |
249 def search(self, query): | 254 def search(self, query): |
250 | 255 |
251 def changelist(**map): | 256 def changelist(**map): |
342 start = max(0, pos - pagelen + 1) | 347 start = max(0, pos - pagelen + 1) |
343 end = min(count, start + pagelen) | 348 end = min(count, start + pagelen) |
344 pos = end - 1 | 349 pos = end - 1 |
345 parity = paritygen(self.stripecount, offset=start-end) | 350 parity = paritygen(self.stripecount, offset=start-end) |
346 | 351 |
347 def entries(**map): | 352 def entries(limit=0, **map): |
348 l = [] | 353 l = [] |
349 | 354 |
350 for i in xrange(start, end): | 355 for i in xrange(start, end): |
351 ctx = fctx.filectx(i) | 356 ctx = fctx.filectx(i) |
352 n = fl.node(i) | 357 n = fl.node(i) |
360 "rename": self.renamelink(fl, n), | 365 "rename": self.renamelink(fl, n), |
361 "parent": self.siblings(fctx.parents()), | 366 "parent": self.siblings(fctx.parents()), |
362 "child": self.siblings(fctx.children()), | 367 "child": self.siblings(fctx.children()), |
363 "desc": ctx.description()}) | 368 "desc": ctx.description()}) |
364 | 369 |
370 if limit > 0: | |
371 l = l[:limit] | |
372 | |
365 for e in l: | 373 for e in l: |
366 yield e | 374 yield e |
367 | 375 |
368 nodefunc = lambda x: fctx.filectx(fileid=x) | 376 nodefunc = lambda x: fctx.filectx(fileid=x) |
369 nav = revnavgen(pos, pagelen, count, nodefunc) | 377 nav = revnavgen(pos, pagelen, count, nodefunc) |
370 yield self.t("filelog", file=f, node=hex(fctx.node()), nav=nav, | 378 yield self.t("filelog", file=f, node=hex(fctx.node()), nav=nav, |
371 entries=entries) | 379 entries=lambda **x: entries(limit=0, **x), |
380 latestentry=lambda **x: entries(limit=1, **x)) | |
372 | 381 |
373 def filerevision(self, fctx): | 382 def filerevision(self, fctx): |
374 f = fctx.path() | 383 f = fctx.path() |
375 text = fctx.data() | 384 text = fctx.data() |
376 fl = fctx.filelog() | 385 fl = fctx.filelog() |
506 def tags(self): | 515 def tags(self): |
507 i = self.repo.tagslist() | 516 i = self.repo.tagslist() |
508 i.reverse() | 517 i.reverse() |
509 parity = paritygen(self.stripecount) | 518 parity = paritygen(self.stripecount) |
510 | 519 |
511 def entries(notip=False, **map): | 520 def entries(notip=False,limit=0, **map): |
521 count = 0 | |
512 for k, n in i: | 522 for k, n in i: |
513 if notip and k == "tip": | 523 if notip and k == "tip": |
514 continue | 524 continue |
525 if limit > 0 and count >= limit: | |
526 continue | |
527 count = count + 1 | |
515 yield {"parity": parity.next(), | 528 yield {"parity": parity.next(), |
516 "tag": k, | 529 "tag": k, |
517 "date": self.repo.changectx(n).date(), | 530 "date": self.repo.changectx(n).date(), |
518 "node": hex(n)} | 531 "node": hex(n)} |
519 | 532 |
520 yield self.t("tags", | 533 yield self.t("tags", |
521 node=hex(self.repo.changelog.tip()), | 534 node=hex(self.repo.changelog.tip()), |
522 entries=lambda **x: entries(False, **x), | 535 entries=lambda **x: entries(False,0, **x), |
523 entriesnotip=lambda **x: entries(True, **x)) | 536 entriesnotip=lambda **x: entries(True,0, **x), |
537 latestentry=lambda **x: entries(True,1, **x)) | |
524 | 538 |
525 def summary(self): | 539 def summary(self): |
526 i = self.repo.tagslist() | 540 i = self.repo.tagslist() |
527 i.reverse() | 541 i.reverse() |
528 | 542 |