##// END OF EJS Templates
changelog: use attrs instead of namedtuple...
Siddharth Agarwal -
r34399:e51c8ffa default
parent child Browse files
Show More
@@ -7,14 +7,15 b''
7 7
8 8 from __future__ import absolute_import
9 9
10 import collections
11
12 10 from .i18n import _
13 11 from .node import (
14 12 bin,
15 13 hex,
16 14 nullid,
17 15 )
16 from .thirdparty import (
17 attr,
18 )
18 19
19 20 from . import (
20 21 encoding,
@@ -142,10 +143,16 b' def _delayopener(opener, target, buf):'
142 143 return appender(opener, name, mode, buf)
143 144 return _delay
144 145
145 _changelogrevision = collections.namedtuple(u'changelogrevision',
146 (u'manifest', u'user', u'date',
147 u'files', u'description',
148 u'extra'))
146 @attr.s
147 class _changelogrevision(object):
148 # Extensions might modify _defaultextra, so let the constructor below pass
149 # it in
150 extra = attr.ib()
151 manifest = attr.ib(default=nullid)
152 user = attr.ib(default='')
153 date = attr.ib(default=(0, 0))
154 files = attr.ib(default=[])
155 description = attr.ib(default='')
149 156
150 157 class changelogrevision(object):
151 158 """Holds results of a parsed changelog revision.
@@ -162,14 +169,7 b' class changelogrevision(object):'
162 169
163 170 def __new__(cls, text):
164 171 if not text:
165 return _changelogrevision(
166 manifest=nullid,
167 user='',
168 date=(0, 0),
169 files=[],
170 description='',
171 extra=_defaultextra,
172 )
172 return _changelogrevision(extra=_defaultextra)
173 173
174 174 self = super(changelogrevision, cls).__new__(cls)
175 175 # We could return here and implement the following as an __init__.
General Comments 0
You need to be logged in to leave comments. Login now