comparison hggit/git_handler.py @ 992:05c8aa7d3edc

git_handler: use compat.passwordmgr for hg < 3.9 support
author Sean Farley <sean@farley.io>
date Thu, 04 Aug 2016 14:16:44 -0700
parents be0d1413a06f
children c4a2ef796c19
comparison
equal deleted inserted replaced
991:92d7702c19da 992:05c8aa7d3edc
25 util as hgutil, 25 util as hgutil,
26 url, 26 url,
27 ) 27 )
28 28
29 import _ssh 29 import _ssh
30 import compat
30 import git2hg 31 import git2hg
31 import hg2git 32 import hg2git
32 import util 33 import util
33 from overlay import overlayrepo 34 from overlay import overlayrepo
34 35
1625 1626
1626 if uri.startswith('git+http://') or uri.startswith('git+https://'): 1627 if uri.startswith('git+http://') or uri.startswith('git+https://'):
1627 uri = uri[4:] 1628 uri = uri[4:]
1628 1629
1629 if uri.startswith('http://') or uri.startswith('https://'): 1630 if uri.startswith('http://') or uri.startswith('https://'):
1630 auth = urllib2.HTTPBasicAuthHandler(url.passwordmgr(self.ui)) 1631 realm = hgutil.urlreq.httppasswordmgrwithdefaultrealm()
1632 pmgr = compat.passwordmgr(self.ui, realm)
1633 auth = urllib2.HTTPBasicAuthHandler(pmgr)
1634
1631 opener = urllib2.build_opener(auth) 1635 opener = urllib2.build_opener(auth)
1632 ua = 'git/20x6 (hg-git ; uses dulwich and hg ; like git-core)' 1636 ua = 'git/20x6 (hg-git ; uses dulwich and hg ; like git-core)'
1633 opener.addheaders = [('User-Agent', ua)] 1637 opener.addheaders = [('User-Agent', ua)]
1634 try: 1638 try:
1635 return client.HttpGitClient(uri, opener=opener), uri 1639 return client.HttpGitClient(uri, opener=opener), uri