Show More
@@ -210,16 +210,20 b' class branchcache(object):' | |||
|
210 | 210 | self._entries[key] = value |
|
211 | 211 | |
|
212 | 212 | def __getitem__(self, key): |
|
213 | self._verifybranch(key) | |
|
213 | 214 | return self._entries[key] |
|
214 | 215 | |
|
215 | 216 | def __contains__(self, key): |
|
217 | self._verifybranch(key) | |
|
216 | 218 | return key in self._entries |
|
217 | 219 | |
|
218 | 220 | def iteritems(self): |
|
221 | self._verifyall() | |
|
219 | 222 | return self._entries.iteritems() |
|
220 | 223 | |
|
221 | 224 | def hasbranch(self, label): |
|
222 | 225 | """ checks whether a branch of this name exists or not """ |
|
226 | self._verifybranch(label) | |
|
223 | 227 | return label in self._entries |
|
224 | 228 | |
|
225 | 229 | @classmethod |
@@ -262,7 +266,6 b' class branchcache(object):' | |||
|
262 | 266 | def load(self, repo, lineiter): |
|
263 | 267 | """ fully loads the branchcache by reading from the file using the line |
|
264 | 268 | iterator passed""" |
|
265 | cl = repo.changelog | |
|
266 | 269 | for line in lineiter: |
|
267 | 270 | line = line.rstrip('\n') |
|
268 | 271 | if not line: |
@@ -272,14 +275,9 b' class branchcache(object):' | |||
|
272 | 275 | raise ValueError(r'invalid branch state') |
|
273 | 276 | label = encoding.tolocal(label.strip()) |
|
274 | 277 | node = bin(node) |
|
275 | if not cl.hasnode(node): | |
|
276 | raise ValueError( | |
|
277 | r'node %s does not exist' % pycompat.sysstr(hex(node))) | |
|
278 | 278 | self._entries.setdefault(label, []).append(node) |
|
279 | self._verifiedbranches.add(label) | |
|
280 | 279 | if state == 'c': |
|
281 | 280 | self._closednodes.add(node) |
|
282 | self._closedverified = True | |
|
283 | 281 | |
|
284 | 282 | @staticmethod |
|
285 | 283 | def _filename(repo): |
@@ -306,6 +304,7 b' class branchcache(object):' | |||
|
306 | 304 | otherwise return last closed head and true.''' |
|
307 | 305 | tip = heads[-1] |
|
308 | 306 | closed = True |
|
307 | self._verifyclosed() | |
|
309 | 308 | for h in reversed(heads): |
|
310 | 309 | if h not in self._closednodes: |
|
311 | 310 | tip = h |
@@ -320,9 +319,11 b' class branchcache(object):' | |||
|
320 | 319 | return self._branchtip(self[branch])[0] |
|
321 | 320 | |
|
322 | 321 | def iteropen(self, nodes): |
|
322 | self._verifyclosed() | |
|
323 | 323 | return (n for n in nodes if n not in self._closednodes) |
|
324 | 324 | |
|
325 | 325 | def branchheads(self, branch, closed=False): |
|
326 | self._verifybranch(branch) | |
|
326 | 327 | heads = self._entries[branch] |
|
327 | 328 | if not closed: |
|
328 | 329 | heads = list(self.iteropen(heads)) |
@@ -334,10 +335,12 b' class branchcache(object):' | |||
|
334 | 335 | |
|
335 | 336 | def iterheads(self): |
|
336 | 337 | """ returns all the heads """ |
|
338 | self._verifyall() | |
|
337 | 339 | return self._entries.itervalues() |
|
338 | 340 | |
|
339 | 341 | def copy(self): |
|
340 | 342 | """return an deep copy of the branchcache object""" |
|
343 | self._verifyall() | |
|
341 | 344 | return type(self)( |
|
342 | 345 | self._entries, self.tipnode, self.tiprev, self.filteredhash, |
|
343 | 346 | self._closednodes) |
General Comments 0
You need to be logged in to leave comments.
Login now