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