##// END OF EJS Templates
hgweb: use absolute_import
Yuya Nishihara -
r27046:37fcfe52 default
parent child Browse files
Show More
@@ -6,8 +6,14 b''
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 from __future__ import absolute_import
10
9 11 import os
10 import hgweb_mod, hgwebdir_mod
12
13 from . import (
14 hgweb_mod,
15 hgwebdir_mod,
16 )
11 17
12 18 def hgweb(config, name=None, baseui=None):
13 19 '''create an hgweb wsgi object
@@ -6,8 +6,12 b''
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 from __future__ import absolute_import
10
9 11 import BaseHTTPServer
10 import errno, mimetypes, os
12 import errno
13 import mimetypes
14 import os
11 15
12 16 HTTP_OK = 200
13 17 HTTP_NOT_MODIFIED = 304
@@ -6,16 +6,41 b''
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 from __future__ import absolute_import
10
9 11 import contextlib
10 12 import os
11 from mercurial import hg, hook, error, encoding, templater, util, repoview
12 from mercurial import ui as uimod
13 from mercurial import templatefilters
14 from common import ErrorResponse, permhooks, caching
15 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
16 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
17 from request import wsgirequest
18 import webcommands, protocol, webutil, wsgicgi
13
14 from .common import (
15 ErrorResponse,
16 HTTP_BAD_REQUEST,
17 HTTP_NOT_FOUND,
18 HTTP_NOT_MODIFIED,
19 HTTP_OK,
20 HTTP_SERVER_ERROR,
21 caching,
22 permhooks,
23 )
24 from .request import wsgirequest
25
26 from .. import (
27 encoding,
28 error,
29 hg,
30 hook,
31 repoview,
32 templatefilters,
33 templater,
34 ui as uimod,
35 util,
36 )
37
38 from . import (
39 protocol,
40 webcommands,
41 webutil,
42 wsgicgi,
43 )
19 44
20 45 perms = {
21 46 'changegroup': 'pull',
@@ -6,16 +6,42 b''
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 import os, re, time
10 from mercurial.i18n import _
11 from mercurial import hg, scmutil, util, templater
12 from mercurial import ui as uimod
13 from mercurial import error, encoding
14 from common import ErrorResponse, get_mtime, staticfile, paritygen, ismember, \
15 get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
16 import hgweb_mod
17 from request import wsgirequest
18 import webutil, wsgicgi
9 from __future__ import absolute_import
10
11 import os
12 import re
13 import time
14
15 from ..i18n import _
16
17 from .common import (
18 ErrorResponse,
19 HTTP_NOT_FOUND,
20 HTTP_OK,
21 HTTP_SERVER_ERROR,
22 get_contact,
23 get_mtime,
24 ismember,
25 paritygen,
26 staticfile,
27 )
28 from .request import wsgirequest
29
30 from .. import (
31 encoding,
32 error,
33 hg,
34 scmutil,
35 templater,
36 ui as uimod,
37 util,
38 )
39
40 from . import (
41 hgweb_mod,
42 webutil,
43 wsgicgi,
44 )
19 45
20 46 def cleannames(items):
21 47 return [(util.pconvert(name).strip('/'), path) for name, path in items]
@@ -5,9 +5,21 b''
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 import cgi, cStringIO, zlib, urllib
9 from mercurial import util, wireproto
10 from common import HTTP_OK
8 from __future__ import absolute_import
9
10 import cStringIO
11 import cgi
12 import urllib
13 import zlib
14
15 from .common import (
16 HTTP_OK,
17 )
18
19 from .. import (
20 util,
21 wireproto,
22 )
11 23
12 24 HGTYPE = 'application/mercurial-0.1'
13 25 HGERRTYPE = 'application/hg-error'
@@ -6,9 +6,21 b''
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 import socket, cgi, errno
10 from mercurial import util
11 from common import ErrorResponse, statusmessage, HTTP_NOT_MODIFIED
9 from __future__ import absolute_import
10
11 import cgi
12 import errno
13 import socket
14
15 from .common import (
16 ErrorResponse,
17 HTTP_NOT_MODIFIED,
18 statusmessage,
19 )
20
21 from .. import (
22 util,
23 )
12 24
13 25 shortcuts = {
14 26 'cl': [('cmd', ['changelog']), ('rev', None)],
@@ -6,10 +6,27 b''
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer, traceback
10 from mercurial import util, error
11 from mercurial.hgweb import common
12 from mercurial.i18n import _
9 from __future__ import absolute_import
10
11 import BaseHTTPServer
12 import SocketServer
13 import errno
14 import os
15 import socket
16 import sys
17 import traceback
18 import urllib
19
20 from ..i18n import _
21
22 from .. import (
23 error,
24 util,
25 )
26
27 from . import (
28 common,
29 )
13 30
14 31 def _splitURI(uri):
15 32 """Return path and query that has been split from uri
@@ -219,8 +236,8 b' class _httprequesthandlerssl(_httpreques'
219 236 self.wfile = socket._fileobject(self.request, "wb", self.wbufsize)
220 237
221 238 try:
222 from threading import activeCount
223 activeCount() # silence pyflakes
239 import threading
240 threading.activeCount() # silence pyflakes and bypass demandimport
224 241 _mixin = SocketServer.ThreadingMixIn
225 242 except ImportError:
226 243 if util.safehasattr(os, "fork"):
@@ -5,17 +5,43 b''
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 import os, mimetypes, re, cgi, copy
9 import webutil
10 from mercurial import error, encoding, archival, templater, templatefilters
11 from mercurial.node import short, hex
12 from mercurial import util
13 from common import paritygen, staticfile, get_contact, ErrorResponse
14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
15 from mercurial import graphmod, patch
16 from mercurial import scmutil
17 from mercurial.i18n import _
18 from mercurial import revset
8 from __future__ import absolute_import
9
10 import cgi
11 import copy
12 import mimetypes
13 import os
14 import re
15
16 from ..i18n import _
17 from ..node import hex, short
18
19 from .common import (
20 ErrorResponse,
21 HTTP_FORBIDDEN,
22 HTTP_NOT_FOUND,
23 HTTP_OK,
24 get_contact,
25 paritygen,
26 staticfile,
27 )
28
29 from .. import (
30 archival,
31 encoding,
32 error,
33 graphmod,
34 patch,
35 revset,
36 scmutil,
37 templatefilters,
38 templater,
39 util,
40 )
41
42 from . import (
43 webutil,
44 )
19 45
20 46 __all__ = []
21 47 commands = {}
@@ -1268,8 +1294,7 b' def help(web, req, tmpl):'
1268 1294 The ``help`` template will be rendered when requesting help for a topic.
1269 1295 ``helptopics`` will be rendered for the index of help topics.
1270 1296 """
1271 from mercurial import commands # avoid cycle
1272 from mercurial import help as helpmod # avoid cycle
1297 from .. import commands, help as helpmod # avoid cycle
1273 1298
1274 1299 topicname = req.form.get('node', [None])[0]
1275 1300 if not topicname:
@@ -6,16 +6,32 b''
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 import os, copy
9 from __future__ import absolute_import
10
11 import copy
12 import difflib
13 import os
10 14 import re
11 from mercurial import match, patch, error, util, pathutil, context
12 from mercurial import ui as uimod
13 from mercurial.i18n import _
14 from mercurial.node import hex, nullid, short
15 from mercurial import templatefilters
16 from common import ErrorResponse, paritygen
17 from common import HTTP_NOT_FOUND
18 import difflib
15
16 from ..i18n import _
17 from ..node import hex, nullid, short
18
19 from .common import (
20 ErrorResponse,
21 HTTP_NOT_FOUND,
22 paritygen,
23 )
24
25 from .. import (
26 context,
27 error,
28 match,
29 patch,
30 pathutil,
31 templatefilters,
32 ui as uimod,
33 util,
34 )
19 35
20 36 def up(p):
21 37 if p[0] != "/":
@@ -8,9 +8,18 b''
8 8 # This was originally copied from the public domain code at
9 9 # http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side
10 10
11 import os, sys
12 from mercurial import util
13 from mercurial.hgweb import common
11 from __future__ import absolute_import
12
13 import os
14 import sys
15
16 from .. import (
17 util,
18 )
19
20 from . import (
21 common,
22 )
14 23
15 24 def launch(application):
16 25 util.setbinary(sys.stdin)
General Comments 0
You need to be logged in to leave comments. Login now