# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1467024370 -19800 # Node ID 80880ad3fccd370d361a0c77655fe36b9db40d4c # Parent 72065b3b90a44ce6fe64e8054c0e1128b1e4d3b7 py3: conditionalize the urlparse import The urlparse library is renamed to urllib.parse in python 3 diff -r 72065b3b90a4 -r 80880ad3fccd hgext/bugzilla.py --- a/hgext/bugzilla.py Mon Jun 27 15:53:38 2016 +0530 +++ b/hgext/bugzilla.py Mon Jun 27 16:16:10 2016 +0530 @@ -281,7 +281,6 @@ import re import time -import urlparse import xmlrpclib from mercurial.i18n import _ @@ -293,6 +292,8 @@ util, ) +urlparse = util.urlparse + # Note for extension authors: ONLY specify testedwith = 'internal' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should # be specifying the version(s) of Mercurial they are tested with, or diff -r 72065b3b90a4 -r 80880ad3fccd mercurial/pycompat.py --- a/mercurial/pycompat.py Mon Jun 27 15:53:38 2016 +0530 +++ b/mercurial/pycompat.py Mon Jun 27 16:16:10 2016 +0530 @@ -18,6 +18,13 @@ pickle.dumps # silence pyflakes try: + import urlparse + urlparse.urlparse +except ImportError: + import urllib.parse as urlparse + urlparse.urlparse + +try: import cStringIO as io stringio = io.StringIO except ImportError: diff -r 72065b3b90a4 -r 80880ad3fccd mercurial/util.py --- a/mercurial/util.py Mon Jun 27 15:53:38 2016 +0530 +++ b/mercurial/util.py Mon Jun 27 16:16:10 2016 +0530 @@ -50,6 +50,7 @@ 'pickle', 'queue', 'urlerr', + 'urlparse', # we do import urlreq, but we do it outside the loop #'urlreq', 'stringio', diff -r 72065b3b90a4 -r 80880ad3fccd tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t Mon Jun 27 15:53:38 2016 +0530 +++ b/tests/test-check-py3-compat.t Mon Jun 27 16:16:10 2016 +0530 @@ -26,7 +26,7 @@ doc/hgmanpage.py: invalid syntax: invalid syntax (, line *) (glob) hgext/automv.py: error importing module: invalid syntax (commands.py, line *) (line *) (glob) hgext/blackbox.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) - hgext/bugzilla.py: error importing module: No module named 'urlparse' (line *) (glob) + hgext/bugzilla.py: error importing module: No module named 'xmlrpclib' (line *) (glob) hgext/censor.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) hgext/chgserver.py: error importing module: No module named 'SocketServer' (line *) (glob) hgext/children.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) diff -r 72065b3b90a4 -r 80880ad3fccd tests/tinyproxy.py --- a/tests/tinyproxy.py Mon Jun 27 15:53:38 2016 +0530 +++ b/tests/tinyproxy.py Mon Jun 27 16:16:10 2016 +0530 @@ -20,7 +20,10 @@ import select import socket import sys -import urlparse + +from mercurial import util + +urlparse = util.urlparse class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): __base = BaseHTTPServer.BaseHTTPRequestHandler