comparison hgext/fsmonitor/__init__.py @ 43393:bdebc7b54dca stable

fsmonitor: make _hashignore compatible with Python 3 The Hasher wants a bytes but we were feeding it a str. Let's use our repr() implementation to return bytes. In addition, the hexdigest() would return a str, which would be compared against a bytes and would always fail. Normalize to bytes so the compare works. Differential Revision: https://phab.mercurial-scm.org/D7209
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 02 Nov 2019 13:39:23 -0700
parents ffdf0bf28212
children 2b8be670dcb6
comparison
equal deleted inserted replaced
43392:8a9e53b974ee 43393:bdebc7b54dca
234 rely on Watchman information anymore and have to re-scan the working 234 rely on Watchman information anymore and have to re-scan the working
235 copy. 235 copy.
236 236
237 """ 237 """
238 sha1 = hashlib.sha1() 238 sha1 = hashlib.sha1()
239 sha1.update(repr(ignore)) 239 sha1.update(pycompat.byterepr(ignore))
240 return sha1.hexdigest() 240 return pycompat.sysbytes(sha1.hexdigest())
241 241
242 242
243 _watchmanencoding = pywatchman.encoding.get_local_encoding() 243 _watchmanencoding = pywatchman.encoding.get_local_encoding()
244 _fsencoding = sys.getfilesystemencoding() or sys.getdefaultencoding() 244 _fsencoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
245 _fixencoding = codecs.lookup(_watchmanencoding) != codecs.lookup(_fsencoding) 245 _fixencoding = codecs.lookup(_watchmanencoding) != codecs.lookup(_fsencoding)