862 parity = paritygen(web.stripecount) |
862 parity = paritygen(web.stripecount) |
863 diffopts = patch.difffeatureopts(web.repo.ui, untrusted=True, |
863 diffopts = patch.difffeatureopts(web.repo.ui, untrusted=True, |
864 section='annotate', whitespace=True) |
864 section='annotate', whitespace=True) |
865 |
865 |
866 def annotate(**map): |
866 def annotate(**map): |
867 last = None |
|
868 if util.binary(fctx.data()): |
867 if util.binary(fctx.data()): |
869 mt = (mimetypes.guess_type(fctx.path())[0] |
868 mt = (mimetypes.guess_type(fctx.path())[0] |
870 or 'application/octet-stream') |
869 or 'application/octet-stream') |
871 lines = enumerate([((fctx.filectx(fctx.filerev()), 1), |
870 lines = enumerate([((fctx.filectx(fctx.filerev()), 1), |
872 '(binary:%s)' % mt)]) |
871 '(binary:%s)' % mt)]) |
873 else: |
872 else: |
874 lines = enumerate(fctx.annotate(follow=True, linenumber=True, |
873 lines = enumerate(fctx.annotate(follow=True, linenumber=True, |
875 diffopts=diffopts)) |
874 diffopts=diffopts)) |
876 for lineno, ((f, targetline), l) in lines: |
875 for lineno, ((f, targetline), l) in lines: |
877 fnode = f.filenode() |
|
878 |
|
879 if last != fnode: |
|
880 last = fnode |
|
881 |
|
882 yield {"parity": next(parity), |
876 yield {"parity": next(parity), |
883 "node": f.hex(), |
877 "node": f.hex(), |
884 "rev": f.rev(), |
878 "rev": f.rev(), |
885 "author": f.user(), |
879 "author": f.user(), |
886 "desc": f.description(), |
880 "desc": f.description(), |