Mercurial > hg
comparison mercurial/version.py @ 6293:9c195637ac0b
Backed out changeset 4b81eecc8aa2
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon, 17 Mar 2008 14:51:36 -0700 |
parents | 4b81eecc8aa2 |
children | 9cd6292abfdf |
comparison
equal
deleted
inserted
replaced
6285:4b81eecc8aa2 | 6293:9c195637ac0b |
---|---|
8 """ | 8 """ |
9 Mercurial version | 9 Mercurial version |
10 """ | 10 """ |
11 | 11 |
12 import os | 12 import os |
13 import os.path | |
14 import sys | |
15 import re | 13 import re |
16 import time | 14 import time |
17 | 15 |
18 unknown_version = 'unknown' | 16 unknown_version = 'unknown' |
19 remembered_version = False | 17 remembered_version = False |
26 reload(mercurial.__version__) | 24 reload(mercurial.__version__) |
27 version = mercurial.__version__.version | 25 version = mercurial.__version__.version |
28 except ImportError: | 26 except ImportError: |
29 version = unknown_version | 27 version = unknown_version |
30 return version | 28 return version |
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 | 29 |
42 def write_version(version): | 30 def write_version(version): |
43 """Overwrite version file.""" | 31 """Overwrite version file.""" |
44 if version == get_version(): | 32 if version == get_version(): |
45 return | 33 return |