140 if name != target: |
141 if name != target: |
141 return opener(name, mode) |
142 return opener(name, mode) |
142 return appender(opener, name, mode, buf) |
143 return appender(opener, name, mode, buf) |
143 return _delay |
144 return _delay |
144 |
145 |
145 _changelogrevision = collections.namedtuple(u'changelogrevision', |
146 @attr.s |
146 (u'manifest', u'user', u'date', |
147 class _changelogrevision(object): |
147 u'files', u'description', |
148 # Extensions might modify _defaultextra, so let the constructor below pass |
148 u'extra')) |
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 class changelogrevision(object): |
157 class changelogrevision(object): |
151 """Holds results of a parsed changelog revision. |
158 """Holds results of a parsed changelog revision. |
152 |
159 |
153 Changelog revisions consist of multiple pieces of data, including |
160 Changelog revisions consist of multiple pieces of data, including |
160 u'_text', |
167 u'_text', |
161 ) |
168 ) |
162 |
169 |
163 def __new__(cls, text): |
170 def __new__(cls, text): |
164 if not text: |
171 if not text: |
165 return _changelogrevision( |
172 return _changelogrevision(extra=_defaultextra) |
166 manifest=nullid, |
|
167 user='', |
|
168 date=(0, 0), |
|
169 files=[], |
|
170 description='', |
|
171 extra=_defaultextra, |
|
172 ) |
|
173 |
173 |
174 self = super(changelogrevision, cls).__new__(cls) |
174 self = super(changelogrevision, cls).__new__(cls) |
175 # We could return here and implement the following as an __init__. |
175 # We could return here and implement the following as an __init__. |
176 # But doing it here is equivalent and saves an extra function call. |
176 # But doing it here is equivalent and saves an extra function call. |
177 |
177 |