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