mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
sparse: remove default "**" for sparse profiles
Summary: In the v1 sparse config arrangement, if all rules were excludes then we would include a default "**" rule. This was always a little confusing and caused some weird behavior. Let's remove it from the v2 world. This actually bit us because the fbsource_exclude profile only has excludes, which caused it to insert a ** include, which pulled in all of fbsource. We could fix it to only check if a profile is excludes-only once all the transitive profiles have been loaded, but I think the cleaner fix is to remove this logic since it's confusing and never actually used in production. Differential Revision: D30824082 fbshipit-source-id: adcf4c820cc9f7636f79759d03fc0b387b9f55fa
This commit is contained in:
parent
a1426fcd74
commit
eed3ce44f3
@ -1027,7 +1027,7 @@ def _wraprepo(ui, repo):
|
||||
onlyv1 = True
|
||||
for kind, value in rawconfig.lines:
|
||||
if kind == "profile":
|
||||
profile = self.readsparseprofile(rev, value, version=None)
|
||||
profile = self.readsparseprofile(rev, value)
|
||||
if profile is not None:
|
||||
profiles.append(profile)
|
||||
# v1 config's put all includes before all excludes, so
|
||||
@ -1072,7 +1072,7 @@ def _wraprepo(ui, repo):
|
||||
rawconfig.metadata,
|
||||
)
|
||||
|
||||
def readsparseprofile(self, rev, name, version):
|
||||
def readsparseprofile(self, rev, name):
|
||||
ctx = self[rev]
|
||||
try:
|
||||
raw = self.getrawprofile(name, ctx.hex())
|
||||
@ -1089,15 +1089,13 @@ def _wraprepo(ui, repo):
|
||||
return None
|
||||
|
||||
rawconfig = self.readsparseconfig(raw, filename=name)
|
||||
if version is None:
|
||||
version = rawconfig.version()
|
||||
|
||||
rules = []
|
||||
profiles = set()
|
||||
for kind, value in rawconfig.lines:
|
||||
if kind == "profile":
|
||||
profiles.add(value)
|
||||
profile = self.readsparseprofile(rev, value, version)
|
||||
profile = self.readsparseprofile(rev, value)
|
||||
if profile is not None:
|
||||
for rule in profile.rules:
|
||||
rules.append(rule)
|
||||
@ -1108,11 +1106,6 @@ def _wraprepo(ui, repo):
|
||||
elif kind == "exclude":
|
||||
rules.append("!" + value)
|
||||
|
||||
# If all rules (excluding the default '.hg*') are exclude rules, add
|
||||
# an initial "**" to provide the default include of everything.
|
||||
if version != "1" and all(rule[0] == "!" for rule in rules):
|
||||
rules.insert(0, "**")
|
||||
|
||||
return SparseProfile(name, rules, profiles, rawconfig.metadata)
|
||||
|
||||
def _warnfullcheckout(self):
|
||||
|
Loading…
Reference in New Issue
Block a user