equal
deleted
inserted
replaced
149 ishead = fctx.filenode() in fctx.filelog().heads() |
149 ishead = fctx.filenode() in fctx.filelog().heads() |
150 |
150 |
151 if stringutil.binary(text): |
151 if stringutil.binary(text): |
152 mt = pycompat.sysbytes( |
152 mt = pycompat.sysbytes( |
153 mimetypes.guess_type(pycompat.fsdecode(f))[0] |
153 mimetypes.guess_type(pycompat.fsdecode(f))[0] |
154 or 'application/octet-stream') |
154 or r'application/octet-stream') |
155 text = '(binary:%s)' % mt |
155 text = '(binary:%s)' % mt |
156 |
156 |
157 def lines(context): |
157 def lines(context): |
158 for lineno, t in enumerate(text.splitlines(True)): |
158 for lineno, t in enumerate(text.splitlines(True)): |
159 yield {"line": t, |
159 yield {"line": t, |
862 |
862 |
863 def filelines(f): |
863 def filelines(f): |
864 if f.isbinary(): |
864 if f.isbinary(): |
865 mt = pycompat.sysbytes( |
865 mt = pycompat.sysbytes( |
866 mimetypes.guess_type(pycompat.fsdecode(f.path()))[0] |
866 mimetypes.guess_type(pycompat.fsdecode(f.path()))[0] |
867 or 'application/octet-stream') |
867 or r'application/octet-stream') |
868 return [_('(binary file %s, hash: %s)') % (mt, hex(f.filenode()))] |
868 return [_('(binary file %s, hash: %s)') % (mt, hex(f.filenode()))] |
869 return f.data().splitlines() |
869 return f.data().splitlines() |
870 |
870 |
871 fctx = None |
871 fctx = None |
872 parent = ctx.p1() |
872 parent = ctx.p1() |
950 |
950 |
951 def annotate(context): |
951 def annotate(context): |
952 if fctx.isbinary(): |
952 if fctx.isbinary(): |
953 mt = pycompat.sysbytes( |
953 mt = pycompat.sysbytes( |
954 mimetypes.guess_type(pycompat.fsdecode(fctx.path()))[0] |
954 mimetypes.guess_type(pycompat.fsdecode(fctx.path()))[0] |
955 or 'application/octet-stream') |
955 or r'application/octet-stream') |
956 lines = [dagop.annotateline(fctx=fctx.filectx(fctx.filerev()), |
956 lines = [dagop.annotateline(fctx=fctx.filectx(fctx.filerev()), |
957 lineno=1, text='(binary:%s)' % mt)] |
957 lineno=1, text='(binary:%s)' % mt)] |
958 else: |
958 else: |
959 lines = webutil.annotate(web.req, fctx, web.repo.ui) |
959 lines = webutil.annotate(web.req, fctx, web.repo.ui) |
960 |
960 |