D1481: py3: ensure hashes are bytes in sparse.py

2018-01-14 Thread indygreg (Gregory Szorc)
indygreg abandoned this revision.
indygreg added a comment.


  This was addressed in https://phab.mercurial-scm.org/D1792.

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1481: py3: ensure hashes are bytes in sparse.py

2017-11-21 Thread yuja (Yuya Nishihara)
yuja added a comment.


  We can do `nodemod.hex(h.digest())` instead.

REPOSITORY
  rHG Mercurial

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

To: indygreg, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1481: py3: ensure hashes are bytes in sparse.py

2017-11-20 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  hashlib's .hexdigest() returns a unicode in Python 3. We need to use
  bytes to make the rest of Mercurial happy.
  
  This was in the top #25 crashes in Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/sparse.py

CHANGE DETAILS

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -173,12 +173,13 @@
 tempsignature = '0'
 
 if signature is None or (includetemp and tempsignature is None):
-signature = hashlib.sha1(repo.vfs.tryread('sparse')).hexdigest()
+signature = pycompat.bytestr(
+hashlib.sha1(repo.vfs.tryread('sparse')).hexdigest())
 cache['signature'] = signature
 
 if includetemp:
 raw = repo.vfs.tryread('tempsparse')
-tempsignature = hashlib.sha1(raw).hexdigest()
+tempsignature = pycompat.bytestr(hashlib.sha1(raw).hexdigest())
 cache['tempsignature'] = tempsignature
 
 return '%s %s' % (signature, tempsignature)



To: indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel