##// END OF EJS Templates
hgweb: import the whole util module in webcommands instead of just one function...
Alexander Plavin -
r19657:145636d3 default
parent child Browse files
Show More
@@ -9,7 +9,7 b' import os, mimetypes, re, cgi, copy'
9 import webutil
9 import webutil
10 from mercurial import error, encoding, archival, templater, templatefilters
10 from mercurial import error, encoding, archival, templater, templatefilters
11 from mercurial.node import short, hex, nullid
11 from mercurial.node import short, hex, nullid
12 from mercurial.util import binary
12 from mercurial import util
13 from common import paritygen, staticfile, get_contact, ErrorResponse
13 from common import paritygen, staticfile, get_contact, ErrorResponse
14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
15 from mercurial import graphmod, patch
15 from mercurial import graphmod, patch
@@ -57,7 +57,7 b' def rawfile(web, req, tmpl):'
57 if guessmime:
57 if guessmime:
58 mt = mimetypes.guess_type(path)[0]
58 mt = mimetypes.guess_type(path)[0]
59 if mt is None:
59 if mt is None:
60 mt = binary(text) and 'application/binary' or 'text/plain'
60 mt = util.binary(text) and 'application/binary' or 'text/plain'
61 if mt.startswith('text/'):
61 if mt.startswith('text/'):
62 mt += '; charset="%s"' % encoding.encoding
62 mt += '; charset="%s"' % encoding.encoding
63
63
@@ -69,7 +69,7 b' def _filerevision(web, tmpl, fctx):'
69 text = fctx.data()
69 text = fctx.data()
70 parity = paritygen(web.stripecount)
70 parity = paritygen(web.stripecount)
71
71
72 if binary(text):
72 if util.binary(text):
73 mt = mimetypes.guess_type(f)[0] or 'application/octet-stream'
73 mt = mimetypes.guess_type(f)[0] or 'application/octet-stream'
74 text = '(binary:%s)' % mt
74 text = '(binary:%s)' % mt
75
75
@@ -637,7 +637,7 b' def comparison(web, req, tmpl):'
637 context = parsecontext(web.config('web', 'comparisoncontext', '5'))
637 context = parsecontext(web.config('web', 'comparisoncontext', '5'))
638
638
639 def filelines(f):
639 def filelines(f):
640 if binary(f.data()):
640 if util.binary(f.data()):
641 mt = mimetypes.guess_type(f.path())[0]
641 mt = mimetypes.guess_type(f.path())[0]
642 if not mt:
642 if not mt:
643 mt = 'application/octet-stream'
643 mt = 'application/octet-stream'
@@ -695,7 +695,7 b' def annotate(web, req, tmpl):'
695
695
696 def annotate(**map):
696 def annotate(**map):
697 last = None
697 last = None
698 if binary(fctx.data()):
698 if util.binary(fctx.data()):
699 mt = (mimetypes.guess_type(fctx.path())[0]
699 mt = (mimetypes.guess_type(fctx.path())[0]
700 or 'application/octet-stream')
700 or 'application/octet-stream')
701 lines = enumerate([((fctx.filectx(fctx.filerev()), 1),
701 lines = enumerate([((fctx.filectx(fctx.filerev()), 1),
General Comments 0
You need to be logged in to leave comments. Login now