[PATCH 1 of 1] Set the User-Agent field to Mercurial/version

Eric Hopper hopper at omnifarious.org
Wed Sep 28 00:02:59 CDT 2005


# HG changeset patch
# User Eric Hopper <hopper at omnifarious.org>
# Node ID 72a445bef64e55dfea37c9fbd96a10c222ba46f5
# Parent  f75567782abad13aba834671b9e20448e90e8ac2
Set the User-Agent field to Mercurial/version

diff -r f75567782aba -r 72a445bef64e mercurial/httprepo.py
--- a/mercurial/httprepo.py	Thu Sep 15 08:00:10 2005
+++ b/mercurial/httprepo.py	Wed Sep 28 05:02:18 2005
@@ -8,7 +8,7 @@
 from node import *
 from remoterepo import *
 from demandload import *
-demandload(globals(), "hg os urllib urllib2 urlparse zlib")
+demandload(globals(), "hg os urllib urllib2 urlparse zlib version")
 
 class httprepository(remoterepository):
     def __init__(self, ui, path):
@@ -59,6 +59,7 @@
             authinfo = urllib2.ProxyBasicAuthHandler(passmgr)
 
         opener = urllib2.build_opener(proxy_handler, authinfo)
+        opener.addheaders = [('User-agent', 'Mercurial/%s' % version.get_version())]
         urllib2.install_opener(opener)
 
     def dev(self):


More information about the Mercurial mailing list