hgweb: import the whole util module in webcommands instead of just one function
This is to allow using other functions from this module easily.
--- a/mercurial/hgweb/webcommands.py Wed Sep 04 19:40:04 2013 +0400
+++ b/mercurial/hgweb/webcommands.py Tue Sep 03 20:02:53 2013 +0400
@@ -9,7 +9,7 @@
import webutil
from mercurial import error, encoding, archival, templater, templatefilters
from mercurial.node import short, hex, nullid
-from mercurial.util import binary
+from mercurial import util
from common import paritygen, staticfile, get_contact, ErrorResponse
from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
from mercurial import graphmod, patch
@@ -57,7 +57,7 @@
if guessmime:
mt = mimetypes.guess_type(path)[0]
if mt is None:
- mt = binary(text) and 'application/binary' or 'text/plain'
+ mt = util.binary(text) and 'application/binary' or 'text/plain'
if mt.startswith('text/'):
mt += '; charset="%s"' % encoding.encoding
@@ -69,7 +69,7 @@
text = fctx.data()
parity = paritygen(web.stripecount)
- if binary(text):
+ if util.binary(text):
mt = mimetypes.guess_type(f)[0] or 'application/octet-stream'
text = '(binary:%s)' % mt
@@ -637,7 +637,7 @@
context = parsecontext(web.config('web', 'comparisoncontext', '5'))
def filelines(f):
- if binary(f.data()):
+ if util.binary(f.data()):
mt = mimetypes.guess_type(f.path())[0]
if not mt:
mt = 'application/octet-stream'
@@ -695,7 +695,7 @@
def annotate(**map):
last = None
- if binary(fctx.data()):
+ if util.binary(fctx.data()):
mt = (mimetypes.guess_type(fctx.path())[0]
or 'application/octet-stream')
lines = enumerate([((fctx.filectx(fctx.filerev()), 1),