Skip to content

Commit 34099d4

Browse files
committed
Force branch-scheme aliases to include the scheme name.
1 parent b46ce6c commit 34099d4

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

utils/update-checkout

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def update_repository_to_scheme(
9797
cross_repo = False
9898
repo_branch = scheme_name
9999
# This loop is only correct, since we know that each alias set has
100-
# unique contents. This is checked by verify config. Thus the first
100+
# unique contents. This is checked by validate_config. Thus the first
101101
# branch scheme data that has scheme_name as one of its aliases is
102102
# the only possible correct answer.
103103
for v in config['branch-schemes'].values():
@@ -241,6 +241,14 @@ def validate_config(config):
241241
if len(scheme_names) != len(set(scheme_names)):
242242
raise RuntimeError('Configuration file has duplicate schemes?!')
243243

244+
# Ensure the branch-scheme name is also an alias
245+
# This guarantees sensible behavior of update_repository_to_scheme when
246+
# the branch-scheme is passed as the scheme name
247+
for scheme_name in config['branch-schemes'].keys():
248+
if not scheme_name in config['branch-schemes'][scheme_name]['aliases']:
249+
raise RuntimeError('branch-scheme name: "{0}" must be an alias too.'
250+
.format(scheme_name))
251+
244252
# Then make sure the alias names used by our branches are unique.
245253
#
246254
# We do this by constructing a list consisting of len(names),

utils/update-checkout-config.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
}
5151
},
5252
"next" : {
53-
"aliases": ["master-next", "stable-next"],
53+
"aliases": ["next", "master-next", "stable-next"],
5454
"repos": {
5555
"llvm": "stable-next",
5656
"clang": "stable-next",
@@ -104,7 +104,7 @@
104104
}
105105
},
106106
"swift-3.0-preview-1" : {
107-
"aliases": ["swift-3.0-preview-1-branch"],
107+
"aliases": ["swift-3.0-preview-1", "swift-3.0-preview-1-branch"],
108108
"repos": {
109109
"llvm": "swift-3.0-branch",
110110
"clang": "swift-3.0-branch",
@@ -121,7 +121,7 @@
121121
}
122122
},
123123
"swift-3.0-preview-2" : {
124-
"aliases": ["swift-3.0-preview-2-branch"],
124+
"aliases": ["swift-3.0-preview-2", "swift-3.0-preview-2-branch"],
125125
"repos": {
126126
"llvm": "swift-3.0-branch",
127127
"clang": "swift-3.0-branch",
@@ -138,7 +138,7 @@
138138
}
139139
},
140140
"swift-3.0-preview-3" : {
141-
"aliases": ["swift-3.0-preview-3-branch"],
141+
"aliases": ["swift-3.0-preview-3", "swift-3.0-preview-3-branch"],
142142
"repos": {
143143
"llvm": "swift-3.0-branch",
144144
"clang": "swift-3.0-branch",
@@ -155,7 +155,7 @@
155155
}
156156
},
157157
"swift-3.0-preview-4" : {
158-
"aliases": ["swift-3.0-preview-4-branch"],
158+
"aliases": ["swift-3.0-preview-4", "swift-3.0-preview-4-branch"],
159159
"repos": {
160160
"llvm": "swift-3.0-branch",
161161
"clang": "swift-3.0-branch",
@@ -173,7 +173,7 @@
173173
}
174174
},
175175
"swift-3.0-preview-5" : {
176-
"aliases": ["swift-3.0-preview-5-branch"],
176+
"aliases": ["swift-3.0-preview-5", "swift-3.0-preview-5-branch"],
177177
"repos": {
178178
"llvm": "swift-3.0-branch",
179179
"clang": "swift-3.0-branch",

0 commit comments

Comments
 (0)