D6312: branchcache: update the filteredhash if we update the tiprev
This revision now requires changes to proceed. baymax added a comment. baymax requested changes to this revision. There seems to have been no activities on this Diff for the past 3 Months. By policy, we are automatically moving it out of the `need-review` state. Please, move it back to `need-review` without hesitation if this diff should still be discussed. :baymax:need-review-idle: REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6312/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6312 To: pulkit, #hg-reviewers, baymax Cc: mercurial-patches, marmoute, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6312: branchcache: update the filteredhash if we update the tiprev
Herald added a subscriber: mercurial-patches. marmoute added a comment. reping REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6312/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6312 To: pulkit, #hg-reviewers Cc: mercurial-patches, marmoute, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6312: branchcache: update the filteredhash if we update the tiprev
marmoute added a comment. This seems useful but lingering. @pulkit what's the status of this. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6312/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6312 To: pulkit, #hg-reviewers Cc: marmoute, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6312: branchcache: update the filteredhash if we update the tiprev
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) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6312 To: pulkit, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D6312: branchcache: update the filteredhash if we update the tiprev
> 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) ``` ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6312: branchcache: update the filteredhash if we update the tiprev
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 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. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6312 AFFECTED FILES mercurial/branchmap.py CHANGE DETAILS diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -411,6 +411,7 @@ 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 To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel