sparse: kill SparseConfig.isroot flag

Summary: This was always set to True except in the empty-profile case, where it didn't make any difference.

Reviewed By: quark-zju

Differential Revision: D49928292

fbshipit-source-id: 46e4d3ca86b409e3b034f5734f4148bf767386f7
This commit is contained in:
Muir Manders 2023-10-05 14:14:25 -07:00 committed by Facebook GitHub Bot
parent 028b0d86ec
commit efc1bf339e

View File

@ -798,7 +798,6 @@ class SparseConfig:
mainrules = attr.ib(convert=list)
profiles = attr.ib(convert=tuple)
metadata = attr.ib(default=attr.Factory(dict))
isroot = attr.ib(default=False)
ruleorigins = attr.ib(default=attr.Factory(list))
def toincludeexclude(self):
@ -1130,19 +1129,14 @@ def computesparsematcher(
# mainrules above.
version = debugversion or profile.version()
if version != "1":
# Only union the profiles if we are the root level .hg/sparse profile.
if config.isroot:
matchers.append(
matchmod.rulesmatch(
repo.root,
"",
profile.rules,
ruledetails=profile.ruleorigins,
)
matchers.append(
matchmod.rulesmatch(
repo.root,
"",
profile.rules,
ruledetails=profile.ruleorigins,
)
else:
matchrules.extend(profile.rules)
ruleorigins.extend(profile.ruleorigins)
)
if matchrules:
matchers.append(
@ -1264,7 +1258,6 @@ def getsparsepatterns(
rules,
profiles,
rawconfig.metadata,
True, # isroot
ruleorigins,
)