changeset 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 5e2f63e1064c
files hggit/git_handler.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py	Sat Aug 23 12:36:53 2014 -0400
+++ b/hggit/git_handler.py	Sat Aug 23 12:37:25 2014 -0400
@@ -1412,6 +1412,8 @@
         if uri.startswith('http://') or uri.startswith('https://'):
             auth_handler = urllib2.HTTPBasicAuthHandler(url.passwordmgr(self.ui))
             opener = urllib2.build_opener(auth_handler)
+            useragent = 'git/20x6 (hg-git ; uses dulwich and hg ; like git-core)'
+            opener.addheaders = [('User-Agent', useragent)]
             return client.HttpGitClient(uri, opener=opener), uri
 
         # if its not git or git+ssh, try a local url..