Show More
@@ -3477,7 +3477,7 b' def reposetup(ui, repo):' | |||||
3477 |
|
3477 | |||
3478 | return result |
|
3478 | return result | |
3479 |
|
3479 | |||
3480 |
def _ |
|
3480 | def _cacheabletip(self): | |
3481 | q = self.mq |
|
3481 | q = self.mq | |
3482 | cl = self.changelog |
|
3482 | cl = self.changelog | |
3483 | qbase = None |
|
3483 | qbase = None | |
@@ -3492,25 +3492,10 b' def reposetup(ui, repo):' | |||||
3492 | except error.LookupError: |
|
3492 | except error.LookupError: | |
3493 | self.ui.warn(_('mq status file refers to unknown node %s\n') |
|
3493 | self.ui.warn(_('mq status file refers to unknown node %s\n') | |
3494 | % short(qbasenode)) |
|
3494 | % short(qbasenode)) | |
3495 | if qbase is None: |
|
3495 | ret = super(mqrepo, self)._cacheabletip() | |
3496 | return super(mqrepo, self)._branchtags(partial, lrev) |
|
3496 | if qbase is not None: | |
3497 |
|
3497 | ret = min(qbase - 1, ret) | ||
3498 |
|
|
3498 | return ret | |
3499 | if start < qbase: |
|
|||
3500 | # update the cache (excluding the patches) and save it |
|
|||
3501 | ctxgen = (self[r] for r in xrange(lrev + 1, qbase)) |
|
|||
3502 | self._updatebranchcache(partial, ctxgen) |
|
|||
3503 | self._writebranchcache(partial, cl.node(qbase - 1), qbase - 1) |
|
|||
3504 | start = qbase |
|
|||
3505 | # if start = qbase, the cache is as updated as it should be. |
|
|||
3506 | # if start > qbase, the cache includes (part of) the patches. |
|
|||
3507 | # we might as well use it, but we won't save it. |
|
|||
3508 |
|
||||
3509 | # update the cache up to the tip |
|
|||
3510 | ctxgen = (self[r] for r in xrange(start, len(cl))) |
|
|||
3511 | self._updatebranchcache(partial, ctxgen) |
|
|||
3512 |
|
||||
3513 | return partial |
|
|||
3514 |
|
3499 | |||
3515 | if repo.local(): |
|
3500 | if repo.local(): | |
3516 | repo.__class__ = mqrepo |
|
3501 | repo.__class__ = mqrepo |
@@ -649,14 +649,37 b' class localrepository(object):' | |||||
649 | marks.append(bookmark) |
|
649 | marks.append(bookmark) | |
650 | return sorted(marks) |
|
650 | return sorted(marks) | |
651 |
|
651 | |||
|
652 | def _cacheabletip(self): | |||
|
653 | """tip-most revision stable enought to used in persistent cache | |||
|
654 | ||||
|
655 | This function is overwritten by MQ to ensure we do not write cache for | |||
|
656 | a part of the history that will likely change. | |||
|
657 | ||||
|
658 | Efficient handling of filtered revision in branchcache should offer a | |||
|
659 | better alternative. But we are using this approach until it is ready. | |||
|
660 | """ | |||
|
661 | cl = self.changelog | |||
|
662 | return cl.rev(cl.tip()) | |||
|
663 | ||||
652 | def _branchtags(self, partial, lrev): |
|
664 | def _branchtags(self, partial, lrev): | |
653 | # TODO: rename this function? |
|
665 | # TODO: rename this function? | |
|
666 | cl = self.changelog | |||
|
667 | catip = self._cacheabletip() | |||
|
668 | # if lrev == catip: cache is already up to date | |||
|
669 | # if lrev > catip: we have uncachable element in `partial` can't write | |||
|
670 | # on disk | |||
|
671 | if lrev < catip: | |||
|
672 | ctxgen = (self[r] for r in cl.revs(lrev + 1, catip)) | |||
|
673 | self._updatebranchcache(partial, ctxgen) | |||
|
674 | self._writebranchcache(partial, cl.node(catip), catip) | |||
|
675 | lrev = catip | |||
|
676 | # If cacheable tip were lower than actual tip, we need to update the | |||
|
677 | # cache up to tip. This update (from cacheable to actual tip) is not | |||
|
678 | # written to disk since it's not cacheable. | |||
654 | tiprev = len(self) - 1 |
|
679 | tiprev = len(self) - 1 | |
655 |
if lrev |
|
680 | if lrev < tiprev: | |
656 |
ctxgen = (self[r] for r in |
|
681 | ctxgen = (self[r] for r in cl.revs(lrev + 1, tiprev)) | |
657 | self._updatebranchcache(partial, ctxgen) |
|
682 | self._updatebranchcache(partial, ctxgen) | |
658 | self._writebranchcache(partial, self.changelog.tip(), tiprev) |
|
|||
659 |
|
||||
660 | return partial |
|
683 | return partial | |
661 |
|
684 | |||
662 | @unfilteredmethod # Until we get a smarter cache management |
|
685 | @unfilteredmethod # Until we get a smarter cache management |
General Comments 0
You need to be logged in to leave comments.
Login now