comparison mercurial/changelog.py @ 29696:2f64e5a6efb8

py3: use unicode literals in changelog.py collections.namedtuple type and field names must be str in Python 3. Our custom module importer was rewriting them to bytes literals, making this fail. In addition, __slots__ values must also be unicode.
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 04 Aug 2016 00:15:39 +0530
parents 70c2f8a98276
children b5e5ddf48bd2
comparison
equal deleted inserted replaced
29695:f2846d546645 29696:2f64e5a6efb8
136 if name != target: 136 if name != target:
137 return opener(name, mode) 137 return opener(name, mode)
138 return appender(opener, name, mode, buf) 138 return appender(opener, name, mode, buf)
139 return _delay 139 return _delay
140 140
141 _changelogrevision = collections.namedtuple('changelogrevision', 141 _changelogrevision = collections.namedtuple(u'changelogrevision',
142 ('manifest', 'user', 'date', 142 (u'manifest', u'user', u'date',
143 'files', 'description', 'extra')) 143 u'files', u'description',
144 u'extra'))
144 145
145 class changelogrevision(object): 146 class changelogrevision(object):
146 """Holds results of a parsed changelog revision. 147 """Holds results of a parsed changelog revision.
147 148
148 Changelog revisions consist of multiple pieces of data, including 149 Changelog revisions consist of multiple pieces of data, including
149 the manifest node, user, and date. This object exposes a view into 150 the manifest node, user, and date. This object exposes a view into
150 the parsed object. 151 the parsed object.
151 """ 152 """
152 153
153 __slots__ = ( 154 __slots__ = (
154 '_offsets', 155 u'_offsets',
155 '_text', 156 u'_text',
156 ) 157 )
157 158
158 def __new__(cls, text): 159 def __new__(cls, text):
159 if not text: 160 if not text:
160 return _changelogrevision( 161 return _changelogrevision(