Mercurial > hg
changeset 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 | 88b81dc2d82b |
children | 024e0580b853 |
files | mercurial/mdiff.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/mdiff.py Fri Jan 06 11:38:13 2023 -0500 +++ b/mercurial/mdiff.py Mon Jan 09 14:34:19 2023 -0500 @@ -94,6 +94,13 @@ opts.update(kwargs) return diffopts(**opts) + def __bytes__(self): + return b", ".join( + b"%s: %r" % (k, getattr(self, k)) for k in self.defaults + ) + + __str__ = encoding.strmethod(__bytes__) + defaultopts = diffopts()