Mercurial > hg
comparison hgext/lfs/wrapper.py @ 36604:f6b9f9ddd0de
lfs: convert hexdigest to bytes using sysbytes
Differential Revision: https://phab.mercurial-scm.org/D2568
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 02 Mar 2018 11:07:42 -0500 |
parents | dcb6fbaa43a8 |
children | f0b6fbea00cf |
comparison
equal
deleted
inserted
replaced
36603:dcb6fbaa43a8 | 36604:f6b9f9ddd0de |
---|---|
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 import hashlib | 10 import hashlib |
11 | 11 |
12 from mercurial.i18n import _ | 12 from mercurial.i18n import _ |
13 from mercurial.node import bin, nullid, short | 13 from mercurial.node import bin, hex, nullid, short |
14 | 14 |
15 from mercurial import ( | 15 from mercurial import ( |
16 error, | 16 error, |
17 filelog, | 17 filelog, |
18 revlog, | 18 revlog, |
83 if offset and offset > 0: | 83 if offset and offset > 0: |
84 # lfs blob does not contain hg filelog metadata | 84 # lfs blob does not contain hg filelog metadata |
85 text = text[offset:] | 85 text = text[offset:] |
86 | 86 |
87 # git-lfs only supports sha256 | 87 # git-lfs only supports sha256 |
88 oid = hashlib.sha256(text).hexdigest() | 88 oid = hex(hashlib.sha256(text).digest()) |
89 self.opener.lfslocalblobstore.write(oid, text) | 89 self.opener.lfslocalblobstore.write(oid, text) |
90 | 90 |
91 # replace contents with metadata | 91 # replace contents with metadata |
92 longoid = 'sha256:%s' % oid | 92 longoid = 'sha256:%s' % oid |
93 metadata = pointer.gitlfspointer(oid=longoid, size='%d' % len(text)) | 93 metadata = pointer.gitlfspointer(oid=longoid, size='%d' % len(text)) |