D6207: branchcache: add functions to validate changelog nodes

Yuya Nishihara yuya at tcha.org
Mon Apr 15 19:14:58 EDT 2019


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 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.


More information about the Mercurial-devel mailing list