# HG changeset patch # User Augie Fackler # Date 2017-03-12 01:57:40 # Node ID c99371e38e5ebb429b3b63e0b42b83d0999a6355 # Parent ff2f90503d64ccd462c5526b7e389f96fdf0fcca context: implement both __bytes__ and __str__ for Python 3 They're very similar, for obvious reasons. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -65,6 +65,12 @@ class basectx(object): return o def __str__(self): + r = short(self.node()) + if pycompat.ispy3: + return r.decode('ascii') + return r + + def __bytes__(self): return short(self.node()) def __int__(self):