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