Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 29341:0d83ad967bf8
cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1
All versions of Python we support or hope to support make the hash
functions available in the same way under the same name, so we may as
well drop the util forwards.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Fri, 10 Jun 2016 00:12:33 -0400 |
parents | d48fc6f318a3 |
children | 40d53d4b5925 |
comparison
equal
deleted
inserted
replaced
29340:ae92c3eee88e | 29341:0d83ad967bf8 |
---|---|
10 | 10 |
11 import collections | 11 import collections |
12 import copy | 12 import copy |
13 import email | 13 import email |
14 import errno | 14 import errno |
15 import hashlib | |
15 import os | 16 import os |
16 import posixpath | 17 import posixpath |
17 import re | 18 import re |
18 import shutil | 19 import shutil |
19 import tempfile | 20 import tempfile |
2410 | 2411 |
2411 def gitindex(text): | 2412 def gitindex(text): |
2412 if not text: | 2413 if not text: |
2413 text = "" | 2414 text = "" |
2414 l = len(text) | 2415 l = len(text) |
2415 s = util.sha1('blob %d\0' % l) | 2416 s = hashlib.sha1('blob %d\0' % l) |
2416 s.update(text) | 2417 s.update(text) |
2417 return s.hexdigest() | 2418 return s.hexdigest() |
2418 | 2419 |
2419 if opts.noprefix: | 2420 if opts.noprefix: |
2420 aprefix = bprefix = '' | 2421 aprefix = bprefix = '' |