Mercurial > hg-stable
changeset 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 | 0ab0da2215d7 |
children | f8a86ea7521b |
files | mercurial/hgweb/hgweb_mod.py |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Sun Mar 02 20:54:00 2008 +0100 +++ b/mercurial/hgweb/hgweb_mod.py Sun Mar 02 23:32:13 2008 +0100 @@ -654,7 +654,13 @@ def annotate(**map): last = None - lines = enumerate(fctx.annotate(follow=True, linenumber=True)) + if util.binary(fctx.data()): + mt = (mimetypes.guess_type(fctx.path())[0] + or 'application/octet-stream') + lines = enumerate([((fctx.filectx(fctx.filerev()), 1), + '(binary:%s)' % mt)]) + else: + lines = enumerate(fctx.annotate(follow=True, linenumber=True)) for lineno, ((f, targetline), l) in lines: fnode = f.filenode() name = self.repo.ui.shortuser(f.user())