##// END OF EJS Templates
Change User-agent field in client to have a lot more info.
Eric Hopper -
r6285:4b81eecc default
parent child Browse files
Show More
@@ -10,7 +10,7 b' from node import bin, hex'
10 10 from remoterepo import remoterepository
11 11 from i18n import _
12 12 import repo, os, urllib, urllib2, urlparse, zlib, util, httplib
13 import errno, keepalive, socket, changegroup
13 import errno, keepalive, socket, changegroup, version
14 14
15 15 class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm):
16 16 def __init__(self, ui):
@@ -268,7 +268,7 b' class httprepository(remoterepository):'
268 268 opener = urllib2.build_opener(*handlers)
269 269
270 270 # 1.0 here is the _protocol_ version
271 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
271 opener.addheaders = [('User-agent', version.get_useragent())]
272 272 urllib2.install_opener(opener)
273 273
274 274 def url(self):
@@ -10,6 +10,8 b' Mercurial version'
10 10 """
11 11
12 12 import os
13 import os.path
14 import sys
13 15 import re
14 16 import time
15 17
@@ -27,6 +29,16 b' def get_version(doreload=False):'
27 29 version = unknown_version
28 30 return version
29 31
32 def get_useragent():
33 """Return some extended version information for the User-Agent
34 field in http requests."""
35 hgver = get_version()
36 pyver = '%s(%s)' % (sys.version.split()[0], hex(sys.hexversion))
37 ostype = os.name
38 plat = sys.platform
39 return 'mercurial/proto-1.0 (Python/%s; Mercurial/%s; %s/%s)' % \
40 (pyver, hgver, ostype, plat)
41
30 42 def write_version(version):
31 43 """Overwrite version file."""
32 44 if version == get_version():
General Comments 0
You need to be logged in to leave comments. Login now