# HG changeset patch # User Thomas Arendsen Hein # Date 2008-03-02 22:32:13 # Node ID 3a75fcc96dac682dae610644bae12faf0cfa9aa2 # Parent 0ab0da2215d7559de2cd8b97818da1ae3fa76658 hgweb/annotate: handle binary files like hgweb/file diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -654,7 +654,13 @@ class hgweb(object): 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())