##// END OF EJS Templates
branchcache: add functions to validate changelog nodes...
Pulkit Goyal -
r42289:2f814752 default
parent child Browse files
Show More
@@ -126,6 +126,10 b' class BranchMapCache(object):'
126 def clear(self):
126 def clear(self):
127 self._per_filter.clear()
127 self._per_filter.clear()
128
128
129 def _unknownnode(node):
130 """ raises ValueError when branchcache found a node which does not exists
131 """
132 raise ValueError(r'node %s does not exist' % pycompat.sysstr(hex(node)))
129
133
130 class branchcache(object):
134 class branchcache(object):
131 """A dict like object that hold branches heads cache.
135 """A dict like object that hold branches heads cache.
@@ -173,6 +177,32 b' class branchcache(object):'
173 if self._hasnode is None:
177 if self._hasnode is None:
174 self._hasnode = lambda x: True
178 self._hasnode = lambda x: True
175
179
180 def _verifyclosed(self):
181 """ verify the closed nodes we have """
182 if self._closedverified:
183 return
184 for node in self._closednodes:
185 if not self._hasnode(node):
186 _unknownnode(node)
187
188 self._closedverified = True
189
190 def _verifybranch(self, branch):
191 """ verify head nodes for the given branch. If branch is None, verify
192 for all the branches """
193 if branch not in self._entries or branch in self._verifiedbranches:
194 return
195 for n in self._entries[branch]:
196 if not self._hasnode(n):
197 _unknownnode(n)
198
199 self._verifiedbranches.add(branch)
200
201 def _verifyall(self):
202 """ verifies nodes of all the branches """
203 for b in self._entries:
204 self._verifybranch(b)
205
176 def __iter__(self):
206 def __iter__(self):
177 return iter(self._entries)
207 return iter(self._entries)
178
208
General Comments 0
You need to be logged in to leave comments. Login now