comparison hggit/git_handler.py @ 752:1d94f54b3502

git_handler: attempt to advertise a slightly better user-agent This causes github to actually respect us as a git client. I still maintain the user-agent sniffing is silly, but at least now it works.
author Augie Fackler <raf@durin42.com>
date Sat, 23 Aug 2014 12:37:25 -0400
parents 53d9d6cd644e
children 0a673c9330ba
comparison
equal deleted inserted replaced
751:53d9d6cd644e 752:1d94f54b3502
1410 uri = uri[4:] 1410 uri = uri[4:]
1411 1411
1412 if uri.startswith('http://') or uri.startswith('https://'): 1412 if uri.startswith('http://') or uri.startswith('https://'):
1413 auth_handler = urllib2.HTTPBasicAuthHandler(url.passwordmgr(self.ui)) 1413 auth_handler = urllib2.HTTPBasicAuthHandler(url.passwordmgr(self.ui))
1414 opener = urllib2.build_opener(auth_handler) 1414 opener = urllib2.build_opener(auth_handler)
1415 useragent = 'git/20x6 (hg-git ; uses dulwich and hg ; like git-core)'
1416 opener.addheaders = [('User-Agent', useragent)]
1415 return client.HttpGitClient(uri, opener=opener), uri 1417 return client.HttpGitClient(uri, opener=opener), uri
1416 1418
1417 # if its not git or git+ssh, try a local url.. 1419 # if its not git or git+ssh, try a local url..
1418 return client.SubprocessGitClient(), uri 1420 return client.SubprocessGitClient(), uri