From patchwork Fri Jun 2 08:46:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4,of,6,V2] py3: implement __bytes__ for committablectx From: Pulkit Goyal <7895pulkit@gmail.com> X-Patchwork-Id: 21133 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Fri, 02 Jun 2017 14:16:09 +0530 # HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1496264118 -19800 # Thu Jun 01 02:25:18 2017 +0530 # Node ID d6d7a160ee30b4296c2750cbf341cc550fe1657f # Parent a2c4837cd74f9ff787e4f085a7b216075fcd233e 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 --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1387,6 +1387,9 @@ def __str__(self): return str(self._parents[0]) + r"+" + def __bytes__(self): + return bytes(self._parents[0]) + "+" + def __nonzero__(self): return True