D6312: branchcache: update the filteredhash if we update the tiprev

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Sun Apr 28 04:38:39 EDT 2019

yuja added a comment.

  >   if ntiprev > self.tiprev:
  >       self.tiprev = ntiprev
  >       self.tipnode = cl.node(ntiprev)
  > +            self.filteredhash = scmutil.filteredhash(repo, self.tiprev)
  >   if not self.validfor(repo):
  >       # cache key are not valid anymore
  and update `self.filteredhash` later again, which smells. Instead, shouldn't
  we check the validity first, and take the fast path only if it was valid?
    if self.validfor(repo):  # was valid, can take fast path
        self.tiprev = ntiprev
        self.tipnode = cl.node(ntiprev)
    else:  # bad luck, recompute tiprev/tipnode
    self.filteredhash = scmutil.filteredhash(repo, self.tiprev)

  rHG Mercurial


To: pulkit, #hg-reviewers
Cc: yuja, mercurial-devel

More information about the Mercurial-devel mailing list