equal
deleted
inserted
replaced
34 revset, |
34 revset, |
35 revsetlang, |
35 revsetlang, |
36 scmutil, |
36 scmutil, |
37 smartset, |
37 smartset, |
38 templater, |
38 templater, |
39 util, |
39 ) |
|
40 |
|
41 from ..utils import ( |
|
42 stringutil, |
40 ) |
43 ) |
41 |
44 |
42 from . import ( |
45 from . import ( |
43 webutil, |
46 webutil, |
44 ) |
47 ) |
119 text = fctx.data() |
122 text = fctx.data() |
120 mt = 'application/binary' |
123 mt = 'application/binary' |
121 if guessmime: |
124 if guessmime: |
122 mt = mimetypes.guess_type(path)[0] |
125 mt = mimetypes.guess_type(path)[0] |
123 if mt is None: |
126 if mt is None: |
124 if util.binary(text): |
127 if stringutil.binary(text): |
125 mt = 'application/binary' |
128 mt = 'application/binary' |
126 else: |
129 else: |
127 mt = 'text/plain' |
130 mt = 'text/plain' |
128 if mt.startswith('text/'): |
131 if mt.startswith('text/'): |
129 mt += '; charset="%s"' % encoding.encoding |
132 mt += '; charset="%s"' % encoding.encoding |
139 f = fctx.path() |
142 f = fctx.path() |
140 text = fctx.data() |
143 text = fctx.data() |
141 parity = paritygen(web.stripecount) |
144 parity = paritygen(web.stripecount) |
142 ishead = fctx.filerev() in fctx.filelog().headrevs() |
145 ishead = fctx.filerev() in fctx.filelog().headrevs() |
143 |
146 |
144 if util.binary(text): |
147 if stringutil.binary(text): |
145 mt = mimetypes.guess_type(f)[0] or 'application/octet-stream' |
148 mt = mimetypes.guess_type(f)[0] or 'application/octet-stream' |
146 text = '(binary:%s)' % mt |
149 text = '(binary:%s)' % mt |
147 |
150 |
148 def lines(): |
151 def lines(): |
149 for lineno, t in enumerate(text.splitlines(True)): |
152 for lineno, t in enumerate(text.splitlines(True)): |