diff hgext/factotum.py @ 28971:bacca31f4835

py3: make factotum use absolute_import check-code complains for using urllib2 so that too was fixed.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 17 Apr 2016 02:29:33 +0530
parents 56b2bcea2529
children 2c019aac6b99
line wrap: on
line diff
--- a/hgext/factotum.py	Sun Apr 17 02:15:05 2016 +0530
+++ b/hgext/factotum.py	Sun Apr 17 02:29:33 2016 +0530
@@ -45,10 +45,19 @@
 
 '''
 
+from __future__ import absolute_import
+
+import os
 from mercurial.i18n import _
-from mercurial.url import passwordmgr
-from mercurial import httpconnection, error
-import os, urllib2
+from mercurial import (
+    error,
+    httpconnection,
+    url,
+    util,
+)
+
+urlreq = util.urlreq
+passwordmgr = url.passwordmgr
 
 ERRMAX = 128
 
@@ -93,7 +102,7 @@
 
 @monkeypatch_method(passwordmgr)
 def find_user_password(self, realm, authuri):
-    user, passwd = urllib2.HTTPPasswordMgrWithDefaultRealm.find_user_password(
+    user, passwd = urlreq.httppasswordmgrwithdefaultrealm.find_user_password(
         self, realm, authuri)
     if user and passwd:
         self._writedebug(user, passwd)