# HG changeset patch # User Alexander Plavin # Date 2013-09-03 16:02:53 # Node ID 145636d31bb4bc68058dcc75398e45d61f681c3b # Parent 60ce14e41fafadad64d4b4eecc683e8c14de0ad6 hgweb: import the whole util module in webcommands instead of just one function This is to allow using other functions from this module easily. diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -9,7 +9,7 @@ import os, mimetypes, re, cgi, copy 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 @@ def rawfile(web, req, tmpl): 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 @@ def _filerevision(web, tmpl, fctx): 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 @@ def comparison(web, req, tmpl): 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(web, req, tmpl): 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),