diff --git a/hgext/bugzilla.py b/hgext/bugzilla.py --- a/hgext/bugzilla.py +++ b/hgext/bugzilla.py @@ -281,7 +281,6 @@ from __future__ import absolute_import import re import time -import xmlrpclib from mercurial.i18n import _ from mercurial.node import short @@ -293,6 +292,7 @@ from mercurial import ( ) 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 --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -18,6 +18,13 @@ except ImportError: 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 --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -54,6 +54,7 @@ for attr in ( # we do import urlreq, but we do it outside the loop #'urlreq', 'stringio', + 'xmlrpclib', ): globals()[attr] = getattr(pycompat, attr) diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t +++ b/tests/test-check-py3-compat.t @@ -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)