Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgweb_mod.py @ 6203:3a75fcc96dac
hgweb/annotate: handle binary files like hgweb/file
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 02 Mar 2008 23:32:13 +0100 |
parents | 2ab54f48dbe8 |
children | f89fd07fc51d |
comparison
equal
deleted
inserted
replaced
6202:0ab0da2215d7 | 6203:3a75fcc96dac |
---|---|
652 fl = fctx.filelog() | 652 fl = fctx.filelog() |
653 parity = paritygen(self.stripecount) | 653 parity = paritygen(self.stripecount) |
654 | 654 |
655 def annotate(**map): | 655 def annotate(**map): |
656 last = None | 656 last = None |
657 lines = enumerate(fctx.annotate(follow=True, linenumber=True)) | 657 if util.binary(fctx.data()): |
658 mt = (mimetypes.guess_type(fctx.path())[0] | |
659 or 'application/octet-stream') | |
660 lines = enumerate([((fctx.filectx(fctx.filerev()), 1), | |
661 '(binary:%s)' % mt)]) | |
662 else: | |
663 lines = enumerate(fctx.annotate(follow=True, linenumber=True)) | |
658 for lineno, ((f, targetline), l) in lines: | 664 for lineno, ((f, targetline), l) in lines: |
659 fnode = f.filenode() | 665 fnode = f.filenode() |
660 name = self.repo.ui.shortuser(f.user()) | 666 name = self.repo.ui.shortuser(f.user()) |
661 | 667 |
662 if last != fnode: | 668 if last != fnode: |