##// END OF EJS Templates
repoview: fix 0L with pack/unpack for 2.4
Matt Mackall -
r22282:4092d12b default
parent child Browse files
Show More
@@ -68,7 +68,8 b' def cachehash(repo, hideable):'
68 it to the cache. Upon reading we can easily validate by checking the hash
68 it to the cache. Upon reading we can easily validate by checking the hash
69 against the stored one and discard the cache in case the hashes don't match.
69 against the stored one and discard the cache in case the hashes don't match.
70 """
70 """
71 h = util.sha1(''.join(repo.heads()))
71 h = util.sha1()
72 h.update(''.join(repo.heads()))
72 h.update(str(hash(frozenset(hideable))))
73 h.update(str(hash(frozenset(hideable))))
73 return h.digest()
74 return h.digest()
74
75
@@ -88,7 +89,7 b' def trywritehiddencache(repo, hideable, '
88 # write cache to file
89 # write cache to file
89 newhash = cachehash(repo, hideable)
90 newhash = cachehash(repo, hideable)
90 sortedset = sorted(hidden)
91 sortedset = sorted(hidden)
91 data = struct.pack('>%iI' % len(sortedset), *sortedset)
92 data = struct.pack('>%ii' % len(sortedset), *sortedset)
92 fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True)
93 fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True)
93 fh.write(struct.pack(">H", cacheversion))
94 fh.write(struct.pack(">H", cacheversion))
94 fh.write(newhash)
95 fh.write(newhash)
@@ -116,7 +117,7 b' def tryreadcache(repo, hideable):'
116 # cache is valid, so we can start reading the hidden revs
117 # cache is valid, so we can start reading the hidden revs
117 data = fh.read()
118 data = fh.read()
118 count = len(data) / 4
119 count = len(data) / 4
119 hidden = frozenset(struct.unpack('>%iI' % count, data))
120 hidden = frozenset(struct.unpack('>%ii' % count, data))
120 return hidden
121 return hidden
121 finally:
122 finally:
122 if fh:
123 if fh:
@@ -306,6 +306,8 b' class revlog(object):'
306 def rev(self, node):
306 def rev(self, node):
307 try:
307 try:
308 return self._nodecache[node]
308 return self._nodecache[node]
309 except TypeError:
310 raise
309 except RevlogError:
311 except RevlogError:
310 # parsers.c radix tree lookup failed
312 # parsers.c radix tree lookup failed
311 raise LookupError(node, self.indexfile, _('no node'))
313 raise LookupError(node, self.indexfile, _('no node'))
General Comments 0
You need to be logged in to leave comments. Login now