##// END OF EJS Templates
hgweb: Configurable zebra stripes...
Frank Kingswood -
r2666:ebf033bc default
parent child Browse files
Show More
@@ -440,6 +440,9 b' web::'
440 440 push_ssl;;
441 441 Whether to require that inbound pushes be transported over SSL to
442 442 prevent password sniffing. Default is true.
443 stripes;;
444 How many lines a "zebra stripe" should span in multiline output.
445 Default is 1; set to 0 to disable.
443 446 style;;
444 447 Which template map style to use.
445 448 templates;;
@@ -37,6 +37,7 b' class hgweb(object):'
37 37 self.mtime = -1
38 38 self.reponame = name
39 39 self.archives = 'zip', 'gz', 'bz2'
40 self.stripecount = 1
40 41 self.templatepath = self.repo.ui.config("web", "templates",
41 42 templater.templatepath())
42 43
@@ -46,6 +47,7 b' class hgweb(object):'
46 47 self.mtime = mtime
47 48 self.repo = hg.repository(self.repo.ui, self.repo.root)
48 49 self.maxchanges = int(self.repo.ui.config("web", "maxchanges", 10))
50 self.stripecount = int(self.repo.ui.config("web", "stripes", 1))
49 51 self.maxfiles = int(self.repo.ui.config("web", "maxfiles", 10))
50 52 self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
51 53
@@ -265,7 +267,7 b' class hgweb(object):'
265 267 hn = hex(n)
266 268
267 269 yield self.t('searchentry',
268 parity=count & 1,
270 parity=self.stripes(count),
269 271 author=changes[1],
270 272 parent=self.siblings(cl.parents(n), cl.rev),
271 273 child=self.siblings(cl.children(n), cl.rev),
@@ -376,7 +378,7 b' class hgweb(object):'
376 378 for l, t in enumerate(text.splitlines(1)):
377 379 yield {"line": t,
378 380 "linenumber": "% 6d" % (l + 1),
379 "parity": l & 1}
381 "parity": self.stripes(l)}
380 382
381 383 yield self.t("filerevision",
382 384 file=f,
@@ -409,7 +411,7 b' class hgweb(object):'
409 411 mfn = cs[0]
410 412
411 413 def annotate(**map):
412 parity = 1
414 parity = 0
413 415 last = None
414 416 for r, l in fl.annotate(n):
415 417 try:
@@ -489,10 +491,10 b' class hgweb(object):'
489 491 yield {"file": full,
490 492 "manifest": mnode,
491 493 "filenode": hex(fnode),
492 "parity": parity,
494 "parity": self.stripes(parity),
493 495 "basename": f,
494 496 "permissions": mff[full]}
495 parity = 1 - parity
497 parity += 1
496 498
497 499 def dirlist(**map):
498 500 parity = 0
@@ -503,11 +505,11 b' class hgweb(object):'
503 505 if fnode:
504 506 continue
505 507
506 yield {"parity": parity,
508 yield {"parity": self.stripes(parity),
507 509 "path": os.path.join(path, f),
508 510 "manifest": mnode,
509 511 "basename": f[:-1]}
510 parity = 1 - parity
512 parity += 1
511 513
512 514 yield self.t("manifest",
513 515 manifest=mnode,
@@ -530,12 +532,12 b' class hgweb(object):'
530 532 parity = 0
531 533 for k,n in i:
532 534 if notip and k == "tip": continue
533 yield {"parity": parity,
535 yield {"parity": self.stripes(parity),
534 536 "tag": k,
535 537 "tagmanifest": hex(cl.read(n)[0]),
536 538 "date": cl.read(n)[2],
537 539 "node": hex(n)}
538 parity = 1 - parity
540 parity += 1
539 541
540 542 yield self.t("tags",
541 543 manifest=hex(mf),
@@ -565,12 +567,12 b' class hgweb(object):'
565 567 t = c[2]
566 568
567 569 yield self.t("tagentry",
568 parity = parity,
570 parity = self.stripes(parity),
569 571 tag = k,
570 572 node = hex(n),
571 573 date = t,
572 574 tagmanifest = hex(m))
573 parity = 1 - parity
575 parity += 1
574 576
575 577 def changelist(**map):
576 578 parity = 0
@@ -752,6 +754,13 b' class hgweb(object):'
752 754 else:
753 755 req.write(self.t("error"))
754 756
757 def stripes(self, parity):
758 "make horizontal stripes for easier reading"
759 if self.stripecount:
760 return (1 + parity / self.stripecount) & 1
761 else:
762 return 0
763
755 764 def do_changelog(self, req):
756 765 hi = self.repo.changelog.count() - 1
757 766 if req.form.has_key('rev'):
General Comments 0
You need to be logged in to leave comments. Login now