mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
perftweaks: access inner map for dirstate types other than treedirstate
D1410 added support for treedirstate when collecting dirstate_size for sampling. However, it also changed from querying the inner dirstate map (which is not available with treedirstate) to the outer map. This breaks Eden, which prevents calls to `__len__` on the outer map. Revert the change for non-treedirstate dirstates, and handle treedirstate explicitly. Differential Revision: https://phab.mercurial-scm.org/D1530
This commit is contained in:
parent
4bce5b2bbc
commit
55f8d37a82
@ -257,12 +257,13 @@ def _trackdirstatesizes(runcommand, lui, repo, *args):
|
||||
res = runcommand(lui, repo, *args)
|
||||
if repo is not None and repo.local():
|
||||
dirstate = repo.dirstate
|
||||
# if the _map attribute is missing on the map, the dirstate was not
|
||||
# loaded.
|
||||
if (('_map' in vars(dirstate) and '_map' in vars(dirstate._map)) or
|
||||
('treedirstate' in getattr(repo, 'requirements', set()))):
|
||||
lui.log('dirstate_size', '',
|
||||
dirstate_size=len(dirstate._map))
|
||||
if 'treedirstate' in getattr(repo, 'requirements', set()):
|
||||
# Treedirstate always has the dirstate size available.
|
||||
lui.log('dirstate_size', '', dirstate_size=len(dirstate._map))
|
||||
elif '_map' in vars(dirstate) and '_map' in vars(dirstate._map):
|
||||
# For other dirstate types, access the inner map directly. If the
|
||||
# _map attribute is missing on the map, the dirstate was not loaded.
|
||||
lui.log('dirstate_size', '', dirstate_size=len(dirstate._map._map))
|
||||
return res
|
||||
|
||||
def _tracksparseprofiles(runcommand, lui, repo, *args):
|
||||
|
Loading…
Reference in New Issue
Block a user