changeset 43164:c32531444cdc

notify: cast hash to bytes This is needed to avoid a str/bytes mismatch when interpolating a line or 2 later. Differential Revision: https://phab.mercurial-scm.org/D7021
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 07 Oct 2019 21:21:16 -0400
parents 5617b748aad8
children 227ba1afcb65
files hgext/notify.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/notify.py	Sat Oct 05 13:39:35 2019 -0700
+++ b/hgext/notify.py	Mon Oct 07 21:21:16 2019 -0400
@@ -161,6 +161,7 @@
     logcmdutil,
     mail,
     patch,
+    pycompat,
     registrar,
     util,
 )
@@ -559,7 +560,10 @@
         host = encoding.strtolocal(socket.getfqdn())
     if messageidseed:
         messagehash = hashlib.sha512(ctx.hex() + messageidseed)
-        messageid = b'<hg.%s@%s>' % (messagehash.hexdigest()[:64], host)
+        messageid = b'<hg.%s@%s>' % (
+            pycompat.sysbytes(messagehash.hexdigest()[:64]),
+            host,
+        )
     else:
         messageid = b'<hg.%s.%d.%d@%s>' % (
             ctx,