Page MenuHomePhabricator

branchcache: update the filteredhash if we update the tiprev
Needs ReviewPublic

Authored by pulkit on Apr 26 2019, 7:22 PM.


Group Reviewers

We update the tiprev and in next if statement we check whether the branchcache
is valid or not. If the update of tiprev happens, then definitely
self.validfor() will return False because filteredhash is old now.

Let's update the filteredhash if we update the tiprev also. This prevents us
from entering the loop where we iter all the heads, and find the tiprev.

Diff Detail

rHG Mercurial
Lint Skipped
Unit Tests Skipped

Event Timeline

pulkit created this revision.Apr 26 2019, 7:22 PM
yuja added a subscriber: yuja.Apr 28 2019, 4:38 AM
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)

This seems useful but lingering. @pulkit what's the status of this.