This patch adds functions to validate closed nodes, validate nodes for a certain
branch and for all the branches. These functions will be used in upcoming
patches.
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG2f8147521e59: branchcache: add functions to validate changelog nodes
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
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.
In _verifyall(), I changed code to calculate a needverification set and then iterate over it.
The motivation behind iteritems() change (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?
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.
Okay, got that, thanks.
Maybe we can iterate over verified nodes first, and then iterate over unverified nodes?
Maybe no. I don't think it's more likely for callers to get any verified node
and stop the iteration.