# HG changeset patch # User Yuya Nishihara # Date 1525327696 -32400 # Node ID 395571419274ee851b554d24a27fd4ce45788a88 # Parent 3fe1c92630240b4483b5bc558304c8b9d6c889df formatter: ditch namedtuple in favor of attr diff -r 3fe1c9263024 -r 395571419274 mercurial/formatter.py --- a/mercurial/formatter.py Sun Apr 29 15:52:01 2018 +0900 +++ b/mercurial/formatter.py Thu May 03 15:08:16 2018 +0900 @@ -107,7 +107,6 @@ from __future__ import absolute_import, print_function -import collections import contextlib import itertools import os @@ -117,6 +116,9 @@ hex, short, ) +from .thirdparty import ( + attr, +) from . import ( error, @@ -413,8 +415,11 @@ baseformatter.end(self) self._renderitem('docfooter', {}) -templatespec = collections.namedtuple(r'templatespec', - r'ref tmpl mapfile') +@attr.s(frozen=True) +class templatespec(object): + ref = attr.ib() + tmpl = attr.ib() + mapfile = attr.ib() def lookuptemplate(ui, topic, tmpl): """Find the template matching the given -T/--template spec 'tmpl'