D6207: branchcache: add functions to validate changelog nodes

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Tue Apr 16 08:35:31 EDT 2019


pulkit added a comment.


  In https://phab.mercurial-scm.org/D6207#90778, @yuja wrote:
  
  > Queued, thanks.
  >
  > > +    def _verifybranch(self, branch):
  > >  +        """ verify head nodes for the given branch. If branch is None, verify
  > >  +        for all the branches """
  >
  > "If branch is None, ..." appears wrong.
  >
  > > +        if branch not in self._entries or branch in self._verifiedbranches:
  > >  +            return
  > >  +        for n in self._entries[branch]:
  > >  +            if not self._hasnode(n):
  > >  +                _unknownnode(n)
  > >  +
  > >  +        self._verifiedbranches.add(branch)
  >
  > Regarding https://phab.mercurial-scm.org/D6236, `_verifiedbranches` could be inverted (i.e. a set of branches
  >  to be verified) so that `_verifyall()` can return early. I don't know which
  >  will be faster, but in principle, fewer loops and Python gives a better result.
  
  
  In _verifyall(), I changed code to calculate a needverification set and then iterate over it.
  
  The motivation behind iteritems() change (https://phab.mercurial-scm.org/D6236) is optimizing https://www.mercurial-scm.org/repo/hg-committed/file/70b71421fd33/mercurial/commands.py#l1128.
  
  Maybe we can iterate over verified nodes first, and then iterate over unverified nodes?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6207

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


More information about the Mercurial-devel mailing list