comparison mercurial/patch.py @ 44060:a61287a95dc3

core: migrate uses of hashlib.sha1 to hashutil.sha1 Differential Revision: https://phab.mercurial-scm.org/D7849
author Augie Fackler <augie@google.com>
date Mon, 13 Jan 2020 17:15:14 -0500
parents 0671f0a19d93
children c443b9ba6f63
comparison
equal deleted inserted replaced
44059:7126d8b8e0e6 44060:a61287a95dc3
10 10
11 import collections 11 import collections
12 import contextlib 12 import contextlib
13 import copy 13 import copy
14 import errno 14 import errno
15 import hashlib
16 import os 15 import os
17 import re 16 import re
18 import shutil 17 import shutil
19 import zlib 18 import zlib
20 19
39 util, 38 util,
40 vfs as vfsmod, 39 vfs as vfsmod,
41 ) 40 )
42 from .utils import ( 41 from .utils import (
43 dateutil, 42 dateutil,
43 hashutil,
44 procutil, 44 procutil,
45 stringutil, 45 stringutil,
46 ) 46 )
47 47
48 stringio = util.stringio 48 stringio = util.stringio
2941 2941
2942 def gitindex(text): 2942 def gitindex(text):
2943 if not text: 2943 if not text:
2944 text = b"" 2944 text = b""
2945 l = len(text) 2945 l = len(text)
2946 s = hashlib.sha1(b'blob %d\0' % l) 2946 s = hashutil.sha1(b'blob %d\0' % l)
2947 s.update(text) 2947 s.update(text)
2948 return hex(s.digest()) 2948 return hex(s.digest())
2949 2949
2950 if opts.noprefix: 2950 if opts.noprefix:
2951 aprefix = bprefix = b'' 2951 aprefix = bprefix = b''