comparison mercurial/hgweb/hgweb_mod.py @ 5962:0011316fbe0e

hgweb: get rid of raw-related code in hgweb.filerevision()
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 28 Jan 2008 13:42:40 +0100
parents c301f15c965a
children 5be210afe1b8
comparison
equal deleted inserted replaced
5961:ed4d55c2366f 5962:0011316fbe0e
583 text = fctx.data() 583 text = fctx.data()
584 fl = fctx.filelog() 584 fl = fctx.filelog()
585 n = fctx.filenode() 585 n = fctx.filenode()
586 parity = paritygen(self.stripecount) 586 parity = paritygen(self.stripecount)
587 587
588 mt = mimetypes.guess_type(f)[0]
589 rawtext = text
590 if util.binary(text): 588 if util.binary(text):
591 mt = mt or 'application/octet-stream' 589 mt = mimetypes.guess_type(f)[0] or 'application/octet-stream'
592 text = "(binary:%s)" % mt 590 text = '(binary:%s)' % mt
593 mt = mt or 'text/plain'
594 591
595 def lines(): 592 def lines():
596 for l, t in enumerate(text.splitlines(1)): 593 for l, t in enumerate(text.splitlines(1)):
597 yield {"line": t, 594 yield {"line": t,
598 "linenumber": "% 6d" % (l + 1), 595 "linenumber": "% 6d" % (l + 1),
600 597
601 return tmpl("filerevision", 598 return tmpl("filerevision",
602 file=f, 599 file=f,
603 path=_up(f), 600 path=_up(f),
604 text=lines(), 601 text=lines(),
605 raw=rawtext,
606 mimetype=mt,
607 rev=fctx.rev(), 602 rev=fctx.rev(),
608 node=hex(fctx.node()), 603 node=hex(fctx.node()),
609 author=fctx.user(), 604 author=fctx.user(),
610 date=fctx.date(), 605 date=fctx.date(),
611 desc=fctx.description(), 606 desc=fctx.description(),