D6156: branchcache: add attributes to track which nodes are verified
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Tue Mar 19 09:40:50 EDT 2019
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
Half of the cost of loading branchcache comes from verifiying all the nodes it
has. We don't need to verify all the nodes in all the cases. Sometimes we need
to verify only a set of nodes for a set of branches. We can ignore nodes of
other branches as we are not going to read them.
This patch introduces two attributes to branchcache class. _verifiedbranches is
a set which will tell the branches for which it's head nodes are verified.
_closedverified is a boolean which will tell whether all closednodes are
verified or not.
Another idea which I had was to keep a set of nodes which are verified, but it
will be more ugly and difficult to track things on node level.
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
@@ -162,6 +162,10 @@
self._closednodes = closednodes
self._entries = dict(entries)
+ # whether closed nodes are verified or not
+ self._closedverified = False
+ # branches for which nodes are verified
+ self._verifiedbranches = set()
@@ -231,8 +235,10 @@
r'node %s does not exist' % pycompat.sysstr(hex(node)))
if state == 'c':
+ self._closedverified = True
To: pulkit, #hg-reviewers
More information about the Mercurial-devel