Show More
@@ -138,7 +138,7 b' def hashdiffopts(diffopts):' | |||||
138 | (k, getattr(diffopts, k)) |
|
138 | (k, getattr(diffopts, k)) | |
139 | for k in mdiff.diffopts.defaults |
|
139 | for k in mdiff.diffopts.defaults | |
140 | )) |
|
140 | )) | |
141 |
return hashlib.sha1(diffoptstr). |
|
141 | return node.hex(hashlib.sha1(diffoptstr).digest())[:6] | |
142 |
|
142 | |||
143 | _defaultdiffopthash = hashdiffopts(mdiff.defaultopts) |
|
143 | _defaultdiffopthash = hashdiffopts(mdiff.defaultopts) | |
144 |
|
144 |
@@ -240,7 +240,7 b' def _lfconvert_addchangeset(rsrc, rdst, ' | |||||
240 | # largefile was modified, update standins |
|
240 | # largefile was modified, update standins | |
241 | m = hashlib.sha1('') |
|
241 | m = hashlib.sha1('') | |
242 | m.update(ctx[f].data()) |
|
242 | m.update(ctx[f].data()) | |
243 |
hash = m. |
|
243 | hash = node.hex(m.digest()) | |
244 | if f not in lfiletohash or lfiletohash[f] != hash: |
|
244 | if f not in lfiletohash or lfiletohash[f] != hash: | |
245 | rdst.wwrite(f, ctx[f].data(), ctx[f].flags()) |
|
245 | rdst.wwrite(f, ctx[f].data(), ctx[f].flags()) | |
246 | executable = 'x' in ctx[f].flags() |
|
246 | executable = 'x' in ctx[f].flags() |
@@ -20,6 +20,7 b' from mercurial.i18n import _' | |||||
20 | from mercurial import ( |
|
20 | from mercurial import ( | |
21 | encoding, |
|
21 | encoding, | |
22 | error, |
|
22 | error, | |
|
23 | node, | |||
23 | pathutil, |
|
24 | pathutil, | |
24 | pycompat, |
|
25 | pycompat, | |
25 | url as urlmod, |
|
26 | url as urlmod, | |
@@ -156,7 +157,7 b' class local(object):' | |||||
156 | fp.write(chunk) |
|
157 | fp.write(chunk) | |
157 | sha256.update(chunk) |
|
158 | sha256.update(chunk) | |
158 |
|
159 | |||
159 |
realoid = sha256. |
|
160 | realoid = node.hex(sha256.digest()) | |
160 | if realoid != oid: |
|
161 | if realoid != oid: | |
161 | raise LfsCorruptionError(_('corrupt remote lfs object: %s') |
|
162 | raise LfsCorruptionError(_('corrupt remote lfs object: %s') | |
162 | % oid) |
|
163 | % oid) | |
@@ -206,7 +207,7 b' class local(object):' | |||||
206 | # Don't abort if corruption is detected, because `hg verify` will |
|
207 | # Don't abort if corruption is detected, because `hg verify` will | |
207 | # give more useful info about the corruption- simply don't add the |
|
208 | # give more useful info about the corruption- simply don't add the | |
208 | # hardlink. |
|
209 | # hardlink. | |
209 |
if verify or hashlib.sha256(blob). |
|
210 | if verify or node.hex(hashlib.sha256(blob).digest()) == oid: | |
210 | self.ui.note(_('lfs: found %s in the usercache\n') % oid) |
|
211 | self.ui.note(_('lfs: found %s in the usercache\n') % oid) | |
211 | lfutil.link(self.cachevfs.join(oid), self.vfs.join(oid)) |
|
212 | lfutil.link(self.cachevfs.join(oid), self.vfs.join(oid)) | |
212 | else: |
|
213 | else: | |
@@ -230,7 +231,7 b' class local(object):' | |||||
230 | for chunk in util.filechunkiter(fp, size=1048576): |
|
231 | for chunk in util.filechunkiter(fp, size=1048576): | |
231 | sha256.update(chunk) |
|
232 | sha256.update(chunk) | |
232 |
|
233 | |||
233 |
return oid == sha256. |
|
234 | return oid == node.hex(sha256.digest()) | |
234 |
|
235 | |||
235 | def has(self, oid): |
|
236 | def has(self, oid): | |
236 | """Returns True if the local blobstore contains the requested blob, |
|
237 | """Returns True if the local blobstore contains the requested blob, | |
@@ -587,7 +588,7 b' def _deduplicate(pointers):' | |||||
587 | return reduced.values() |
|
588 | return reduced.values() | |
588 |
|
589 | |||
589 | def _verify(oid, content): |
|
590 | def _verify(oid, content): | |
590 |
realoid = hashlib.sha256(content). |
|
591 | realoid = node.hex(hashlib.sha256(content).digest()) | |
591 | if realoid != oid: |
|
592 | if realoid != oid: | |
592 | raise LfsCorruptionError(_('detected corrupt lfs object: %s') % oid, |
|
593 | raise LfsCorruptionError(_('detected corrupt lfs object: %s') % oid, | |
593 | hint=_('run hg verify')) |
|
594 | hint=_('run hg verify')) |
@@ -10,6 +10,7 b' import time' | |||||
10 |
|
10 | |||
11 | from mercurial.i18n import _ |
|
11 | from mercurial.i18n import _ | |
12 | from mercurial import ( |
|
12 | from mercurial import ( | |
|
13 | node as nodemod, | |||
13 | policy, |
|
14 | policy, | |
14 | pycompat, |
|
15 | pycompat, | |
15 | util, |
|
16 | util, | |
@@ -412,7 +413,7 b' class mutablebasepack(versionmixin):' | |||||
412 | return |
|
413 | return | |
413 |
|
414 | |||
414 | try: |
|
415 | try: | |
415 |
sha = self.sha. |
|
416 | sha = nodemod.hex(self.sha.digest()) | |
416 | self.packfp.close() |
|
417 | self.packfp.close() | |
417 | self.writeindex() |
|
418 | self.writeindex() | |
418 |
|
419 |
General Comments 0
You need to be logged in to leave comments.
Login now