Show More
@@ -134,20 +134,20 b' class local(object):' | |||
|
134 | 134 | self.ui.note(_('lfs: adding %s to the usercache\n') % oid) |
|
135 | 135 | lfutil.link(self.vfs.join(oid), self.cachevfs.join(oid)) |
|
136 | 136 | |
|
137 |
def write(self, oid, data |
|
|
138 |
"""Write blob to local blobstore. |
|
|
139 | if verify: | |
|
140 | _verify(oid, data) | |
|
137 | def write(self, oid, data): | |
|
138 | """Write blob to local blobstore. | |
|
141 | 139 |
|
|
140 | This should only be called from the filelog during a commit or similar. | |
|
141 | As such, there is no need to verify the data. Imports from a remote | |
|
142 | store must use ``download()`` instead.""" | |
|
142 | 143 | with self.vfs(oid, 'wb', atomictemp=True) as fp: |
|
143 | 144 | fp.write(data) |
|
144 | 145 | |
|
145 | 146 | # XXX: should we verify the content of the cache, and hardlink back to |
|
146 | 147 | # the local store on success, but truncate, write and link on failure? |
|
147 | 148 | if not self.cachevfs.exists(oid): |
|
148 | if verify or hashlib.sha256(data).hexdigest() == oid: | |
|
149 | self.ui.note(_('lfs: adding %s to the usercache\n') % oid) | |
|
150 | lfutil.link(self.vfs.join(oid), self.cachevfs.join(oid)) | |
|
149 | self.ui.note(_('lfs: adding %s to the usercache\n') % oid) | |
|
150 | lfutil.link(self.vfs.join(oid), self.cachevfs.join(oid)) | |
|
151 | 151 | |
|
152 | 152 | def read(self, oid, verify=True): |
|
153 | 153 | """Read blob from local blobstore.""" |
@@ -86,7 +86,7 b' def writetostore(self, text):' | |||
|
86 | 86 | |
|
87 | 87 | # git-lfs only supports sha256 |
|
88 | 88 | oid = hashlib.sha256(text).hexdigest() |
|
89 |
self.opener.lfslocalblobstore.write(oid, text |
|
|
89 | self.opener.lfslocalblobstore.write(oid, text) | |
|
90 | 90 | |
|
91 | 91 | # replace contents with metadata |
|
92 | 92 | longoid = 'sha256:%s' % oid |
General Comments 0
You need to be logged in to leave comments.
Login now