[PATCH 7 of 8] hgext: make factotum use absolute_import

Pulkit Goyal 7895pulkit at gmail.com
Sat Apr 9 15:12:58 EDT 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1460228571 -19800
#      Sun Apr 10 00:32:51 2016 +0530
# Node ID 6e4ba84abc2a09374b2bb9845a2f98aab02f4dc5
# Parent  280897270e3345ed0352d5247dc3d559cea99153
hgext: make factotum use absolute_import

diff --git a/hgext/factotum.py b/hgext/factotum.py
--- a/hgext/factotum.py
+++ b/hgext/factotum.py
@@ -45,10 +45,16 @@
 
 '''
 
+from __future__ import absolute_import
+
+import os
+import urllib2
 from mercurial.i18n import _
-from mercurial.url import passwordmgr
-from mercurial import httpconnection, error
-import os, urllib2
+from mercurial import (
+    error,
+    httpconnection,
+    url,
+)
 
 ERRMAX = 128
 
@@ -91,7 +97,7 @@
         return func
     return decorator
 
- at monkeypatch_method(passwordmgr)
+ at monkeypatch_method(url.passwordmgr)
 def find_user_password(self, realm, authuri):
     user, passwd = urllib2.HTTPPasswordMgrWithDefaultRealm.find_user_password(
         self, realm, authuri)
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
@@ -3,7 +3,6 @@
   $ cd "$TESTDIR"/..
 
   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
-  hgext/factotum.py not using absolute_import
   hgext/fetch.py not using absolute_import
   hgext/fsmonitor/pywatchman/__init__.py not using absolute_import
   hgext/fsmonitor/pywatchman/__init__.py requires print_function
@@ -94,7 +93,7 @@
   hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob)
   hgext/eol.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
   hgext/extdiff.py: error importing module: <SyntaxError> invalid syntax (archival.py, line 234) (line 70)
-  hgext/factotum.py: error importing: <ImportError> No module named 'cStringIO' (error at url.py:*) (glob)
+  hgext/factotum.py: error importing module: <ImportError> No module named 'urllib2' (line 51)
   hgext/fetch.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
   hgext/fsmonitor/state.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)
   hgext/fsmonitor/watchmanclient.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:*) (glob)


More information about the Mercurial-devel mailing list