comparison mercurial/util.py @ 5742:2bd4d56ff37c

remove unused util.localsub function
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Dec 2007 23:55:40 -0600
parents 9046a4f6a07c
children df09fad0059e
comparison
equal deleted inserted replaced
5741:8ee0de123989 5742:2bd4d56ff37c
78 raise Abort(_("%s, please check your locale settings") % k) 78 raise Abort(_("%s, please check your locale settings") % k)
79 79
80 def locallen(s): 80 def locallen(s):
81 """Find the length in characters of a local string""" 81 """Find the length in characters of a local string"""
82 return len(s.decode(_encoding, "replace")) 82 return len(s.decode(_encoding, "replace"))
83
84 def localsub(s, a, b=None):
85 try:
86 u = s.decode(_encoding, _encodingmode)
87 if b is not None:
88 u = u[a:b]
89 else:
90 u = u[:a]
91 return u.encode(_encoding, _encodingmode)
92 except UnicodeDecodeError, inst:
93 sub = s[max(0, inst.start-10), inst.start+10]
94 raise Abort(_("decoding near '%s': %s!") % (sub, inst))
95 83
96 # used by parsedate 84 # used by parsedate
97 defaultdateformats = ( 85 defaultdateformats = (
98 '%Y-%m-%d %H:%M:%S', 86 '%Y-%m-%d %H:%M:%S',
99 '%Y-%m-%d %I:%M:%S%p', 87 '%Y-%m-%d %I:%M:%S%p',