equal
deleted
inserted
replaced
76 except locale.Error: |
76 except locale.Error: |
77 encoding = 'ascii' |
77 encoding = 'ascii' |
78 encodingmode = environ.get("HGENCODINGMODE", "strict") |
78 encodingmode = environ.get("HGENCODINGMODE", "strict") |
79 fallbackencoding = 'ISO-8859-1' |
79 fallbackencoding = 'ISO-8859-1' |
80 |
80 |
81 class localstr(str): |
81 class localstr(bytes): |
82 '''This class allows strings that are unmodified to be |
82 '''This class allows strings that are unmodified to be |
83 round-tripped to the local encoding and back''' |
83 round-tripped to the local encoding and back''' |
84 def __new__(cls, u, l): |
84 def __new__(cls, u, l): |
85 s = str.__new__(cls, l) |
85 s = bytes.__new__(cls, l) |
86 s._utf8 = u |
86 s._utf8 = u |
87 return s |
87 return s |
88 def __hash__(self): |
88 def __hash__(self): |
89 return hash(self._utf8) # avoid collisions in local string space |
89 return hash(self._utf8) # avoid collisions in local string space |
90 |
90 |