696 # new tip revision which we found after iterating items from new |
696 # new tip revision which we found after iterating items from new |
697 # branches |
697 # branches |
698 if max_rev is not None and max_rev > self.tiprev: |
698 if max_rev is not None and max_rev > self.tiprev: |
699 self.tiprev = max_rev |
699 self.tiprev = max_rev |
700 self.tipnode = cl.node(max_rev) |
700 self.tipnode = cl.node(max_rev) |
|
701 else: |
|
702 # We should not be here is if this is false |
|
703 assert cl.node(self.tiprev) == self.tipnode |
701 |
704 |
702 if not self.validfor(repo): |
705 if not self.validfor(repo): |
703 # old cache key is now invalid for the repo, but we've just updated |
706 # the tiprev and tipnode should be aligned, so if the current repo |
704 # the cache and we assume it's valid, so let's make the cache key |
707 # is not seens as valid this is because old cache key is now |
705 # valid as well by recomputing it from the cached data |
708 # invalid for the repo. |
706 self.tipnode = repo.nullid |
709 # |
707 self.tiprev = nullrev |
710 # However. we've just updated the cache and we assume it's valid, |
708 for heads in self.iterheads(): |
711 # so let's make the cache key valid as well by recomputing it from |
709 if not heads: |
712 # the cached data |
710 # all revisions on a branch are obsolete |
713 self.filteredhash = scmutil.filteredhash( |
711 continue |
714 repo, self.tiprev, needobsolete=True |
712 # note: tiprev is not necessarily the tip revision of repo, |
715 ) |
713 # because the tip could be obsolete (i.e. not a head) |
716 |
714 tiprev = max(cl.rev(node) for node in heads) |
|
715 if tiprev > self.tiprev: |
|
716 self.tipnode = cl.node(tiprev) |
|
717 self.tiprev = tiprev |
|
718 self.filteredhash = scmutil.filteredhash( |
|
719 repo, self.tiprev, needobsolete=True |
|
720 ) |
|
721 self._state = STATE_DIRTY |
717 self._state = STATE_DIRTY |
722 tr = repo.currenttransaction() |
718 tr = repo.currenttransaction() |
723 if getattr(tr, 'finalized', True): |
719 if getattr(tr, 'finalized', True): |
724 # Avoid premature writing. |
720 # Avoid premature writing. |
725 # |
721 # |