Mercurial > hg
changeset 31344:c99371e38e5e
context: implement both __bytes__ and __str__ for Python 3
They're very similar, for obvious reasons.
author | Augie Fackler <augie@google.com> |
---|---|
date | Sat, 11 Mar 2017 20:57:40 -0500 |
parents | ff2f90503d64 |
children | dd49a6c166f7 |
files | mercurial/context.py |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Sat Mar 11 20:57:04 2017 -0500 +++ b/mercurial/context.py Sat Mar 11 20:57:40 2017 -0500 @@ -65,6 +65,12 @@ 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):