Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 35582:72b91f905065
py3: use node.hex(h.digest()) instead of h.hexdigest()
hashlib.sha1.hexdigest() returns str on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D1792
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 29 Dec 2017 05:25:27 +0530 |
parents | 82c3762349ac |
children | 3328d53254d9 |
comparison
equal
deleted
inserted
replaced
35581:154754d1f137 | 35582:72b91f905065 |
---|---|
2652 if not text: | 2652 if not text: |
2653 text = "" | 2653 text = "" |
2654 l = len(text) | 2654 l = len(text) |
2655 s = hashlib.sha1('blob %d\0' % l) | 2655 s = hashlib.sha1('blob %d\0' % l) |
2656 s.update(text) | 2656 s.update(text) |
2657 return s.hexdigest() | 2657 return hex(s.digest()) |
2658 | 2658 |
2659 if opts.noprefix: | 2659 if opts.noprefix: |
2660 aprefix = bprefix = '' | 2660 aprefix = bprefix = '' |
2661 else: | 2661 else: |
2662 aprefix = 'a/' | 2662 aprefix = 'a/' |