Skip to content

Add --fast flag to utils/update-checkout #1264

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
Feb 16, 2016
Merged
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
13 changes: 10 additions & 3 deletions utils/update-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def update_working_copy(repo_path, branch):
check_call(["git", "fetch"])
check_call(["git", "rebase", "FETCH_HEAD"])

def obtain_additional_swift_sources(with_ssh, branch):
def obtain_additional_swift_sources(with_ssh, branch, skip_history):
additional_repos = {
'llvm': 'apple/swift-llvm',
'clang': 'apple/swift-clang',
Expand All @@ -65,7 +65,10 @@ def obtain_additional_swift_sources(with_ssh, branch):
remote = "[email protected]:" + repo + '.git'
else:
remote = "https://github.com/" + repo + '.git'
check_call(['git', 'clone', remote, dir_name])
if skip_history:
check_call(['git', 'clone', '--depth', '1', remote, dir_name])
else:
check_call(['git', 'clone', remote, dir_name])
if branch:
src_path = SWIFT_SOURCE_ROOT + "/" + dir_name + "/" + ".git"
check_call(['git', '--git-dir', src_path, '--work-tree', os.path.join(SWIFT_SOURCE_ROOT, dir_name), 'checkout', branch])
Expand All @@ -83,16 +86,20 @@ By default, updates your checkouts of Swift, SourceKit, LLDB, and SwiftPM.""")
parser.add_argument("--clone-with-ssh",
help="Obtain Sources for Swift and Related Projects via SSH",
action="store_true")
parser.add_argument("--skip-history",
help="Skip histories when obtain sources",
action="store_true")
parser.add_argument("--branch",
help="Obtain Sources for specific branch")
args = parser.parse_args()

clone = args.clone
clone_with_ssh = args.clone_with_ssh
skip_history = args.skip_history
branch = args.branch

if clone or clone_with_ssh:
obtain_additional_swift_sources(clone_with_ssh, branch)
obtain_additional_swift_sources(clone_with_ssh, branch, skip_history)
return 0

update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "llbuild"), branch)
Expand Down