Show More
@@ -72,6 +72,13 b' def cachehash(repo, hideable):' | |||||
72 | h.update(str(hash(frozenset(hideable)))) |
|
72 | h.update(str(hash(frozenset(hideable)))) | |
73 | return h.digest() |
|
73 | return h.digest() | |
74 |
|
74 | |||
|
75 | def _writehiddencache(cachefile, cachehash, hidden): | |||
|
76 | """write hidden data to a cache file""" | |||
|
77 | data = struct.pack('>%ii' % len(hidden), *sorted(hidden)) | |||
|
78 | cachefile.write(struct.pack(">H", cacheversion)) | |||
|
79 | cachefile.write(cachehash) | |||
|
80 | cachefile.write(data) | |||
|
81 | ||||
75 | def trywritehiddencache(repo, hideable, hidden): |
|
82 | def trywritehiddencache(repo, hideable, hidden): | |
76 | """write cache of hidden changesets to disk |
|
83 | """write cache of hidden changesets to disk | |
77 |
|
84 | |||
@@ -87,12 +94,8 b' def trywritehiddencache(repo, hideable, ' | |||||
87 | wlock = repo.wlock(wait=False) |
|
94 | wlock = repo.wlock(wait=False) | |
88 | # write cache to file |
|
95 | # write cache to file | |
89 | newhash = cachehash(repo, hideable) |
|
96 | newhash = cachehash(repo, hideable) | |
90 | sortedset = sorted(hidden) |
|
|||
91 | data = struct.pack('>%ii' % len(sortedset), *sortedset) |
|
|||
92 | fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True) |
|
97 | fh = repo.vfs.open(cachefile, 'w+b', atomictemp=True) | |
93 | fh.write(struct.pack(">H", cacheversion)) |
|
98 | _writehiddencache(fh, newhash, hidden) | |
94 | fh.write(newhash) |
|
|||
95 | fh.write(data) |
|
|||
96 | except (IOError, OSError): |
|
99 | except (IOError, OSError): | |
97 | repo.ui.debug('error writing hidden changesets cache') |
|
100 | repo.ui.debug('error writing hidden changesets cache') | |
98 | except error.LockHeld: |
|
101 | except error.LockHeld: |
General Comments 0
You need to be logged in to leave comments.
Login now