D7021: notify: cast hash to bytes

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Tue Oct 8 04:43:01 UTC 2019


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is needed to avoid a str/bytes mismatch when interpolating a
  line or 2 later.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7021

AFFECTED FILES
  hgext/notify.py

CHANGE DETAILS

diff --git a/hgext/notify.py b/hgext/notify.py
--- a/hgext/notify.py
+++ b/hgext/notify.py
@@ -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,



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list