equal
deleted
inserted
replaced
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)) |