##// END OF EJS Templates
branchcache: have a hasnode function to validate nodes...
Pulkit Goyal -
r42174:b5511845 default
parent child Browse files
Show More
@@ -150,7 +150,10 b' class branchcache(object):'
150 """
150 """
151
151
152 def __init__(self, entries=(), tipnode=nullid, tiprev=nullrev,
152 def __init__(self, entries=(), tipnode=nullid, tiprev=nullrev,
153 filteredhash=None, closednodes=None):
153 filteredhash=None, closednodes=None, hasnode=None):
154 """ hasnode is a function which can be used to verify whether changelog
155 has a given node or not. If it's not provided, we assume that every node
156 we have exists in changelog """
154 self.tipnode = tipnode
157 self.tipnode = tipnode
155 self.tiprev = tiprev
158 self.tiprev = tiprev
156 self.filteredhash = filteredhash
159 self.filteredhash = filteredhash
@@ -166,6 +169,9 b' class branchcache(object):'
166 self._closedverified = False
169 self._closedverified = False
167 # branches for which nodes are verified
170 # branches for which nodes are verified
168 self._verifiedbranches = set()
171 self._verifiedbranches = set()
172 self._hasnode = hasnode
173 if self._hasnode is None:
174 self._hasnode = lambda x: True
169
175
170 def __iter__(self):
176 def __iter__(self):
171 return iter(self._entries)
177 return iter(self._entries)
@@ -193,9 +199,11 b' class branchcache(object):'
193 last, lrev = cachekey[:2]
199 last, lrev = cachekey[:2]
194 last, lrev = bin(last), int(lrev)
200 last, lrev = bin(last), int(lrev)
195 filteredhash = None
201 filteredhash = None
202 hasnode = repo.changelog.hasnode
196 if len(cachekey) > 2:
203 if len(cachekey) > 2:
197 filteredhash = bin(cachekey[2])
204 filteredhash = bin(cachekey[2])
198 bcache = cls(tipnode=last, tiprev=lrev, filteredhash=filteredhash)
205 bcache = cls(tipnode=last, tiprev=lrev, filteredhash=filteredhash,
206 hasnode=hasnode)
199 if not bcache.validfor(repo):
207 if not bcache.validfor(repo):
200 # invalidate the cache
208 # invalidate the cache
201 raise ValueError(r'tip differs')
209 raise ValueError(r'tip differs')
General Comments 0
You need to be logged in to leave comments. Login now