Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
28970:4f86c3bed63b | 28971:bacca31f4835 |
---|---|
43 mountpoint entry defines the path to the factotum file service. Lastly, the | 43 mountpoint entry defines the path to the factotum file service. Lastly, the |
44 service entry controls the service name used when reading keys. | 44 service entry controls the service name used when reading keys. |
45 | 45 |
46 ''' | 46 ''' |
47 | 47 |
48 from __future__ import absolute_import | |
49 | |
50 import os | |
48 from mercurial.i18n import _ | 51 from mercurial.i18n import _ |
49 from mercurial.url import passwordmgr | 52 from mercurial import ( |
50 from mercurial import httpconnection, error | 53 error, |
51 import os, urllib2 | 54 httpconnection, |
55 url, | |
56 util, | |
57 ) | |
58 | |
59 urlreq = util.urlreq | |
60 passwordmgr = url.passwordmgr | |
52 | 61 |
53 ERRMAX = 128 | 62 ERRMAX = 128 |
54 | 63 |
55 _executable = _mountpoint = _service = None | 64 _executable = _mountpoint = _service = None |
56 | 65 |
91 return func | 100 return func |
92 return decorator | 101 return decorator |
93 | 102 |
94 @monkeypatch_method(passwordmgr) | 103 @monkeypatch_method(passwordmgr) |
95 def find_user_password(self, realm, authuri): | 104 def find_user_password(self, realm, authuri): |
96 user, passwd = urllib2.HTTPPasswordMgrWithDefaultRealm.find_user_password( | 105 user, passwd = urlreq.httppasswordmgrwithdefaultrealm.find_user_password( |
97 self, realm, authuri) | 106 self, realm, authuri) |
98 if user and passwd: | 107 if user and passwd: |
99 self._writedebug(user, passwd) | 108 self._writedebug(user, passwd) |
100 return (user, passwd) | 109 return (user, passwd) |
101 | 110 |