##// END OF EJS Templates
hgweb: use contexts, fix coding style
Benoit Boissinot -
r3973:b485a445 default
parent child Browse files
Show More
@@ -168,14 +168,10 b' class hgweb(object):'
168 168 yield self.t("diffline", line=l)
169 169
170 170 r = self.repo
171 cl = r.changelog
172 mf = r.manifest
173 change1 = cl.read(node1)
174 change2 = cl.read(node2)
175 mmap1 = mf.read(change1[0])
176 mmap2 = mf.read(change2[0])
177 date1 = util.datestr(change1[2])
178 date2 = util.datestr(change2[2])
171 c1 = r.changectx(node1)
172 c2 = r.changectx(node2)
173 date1 = util.datestr(c1.date())
174 date2 = util.datestr(c2.date())
179 175
180 176 modified, added, removed, deleted, unknown = r.status(node1, node2)[:5]
181 177 if files:
@@ -184,17 +180,17 b' class hgweb(object):'
184 180
185 181 diffopts = patch.diffopts(self.repo.ui, untrusted=True)
186 182 for f in modified:
187 to = r.file(f).read(mmap1[f])
188 tn = r.file(f).read(mmap2[f])
183 to = c1.filectx(f).data()
184 tn = c2.filectx(f).data()
189 185 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f,
190 186 opts=diffopts), f, tn)
191 187 for f in added:
192 188 to = None
193 tn = r.file(f).read(mmap2[f])
189 tn = c2.filectx(f).data()
194 190 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f,
195 191 opts=diffopts), f, tn)
196 192 for f in removed:
197 to = r.file(f).read(mmap1[f])
193 to = c1.filectx(f).data()
198 194 tn = None
199 195 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f,
200 196 opts=diffopts), f, tn)
@@ -493,8 +489,6 b' class hgweb(object):'
493 489 archives=self.archivelist(hex(node)))
494 490
495 491 def tags(self):
496 cl = self.repo.changelog
497
498 492 i = self.repo.tagslist()
499 493 i.reverse()
500 494
@@ -505,7 +499,7 b' class hgweb(object):'
505 499 continue
506 500 yield {"parity": self.stripes(parity),
507 501 "tag": k,
508 "date": cl.read(n)[2],
502 "date": self.repo.changectx(n).date(),
509 503 "node": hex(n)}
510 504 parity += 1
511 505
@@ -515,8 +509,6 b' class hgweb(object):'
515 509 entriesnotip=lambda **x: entries(True, **x))
516 510
517 511 def summary(self):
518 cl = self.repo.changelog
519
520 512 i = self.repo.tagslist()
521 513 i.reverse()
522 514
@@ -531,14 +523,11 b' class hgweb(object):'
531 523 if count > 10: # limit to 10 tags
532 524 break;
533 525
534 c = cl.read(n)
535 t = c[2]
536
537 526 yield self.t("tagentry",
538 parity = self.stripes(parity),
539 tag = k,
540 node = hex(n),
541 date = t)
527 parity=self.stripes(parity),
528 tag=k,
529 node=hex(n),
530 date=self.repo.changectx(n).date())
542 531 parity += 1
543 532
544 533 def heads(**map):
@@ -560,40 +549,38 b' class hgweb(object):'
560 549
561 550 def changelist(**map):
562 551 parity = 0
563 cl = self.repo.changelog
564 552 l = [] # build a list in forward order for efficiency
565 553 for i in xrange(start, end):
566 n = cl.node(i)
567 changes = cl.read(n)
568 hn = hex(n)
569 t = changes[2]
554 ctx = self.repo.changectx(i)
555 hn = hex(ctx.node())
570 556
571 557 l.insert(0, self.t(
572 558 'shortlogentry',
573 parity = parity,
574 author = changes[1],
575 desc = changes[4],
576 date = t,
577 rev = i,
578 node = hn))
559 parity=parity,
560 author=ctx.user(),
561 desc=ctx.description(),
562 date=ctx.date(),
563 rev=i,
564 node=hn))
579 565 parity = 1 - parity
580 566
581 567 yield l
582 568
569 cl = self.repo.changelog
583 570 count = cl.count()
584 571 start = max(0, count - self.maxchanges)
585 572 end = min(count, start + self.maxchanges)
586 573
587 574 yield self.t("summary",
588 desc = self.config("web", "description", "unknown"),
589 owner = (self.config("ui", "username") or # preferred
590 self.config("web", "contact") or # deprecated
591 self.config("web", "author", "unknown")), # also
592 lastchange = cl.read(cl.tip())[2],
593 tags = tagentries,
594 heads = heads,
595 shortlog = changelist,
596 node = hex(cl.tip()),
575 desc=self.config("web", "description", "unknown"),
576 owner=(self.config("ui", "username") or # preferred
577 self.config("web", "contact") or # deprecated
578 self.config("web", "author", "unknown")), # also
579 lastchange=cl.read(cl.tip())[2],
580 tags=tagentries,
581 heads=heads,
582 shortlog=changelist,
583 node=hex(cl.tip()),
597 584 archives=self.archivelist("tip"))
598 585
599 586 def filediff(self, fctx):
General Comments 0
You need to be logged in to leave comments. Login now