Patchwork [1,of,5,V4] hgweb: import the whole util module in webcommands instead of just one function

login
register
mail settings
Submitter Alexander Plavin
Date Sept. 4, 2013, 7:13 p.m.
Message ID <20d30e47780261b1c11f.1378321984@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/2327/
State Accepted
Commit 145636d31bb4bc68058dcc75398e45d61f681c3b
Delegated to: Kevin Bullock
Headers show

Comments

Alexander Plavin - Sept. 4, 2013, 7:13 p.m.
# HG changeset patch
# User Alexander Plavin <alexander@plav.in>
# Date 1378224173 -14400
#      Tue Sep 03 20:02:53 2013 +0400
# Node ID 20d30e47780261b1c11f20cfd619820a616c1d86
# Parent  b9c27aecca8521161a28279e595e7d6aca82245d
hgweb: import the whole util module in webcommands instead of just one function

This is to allow using other functions from this module easily.

Patch

diff -r b9c27aecca85 -r 20d30e477802 mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Wed Aug 07 01:16:14 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
@@ -59,7 +59,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
 
@@ -71,7 +71,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
 
@@ -671,7 +671,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'
@@ -729,7 +729,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),