# HG changeset patch # User Yuya Nishihara # Date 1446296860 -32400 # Node ID 37fcfe52c68ce825d8cebfeaa0fb760c5eabf794 # Parent eac72c1e1e0d3ccb1053b26cbf176f5676d6c719 hgweb: use absolute_import diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/__init__.py --- a/mercurial/hgweb/__init__.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/__init__.py Sat Oct 31 22:07:40 2015 +0900 @@ -6,8 +6,14 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. +from __future__ import absolute_import + import os -import hgweb_mod, hgwebdir_mod + +from . import ( + hgweb_mod, + hgwebdir_mod, +) def hgweb(config, name=None, baseui=None): '''create an hgweb wsgi object diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/common.py Sat Oct 31 22:07:40 2015 +0900 @@ -6,8 +6,12 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. +from __future__ import absolute_import + import BaseHTTPServer -import errno, mimetypes, os +import errno +import mimetypes +import os HTTP_OK = 200 HTTP_NOT_MODIFIED = 304 diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/hgweb_mod.py Sat Oct 31 22:07:40 2015 +0900 @@ -6,16 +6,41 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. +from __future__ import absolute_import + import contextlib import os -from mercurial import hg, hook, error, encoding, templater, util, repoview -from mercurial import ui as uimod -from mercurial import templatefilters -from common import ErrorResponse, permhooks, caching -from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST -from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR -from request import wsgirequest -import webcommands, protocol, webutil, wsgicgi + +from .common import ( + ErrorResponse, + HTTP_BAD_REQUEST, + HTTP_NOT_FOUND, + HTTP_NOT_MODIFIED, + HTTP_OK, + HTTP_SERVER_ERROR, + caching, + permhooks, +) +from .request import wsgirequest + +from .. import ( + encoding, + error, + hg, + hook, + repoview, + templatefilters, + templater, + ui as uimod, + util, +) + +from . import ( + protocol, + webcommands, + webutil, + wsgicgi, +) perms = { 'changegroup': 'pull', diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/hgwebdir_mod.py Sat Oct 31 22:07:40 2015 +0900 @@ -6,16 +6,42 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import os, re, time -from mercurial.i18n import _ -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 -import hgweb_mod -from request import wsgirequest -import webutil, wsgicgi +from __future__ import absolute_import + +import os +import re +import time + +from ..i18n import _ + +from .common import ( + ErrorResponse, + HTTP_NOT_FOUND, + HTTP_OK, + HTTP_SERVER_ERROR, + get_contact, + get_mtime, + ismember, + paritygen, + staticfile, +) +from .request import wsgirequest + +from .. import ( + encoding, + error, + hg, + scmutil, + templater, + ui as uimod, + util, +) + +from . import ( + hgweb_mod, + webutil, + wsgicgi, +) def cleannames(items): return [(util.pconvert(name).strip('/'), path) for name, path in items] diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/protocol.py --- a/mercurial/hgweb/protocol.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/protocol.py Sat Oct 31 22:07:40 2015 +0900 @@ -5,9 +5,21 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import cgi, cStringIO, zlib, urllib -from mercurial import util, wireproto -from common import HTTP_OK +from __future__ import absolute_import + +import cStringIO +import cgi +import urllib +import zlib + +from .common import ( + HTTP_OK, +) + +from .. import ( + util, + wireproto, +) HGTYPE = 'application/mercurial-0.1' HGERRTYPE = 'application/hg-error' diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/request.py Sat Oct 31 22:07:40 2015 +0900 @@ -6,9 +6,21 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import socket, cgi, errno -from mercurial import util -from common import ErrorResponse, statusmessage, HTTP_NOT_MODIFIED +from __future__ import absolute_import + +import cgi +import errno +import socket + +from .common import ( + ErrorResponse, + HTTP_NOT_MODIFIED, + statusmessage, +) + +from .. import ( + util, +) shortcuts = { 'cl': [('cmd', ['changelog']), ('rev', None)], diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/server.py Sat Oct 31 22:07:40 2015 +0900 @@ -6,10 +6,27 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer, traceback -from mercurial import util, error -from mercurial.hgweb import common -from mercurial.i18n import _ +from __future__ import absolute_import + +import BaseHTTPServer +import SocketServer +import errno +import os +import socket +import sys +import traceback +import urllib + +from ..i18n import _ + +from .. import ( + error, + util, +) + +from . import ( + common, +) def _splitURI(uri): """Return path and query that has been split from uri @@ -219,8 +236,8 @@ self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) try: - from threading import activeCount - activeCount() # silence pyflakes + import threading + threading.activeCount() # silence pyflakes and bypass demandimport _mixin = SocketServer.ThreadingMixIn except ImportError: if util.safehasattr(os, "fork"): diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/webcommands.py Sat Oct 31 22:07:40 2015 +0900 @@ -5,17 +5,43 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import os, mimetypes, re, cgi, copy -import webutil -from mercurial import error, encoding, archival, templater, templatefilters -from mercurial.node import short, hex -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 -from mercurial import scmutil -from mercurial.i18n import _ -from mercurial import revset +from __future__ import absolute_import + +import cgi +import copy +import mimetypes +import os +import re + +from ..i18n import _ +from ..node import hex, short + +from .common import ( + ErrorResponse, + HTTP_FORBIDDEN, + HTTP_NOT_FOUND, + HTTP_OK, + get_contact, + paritygen, + staticfile, +) + +from .. import ( + archival, + encoding, + error, + graphmod, + patch, + revset, + scmutil, + templatefilters, + templater, + util, +) + +from . import ( + webutil, +) __all__ = [] commands = {} @@ -1268,8 +1294,7 @@ The ``help`` template will be rendered when requesting help for a topic. ``helptopics`` will be rendered for the index of help topics. """ - from mercurial import commands # avoid cycle - from mercurial import help as helpmod # avoid cycle + from .. import commands, help as helpmod # avoid cycle topicname = req.form.get('node', [None])[0] if not topicname: diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/webutil.py Sat Oct 31 22:07:40 2015 +0900 @@ -6,16 +6,32 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import os, copy +from __future__ import absolute_import + +import copy +import difflib +import os import re -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 import templatefilters -from common import ErrorResponse, paritygen -from common import HTTP_NOT_FOUND -import difflib + +from ..i18n import _ +from ..node import hex, nullid, short + +from .common import ( + ErrorResponse, + HTTP_NOT_FOUND, + paritygen, +) + +from .. import ( + context, + error, + match, + patch, + pathutil, + templatefilters, + ui as uimod, + util, +) def up(p): if p[0] != "/": diff -r eac72c1e1e0d -r 37fcfe52c68c mercurial/hgweb/wsgicgi.py --- a/mercurial/hgweb/wsgicgi.py Sun Nov 01 15:09:35 2015 +0900 +++ b/mercurial/hgweb/wsgicgi.py Sat Oct 31 22:07:40 2015 +0900 @@ -8,9 +8,18 @@ # This was originally copied from the public domain code at # http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side -import os, sys -from mercurial import util -from mercurial.hgweb import common +from __future__ import absolute_import + +import os +import sys + +from .. import ( + util, +) + +from . import ( + common, +) def launch(application): util.setbinary(sys.stdin)