Simple extension gives TypeError: expected a 20-byte hash

Marco Wegner Marco.Wegner at mega-software.de
Wed May 16 06:58:42 UTC 2018


Hello,

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]'

    #Make sure to actually use the new subclass.
            repo.__class__ = megarepo

# We aren't adding any commands to hg.
cmdtables = {}

#List of known compatible versions of hg.
testedwith = '2.5.1'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20180516/55d05771/attachment.html>


More information about the Mercurial-devel mailing list