[PATCH 2 of 4] hgweb: alias ui module as uimod

Yuya Nishihara yuya at tcha.org
Wed Nov 18 09:44:24 CST 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1446353912 -32400
#      Sun Nov 01 13:58:32 2015 +0900
# Node ID 1dcae8986f775c1fbaafea23156c46d97f66f44c
# Parent  d66415991a1f94da2f7f1e24793746a48deb3df6
hgweb: alias ui module as uimod

It will be enforced by the import checker.

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -8,7 +8,8 @@
 
 import contextlib
 import os
-from mercurial import ui, hg, hook, error, encoding, templater, util, repoview
+from mercurial import hg, hook, error, encoding, templater, util, repoview
+from mercurial import ui as uimod
 from mercurial.templatefilters import websub
 from common import ErrorResponse, permhooks, caching
 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
@@ -195,7 +196,7 @@ class hgweb(object):
             if baseui:
                 u = baseui.copy()
             else:
-                u = ui.ui()
+                u = uimod.ui()
             r = hg.repository(u, repo)
         else:
             # we trust caller to give us a private copy
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -8,7 +8,8 @@
 
 import os, re, time
 from mercurial.i18n import _
-from mercurial import ui, hg, scmutil, util, templater
+from mercurial import hg, scmutil, util, templater
+from mercurial import ui as uimod
 from mercurial import error, encoding
 from common import ErrorResponse, get_mtime, staticfile, paritygen, ismember, \
                    get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
@@ -108,7 +109,7 @@ class hgwebdir(object):
         if self.baseui:
             u = self.baseui.copy()
         else:
-            u = ui.ui()
+            u = uimod.ui()
             u.setconfig('ui', 'report_untrusted', 'off', 'hgwebdir')
             u.setconfig('ui', 'nontty', 'true', 'hgwebdir')
             # displaying bundling progress bar while serving feels wrong and may
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -8,7 +8,8 @@
 
 import os, copy
 import re
-from mercurial import match, patch, error, ui, util, pathutil, context
+from mercurial import match, patch, error, util, pathutil, context
+from mercurial import ui as uimod
 from mercurial.i18n import _
 from mercurial.node import hex, nullid, short
 from mercurial.templatefilters import revescape
@@ -537,7 +538,7 @@ class sessionvars(object):
             yield {'name': key, 'value': str(value), 'separator': separator}
             separator = '&'
 
-class wsgiui(ui.ui):
+class wsgiui(uimod.ui):
     # default termwidth breaks under mod_wsgi
     def termwidth(self):
         return 80


More information about the Mercurial-devel mailing list