Patchwork D7021: notify: cast hash to bytes

login
register
mail settings
Submitter phabricator
Date Oct. 8, 2019, 4:43 a.m.
Message ID <differential-rev-PHID-DREV-x46hailvqiwwxgucggn7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42093/
State Superseded
Headers show

Comments

phabricator - Oct. 8, 2019, 4:43 a.m.
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




To: indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 8, 2019, 10:32 a.m.
marmoute added a comment.
marmoute accepted this revision.


  This looks good to me.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7021/new/

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

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

Patch

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,