Show More
@@ -183,7 +183,7 def staticfile(directory, fname, res): | |||||
183 | try: |
|
183 | try: | |
184 | os.stat(path) |
|
184 | os.stat(path) | |
185 | ct = pycompat.sysbytes( |
|
185 | ct = pycompat.sysbytes( | |
186 | mimetypes.guess_type(pycompat.fsdecode(path))[0] or "text/plain") |
|
186 | mimetypes.guess_type(pycompat.fsdecode(path))[0] or r"text/plain") | |
187 | with open(path, 'rb') as fh: |
|
187 | with open(path, 'rb') as fh: | |
188 | data = fh.read() |
|
188 | data = fh.read() | |
189 |
|
189 |
@@ -151,7 +151,7 def _filerevision(web, fctx): | |||||
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): | |
@@ -864,7 +864,7 def comparison(web): | |||||
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 | |||
@@ -952,7 +952,7 def annotate(web): | |||||
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: |
General Comments 0
You need to be logged in to leave comments.
Login now