Skip to content

Commit 54eccc0

Browse files
authored
Merge pull request #3823 from gottesmm/updatecheckout-fix
Updatecheckout fix
2 parents c3646f2 + e9baa29 commit 54eccc0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

utils/python-lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ if [[ $? != 0 ]]; then
1313
echo "Could not change directory to '$SCRIPT_DIR/..'."
1414
exit 1
1515
fi
16-
flake8
16+
flake8 $@

utils/update-checkout

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,18 @@ sys.path.append(os.path.join(SCRIPT_DIR, 'swift_build_support'))
3232
from swift_build_support import shell # noqa (E402)
3333

3434

35-
def update_single_repository(repo_path, branch, reset_to_remote):
35+
def update_single_repository(repo_path, branch, reset_to_remote, should_clean):
3636
if not os.path.isdir(repo_path):
3737
return
3838

3939
print("--- Updating '" + repo_path + "' ---")
4040
with shell.pushd(repo_path, dry_run=False, echo=False):
4141
shell.call(["git", "fetch"], echo=False)
4242

43+
if should_clean:
44+
shell.call(['git', 'clean', '-fdx'],
45+
echo=False)
46+
4347
if branch:
4448
status = shell.capture(['git', 'status', '--porcelain', '-uno'],
4549
echo=False)
@@ -83,7 +87,8 @@ def update_all_repositories(args, config, scheme_name):
8387

8488
update_single_repository(os.path.join(SWIFT_SOURCE_ROOT, repo_name),
8589
repo_branch,
86-
args.reset_to_remote)
90+
args.reset_to_remote,
91+
args.clean)
8792

8893

8994
def obtain_additional_swift_sources(
@@ -194,6 +199,10 @@ By default, updates your checkouts of Swift, SourceKit, LLDB, and SwiftPM.""")
194199
'--reset-to-remote',
195200
help='Reset each branch to the remote state.',
196201
action='store_true')
202+
parser.add_argument(
203+
'--clean',
204+
help='Clean unrelated files from each repository.',
205+
action='store_true')
197206
parser.add_argument(
198207
"--config",
199208
default=os.path.join(SCRIPT_DIR, "update-checkout-config.json"),

0 commit comments

Comments
 (0)