##// END OF EJS Templates
hgweb: use filectx.annotate instead of filelog
Brendan Cully -
r3173:3466bd7b default
parent child Browse files
Show More
@@ -391,32 +391,16 b' class hgweb(object):'
391 391 permissions=self.repo.manifest.read(mfn).execf(f))
392 392
393 393 def fileannotate(self, f, node):
394 bcache = {}
395 ncache = {}
396 fl = self.repo.file(f)
397 n = fl.lookup(node)
398 node = hex(n)
399 changerev = fl.linkrev(n)
400
401 cl = self.repo.changelog
402 cn = cl.node(changerev)
403 cs = cl.read(cn)
404 mfn = cs[0]
394 fctx = self.repo.filectx(f, fileid=node)
395 n = fctx.filenode()
396 fl = fctx.filelog()
405 397
406 398 def annotate(**map):
407 399 parity = 0
408 400 last = None
409 for r, l in fl.annotate(n):
410 try:
411 cnode = ncache[r]
412 except KeyError:
413 cnode = ncache[r] = self.repo.changelog.node(r)
414
415 try:
416 name = bcache[r]
417 except KeyError:
418 cl = self.repo.changelog.read(cnode)
419 bcache[r] = name = self.repo.ui.shortuser(cl[1])
401 for f, l in fctx.annotate():
402 cnode = f.node()
403 name = self.repo.ui.shortuser(f.user())
420 404
421 405 if last != cnode:
422 406 parity = 1 - parity
@@ -424,9 +408,9 b' class hgweb(object):'
424 408
425 409 yield {"parity": parity,
426 410 "node": hex(cnode),
427 "rev": r,
411 "rev": f.rev(),
428 412 "author": name,
429 "file": f,
413 "file": f.path(),
430 414 "line": l}
431 415
432 416 yield self.t("fileannotate",
@@ -434,15 +418,15 b' class hgweb(object):'
434 418 filenode=node,
435 419 annotate=annotate,
436 420 path=_up(f),
437 rev=changerev,
438 node=hex(cn),
439 manifest=hex(mfn),
440 author=cs[1],
441 date=cs[2],
421 rev=fctx.rev(),
422 node=hex(n),
423 manifest=hex(fctx.changectx().changeset()[0]),
424 author=fctx.user(),
425 date=fctx.date(),
442 426 rename=self.renamelink(fl, n),
443 427 parent=self.siblings(fl.parents(n), fl.rev, file=f),
444 428 child=self.siblings(fl.children(n), fl.rev, file=f),
445 permissions=self.repo.manifest.read(mfn).execf(f))
429 permissions=fctx.manifest().execf(f))
446 430
447 431 def manifest(self, mnode, path):
448 432 man = self.repo.manifest
General Comments 0
You need to be logged in to leave comments. Login now