Mercurial > public > mercurial-scm > hg
comparison mercurial/mdiff.py @ 49897:a78dfb1ad60e
mdiff: add a __str__ method to diffopts
This makes it easier to debug by just formatting the object into `%s` to see the
members and state, instead of the class and memory address.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 09 Jan 2023 14:34:19 -0500 |
parents | d44e3c45f0e4 |
children | 362d5a2ffd17 |
comparison
equal
deleted
inserted
replaced
49896:88b81dc2d82b | 49897:a78dfb1ad60e |
---|---|
91 def copy(self, **kwargs): | 91 def copy(self, **kwargs): |
92 opts = {k: getattr(self, k) for k in self.defaults} | 92 opts = {k: getattr(self, k) for k in self.defaults} |
93 opts = pycompat.strkwargs(opts) | 93 opts = pycompat.strkwargs(opts) |
94 opts.update(kwargs) | 94 opts.update(kwargs) |
95 return diffopts(**opts) | 95 return diffopts(**opts) |
96 | |
97 def __bytes__(self): | |
98 return b", ".join( | |
99 b"%s: %r" % (k, getattr(self, k)) for k in self.defaults | |
100 ) | |
101 | |
102 __str__ = encoding.strmethod(__bytes__) | |
96 | 103 |
97 | 104 |
98 defaultopts = diffopts() | 105 defaultopts = diffopts() |
99 | 106 |
100 | 107 |