# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1467025657 -19800 # Node ID 34b914ac573ee201ae06438de11e70c57be4b3ca # Parent 80880ad3fccd370d361a0c77655fe36b9db40d4c py3: conditionalize xmlrpclib import The xmlrpclib library is renamed to xmlrpc.client in python 3 diff -r 80880ad3fccd -r 34b914ac573e hgext/bugzilla.py --- a/hgext/bugzilla.py Mon Jun 27 16:16:10 2016 +0530 +++ b/hgext/bugzilla.py Mon Jun 27 16:37:37 2016 +0530 @@ -281,7 +281,6 @@ import re import time -import xmlrpclib from mercurial.i18n import _ from mercurial.node import short @@ -293,6 +292,7 @@ ) urlparse = util.urlparse +xmlrpclib = util.xmlrpclib # Note for extension authors: ONLY specify testedwith = 'internal' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should diff -r 80880ad3fccd -r 34b914ac573e mercurial/pycompat.py --- a/mercurial/pycompat.py Mon Jun 27 16:16:10 2016 +0530 +++ b/mercurial/pycompat.py Mon Jun 27 16:37:37 2016 +0530 @@ -18,6 +18,13 @@ pickle.dumps # silence pyflakes try: + import xmlrpclib + xmlrpclib.Transport +except ImportError: + import xmlrpc.client as xmlrpclib + xmlrpclib.Transport + +try: import urlparse urlparse.urlparse except ImportError: diff -r 80880ad3fccd -r 34b914ac573e mercurial/util.py --- a/mercurial/util.py Mon Jun 27 16:16:10 2016 +0530 +++ b/mercurial/util.py Mon Jun 27 16:37:37 2016 +0530 @@ -54,6 +54,7 @@ # we do import urlreq, but we do it outside the loop #'urlreq', 'stringio', + 'xmlrpclib', ): globals()[attr] = getattr(pycompat, attr) diff -r 80880ad3fccd -r 34b914ac573e tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t Mon Jun 27 16:16:10 2016 +0530 +++ b/tests/test-check-py3-compat.t Mon Jun 27 16:37:37 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 'xmlrpclib' (line *) (glob) + hgext/bugzilla.py: error importing: 'dict' object has no attribute 'iteritems' (error at revset.py:*) (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)