Simple extension gives TypeError: expected a 20-byte hash

Yuya Nishihara yuya at
Wed May 16 08:26:05 EDT 2018

On Wed, 16 May 2018 06:58:42 +0000, Marco Wegner wrote:
> im trying to write an extension, that adds some Text at the end of the commitmessage.
> But my example gives me an TypeError: expected a 20-byte hash error on commit. Where is my failure?
> Here is my extension code:
> #!/usr/bin/python
> import re
> import mercurial, sys, os
> def reposetup(ui, repo):
>             #Create a derived class that actually does what you want.
>             class megarepo(repo.__class__):
>                         def commitctx(self, ctx, *args, **kwargs):
>                                    org_text = ctx._text
>                                    ctx._text += ' [Version]'

Check the traceback message to see where the problem occurs. Perhaps your
extension wouldn't forward the return value of super(...).commitctx().

More information about the Mercurial-devel mailing list