Skip to content

Updatecheckout fix #3823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utils/python-lint
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ if [[ $? != 0 ]]; then
echo "Could not change directory to '$SCRIPT_DIR/..'."
exit 1
fi
flake8
flake8 $@
13 changes: 11 additions & 2 deletions utils/update-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ sys.path.append(os.path.join(SCRIPT_DIR, 'swift_build_support'))
from swift_build_support import shell # noqa (E402)


def update_single_repository(repo_path, branch, reset_to_remote):
def update_single_repository(repo_path, branch, reset_to_remote, should_clean):
if not os.path.isdir(repo_path):
return

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

if should_clean:
shell.call(['git', 'clean', '-fdx'],
echo=False)

if branch:
status = shell.capture(['git', 'status', '--porcelain', '-uno'],
echo=False)
Expand Down Expand Up @@ -83,7 +87,8 @@ def update_all_repositories(args, config, scheme_name):

update_single_repository(os.path.join(SWIFT_SOURCE_ROOT, repo_name),
repo_branch,
args.reset_to_remote)
args.reset_to_remote,
args.clean)


def obtain_additional_swift_sources(
Expand Down Expand Up @@ -194,6 +199,10 @@ By default, updates your checkouts of Swift, SourceKit, LLDB, and SwiftPM.""")
'--reset-to-remote',
help='Reset each branch to the remote state.',
action='store_true')
parser.add_argument(
'--clean',
help='Clean unrelated files from each repository.',
action='store_true')
parser.add_argument(
"--config",
default=os.path.join(SCRIPT_DIR, "update-checkout-config.json"),
Expand Down