Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 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 | 5da0c7888dc4 |
comparison
equal
deleted
inserted
replaced
31343:ff2f90503d64 | 31344:c99371e38e5e |
---|---|
63 o._node = nullid | 63 o._node = nullid |
64 | 64 |
65 return o | 65 return o |
66 | 66 |
67 def __str__(self): | 67 def __str__(self): |
68 r = short(self.node()) | |
69 if pycompat.ispy3: | |
70 return r.decode('ascii') | |
71 return r | |
72 | |
73 def __bytes__(self): | |
68 return short(self.node()) | 74 return short(self.node()) |
69 | 75 |
70 def __int__(self): | 76 def __int__(self): |
71 return self.rev() | 77 return self.rev() |
72 | 78 |