diff --git a/hgext/fastannotate/context.py b/hgext/fastannotate/context.py --- a/hgext/fastannotate/context.py +++ b/hgext/fastannotate/context.py @@ -151,7 +151,10 @@ def encodedir(path): def hashdiffopts(diffopts): diffoptstr = stringutil.pprint( - sorted((k, getattr(diffopts, k)) for k in mdiff.diffopts.defaults) + sorted( + (k, getattr(diffopts, pycompat.sysstr(k))) + for k in mdiff.diffopts.defaults + ) ) return hex(hashutil.sha1(diffoptstr).digest())[:6] diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -78,7 +78,7 @@ class diffopts: v = opts.get(k) if v is None: v = self.defaults[k] - setattr(self, k, v) + setattr(self, pycompat.sysstr(k), v) try: self.context = int(self.context) @@ -89,14 +89,15 @@ class diffopts: ) def copy(self, **kwargs): - opts = {k: getattr(self, k) for k in self.defaults} + opts = {k: getattr(self, pycompat.sysstr(k)) for k in self.defaults} opts = pycompat.strkwargs(opts) opts.update(kwargs) return diffopts(**opts) def __bytes__(self): return b", ".join( - b"%s: %r" % (k, getattr(self, k)) for k in self.defaults + b"%s: %r" % (k, getattr(self, pycompat.sysstr(k))) + for k in self.defaults ) __str__ = encoding.strmethod(__bytes__)