##// END OF EJS Templates
repoview: separate cache hash computation from cache reading...
Stanislau Hlebik -
r31049:20027be9 default
parent child Browse files
Show More
@@ -139,15 +139,13 b' def trywritehiddencache(repo, hideable, '
139 if wlock:
139 if wlock:
140 wlock.release()
140 wlock.release()
141
141
142 def tryreadcache(repo, hideable):
142 def _readhiddencache(repo, cachefilename, newhash):
143 """read a cache if the cache exists and is valid, otherwise returns None."""
144 hidden = fh = None
143 hidden = fh = None
145 try:
144 try:
146 if repo.vfs.exists(cachefile):
145 if repo.vfs.exists(cachefile):
147 fh = repo.vfs.open(cachefile, 'rb')
146 fh = repo.vfs.open(cachefile, 'rb')
148 version, = struct.unpack(">H", fh.read(2))
147 version, = struct.unpack(">H", fh.read(2))
149 oldhash = fh.read(20)
148 oldhash = fh.read(20)
150 newhash = cachehash(repo, hideable)
151 if (cacheversion, oldhash) == (version, newhash):
149 if (cacheversion, oldhash) == (version, newhash):
152 # cache is valid, so we can start reading the hidden revs
150 # cache is valid, so we can start reading the hidden revs
153 data = fh.read()
151 data = fh.read()
@@ -165,6 +163,11 b' def tryreadcache(repo, hideable):'
165 if fh:
163 if fh:
166 fh.close()
164 fh.close()
167
165
166 def tryreadcache(repo, hideable):
167 """read a cache if the cache exists and is valid, otherwise returns None."""
168 newhash = cachehash(repo, hideable)
169 return _readhiddencache(repo, cachefile, newhash)
170
168 def computehidden(repo):
171 def computehidden(repo):
169 """compute the set of hidden revision to filter
172 """compute the set of hidden revision to filter
170
173
General Comments 0
You need to be logged in to leave comments. Login now