diff -r 154754d1f137 -r 72b91f905065 mercurial/patch.py --- a/mercurial/patch.py Fri Dec 29 05:22:06 2017 +0530 +++ b/mercurial/patch.py Fri Dec 29 05:25:27 2017 +0530 @@ -2654,7 +2654,7 @@ l = len(text) s = hashlib.sha1('blob %d\0' % l) s.update(text) - return s.hexdigest() + return hex(s.digest()) if opts.noprefix: aprefix = bprefix = ''