##// END OF EJS Templates
localrepo: change _updatebranchcache to use a context generator
Sune Foldager -
r10770:fe39f016 stable
parent child Browse files
Show More
@@ -2603,7 +2603,8 b' def reposetup(ui, repo):'
2603 2603 start = lrev + 1
2604 2604 if start < qbase:
2605 2605 # update the cache (excluding the patches) and save it
2606 self._updatebranchcache(partial, lrev + 1, qbase)
2606 ctxgen = (self[r] for r in xrange(lrev + 1, qbase))
2607 self._updatebranchcache(partial, ctxgen)
2607 2608 self._writebranchcache(partial, cl.node(qbase - 1), qbase - 1)
2608 2609 start = qbase
2609 2610 # if start = qbase, the cache is as updated as it should be.
@@ -2611,7 +2612,8 b' def reposetup(ui, repo):'
2611 2612 # we might as well use it, but we won't save it.
2612 2613
2613 2614 # update the cache up to the tip
2614 self._updatebranchcache(partial, start, len(cl))
2615 ctxgen = (self[r] for r in xrange(start, len(cl)))
2616 self._updatebranchcache(partial, ctxgen)
2615 2617
2616 2618 return partial
2617 2619
@@ -320,7 +320,8 b' class localrepository(repo.repository):'
320 320 # TODO: rename this function?
321 321 tiprev = len(self) - 1
322 322 if lrev != tiprev:
323 self._updatebranchcache(partial, lrev + 1, tiprev + 1)
323 ctxgen = (self[r] for r in xrange(lrev + 1, tiprev + 1))
324 self._updatebranchcache(partial, ctxgen)
324 325 self._writebranchcache(partial, self.changelog.tip(), tiprev)
325 326
326 327 return partial
@@ -398,11 +399,10 b' class localrepository(repo.repository):'
398 399 except (IOError, OSError):
399 400 pass
400 401
401 def _updatebranchcache(self, partial, start, end):
402 def _updatebranchcache(self, partial, ctxgen):
402 403 # collect new branch entries
403 404 newbranches = {}
404 for r in xrange(start, end):
405 c = self[r]
405 for c in ctxgen:
406 406 newbranches.setdefault(c.branch(), []).append(c.node())
407 407 # if older branchheads are reachable from new ones, they aren't
408 408 # really branchheads. Note checking parents is insufficient:
General Comments 0
You need to be logged in to leave comments. Login now