comparison mercurial/util.py @ 7632:9626819b2e3d

refactor version code - simplify version detection code - move detection code into setup.py - move version reading function into util.py - drop version.py code This makes hg more closely follow its own recommendation of how to deal with versioning your builds: use hg id in your build script.
author Matt Mackall <mpm@selenic.com>
date Sat, 10 Jan 2009 18:02:38 -0600
parents 016a7319e76b
children d2f753830f80
comparison
equal deleted inserted replaced
7631:0b2ee57dfdb1 7632:9626819b2e3d
139 raise Abort(_("%s, please check your locale settings") % k) 139 raise Abort(_("%s, please check your locale settings") % k)
140 140
141 def locallen(s): 141 def locallen(s):
142 """Find the length in characters of a local string""" 142 """Find the length in characters of a local string"""
143 return len(s.decode(_encoding, "replace")) 143 return len(s.decode(_encoding, "replace"))
144
145 def version():
146 """Return version information if available."""
147 try:
148 import __version__
149 return __version__.version
150 except ImportError:
151 return 'unknown'
144 152
145 # used by parsedate 153 # used by parsedate
146 defaultdateformats = ( 154 defaultdateformats = (
147 '%Y-%m-%d %H:%M:%S', 155 '%Y-%m-%d %H:%M:%S',
148 '%Y-%m-%d %I:%M:%S%p', 156 '%Y-%m-%d %I:%M:%S%p',