Mercurial > hg
comparison hgext/fsmonitor/__init__.py @ 44062:2d49482d0dd4
hgext: replace references to hashlib.sha1 with hashutil.sha1
When in a non-pure build of Mercurial, this will provide protections
against SHA1 collision attacks.
Differential Revision: https://phab.mercurial-scm.org/D7851
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 13 Jan 2020 14:12:31 -0500 |
parents | 90fba2248693 |
children | 9d2b2df2c2ba |
comparison
equal
deleted
inserted
replaced
44061:cbc5755df6bf | 44062:2d49482d0dd4 |
---|---|
106 # ones. Patches to fix them are welcome. | 106 # ones. Patches to fix them are welcome. |
107 | 107 |
108 from __future__ import absolute_import | 108 from __future__ import absolute_import |
109 | 109 |
110 import codecs | 110 import codecs |
111 import hashlib | |
112 import os | 111 import os |
113 import stat | 112 import stat |
114 import sys | 113 import sys |
115 import tempfile | 114 import tempfile |
116 import weakref | 115 import weakref |
130 registrar, | 129 registrar, |
131 scmutil, | 130 scmutil, |
132 util, | 131 util, |
133 ) | 132 ) |
134 from mercurial import match as matchmod | 133 from mercurial import match as matchmod |
135 from mercurial.utils import stringutil | 134 from mercurial.utils import ( |
135 hashutil, | |
136 stringutil, | |
137 ) | |
136 | 138 |
137 from . import ( | 139 from . import ( |
138 pywatchman, | 140 pywatchman, |
139 state, | 141 state, |
140 watchmanclient, | 142 watchmanclient, |
233 If this information changes between Mercurial invocations, we can't | 235 If this information changes between Mercurial invocations, we can't |
234 rely on Watchman information anymore and have to re-scan the working | 236 rely on Watchman information anymore and have to re-scan the working |
235 copy. | 237 copy. |
236 | 238 |
237 """ | 239 """ |
238 sha1 = hashlib.sha1() | 240 sha1 = hashutil.sha1() |
239 sha1.update(pycompat.byterepr(ignore)) | 241 sha1.update(pycompat.byterepr(ignore)) |
240 return pycompat.sysbytes(sha1.hexdigest()) | 242 return pycompat.sysbytes(sha1.hexdigest()) |
241 | 243 |
242 | 244 |
243 _watchmanencoding = pywatchman.encoding.get_local_encoding() | 245 _watchmanencoding = pywatchman.encoding.get_local_encoding() |