# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1496264118 -19800 # Node ID 1df98fc923d4a8e529092ac6ef3a2a26e26ba7fb # Parent c032e137e494b36007a877a6049db4c1c184bf16 py3: implement __bytes__ for committablectx Before this method, calling bytes on workingctx or memctx calls basectx.__bytes__ since the magic method was not defined for this class. When it calls the method from basectx class, it returns TypeError because None is passed into it. After this commit `hg update -C` works on Python 3 if eol is not enabled. diff -r c032e137e494 -r 1df98fc923d4 mercurial/context.py --- a/mercurial/context.py Fri Jun 02 10:35:21 2017 +0530 +++ b/mercurial/context.py Thu Jun 01 02:25:18 2017 +0530 @@ -1405,6 +1405,9 @@ def __str__(self): return str(self._parents[0]) + r"+" + def __bytes__(self): + return bytes(self._parents[0]) + "+" + def __nonzero__(self): return True