Skip to content

Commit e5848cc

Browse files
committed
Merge pull request #1264 from takebayashi/fast-clone
Add --fast flag to utils/update-checkout
2 parents 284c4f8 + 59a046b commit e5848cc

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

utils/update-checkout

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def update_working_copy(repo_path, branch):
4444
check_call(["git", "fetch"])
4545
check_call(["git", "rebase", "FETCH_HEAD"])
4646

47-
def obtain_additional_swift_sources(with_ssh, branch):
47+
def obtain_additional_swift_sources(with_ssh, branch, skip_history):
4848
additional_repos = {
4949
'llvm': 'apple/swift-llvm',
5050
'clang': 'apple/swift-clang',
@@ -65,7 +65,10 @@ def obtain_additional_swift_sources(with_ssh, branch):
6565
remote = "[email protected]:" + repo + '.git'
6666
else:
6767
remote = "https://github.com/" + repo + '.git'
68-
check_call(['git', 'clone', remote, dir_name])
68+
if skip_history:
69+
check_call(['git', 'clone', '--depth', '1', remote, dir_name])
70+
else:
71+
check_call(['git', 'clone', remote, dir_name])
6972
if branch:
7073
src_path = SWIFT_SOURCE_ROOT + "/" + dir_name + "/" + ".git"
7174
check_call(['git', '--git-dir', src_path, '--work-tree', os.path.join(SWIFT_SOURCE_ROOT, dir_name), 'checkout', branch])
@@ -83,16 +86,20 @@ By default, updates your checkouts of Swift, SourceKit, LLDB, and SwiftPM.""")
8386
parser.add_argument("--clone-with-ssh",
8487
help="Obtain Sources for Swift and Related Projects via SSH",
8588
action="store_true")
89+
parser.add_argument("--skip-history",
90+
help="Skip histories when obtain sources",
91+
action="store_true")
8692
parser.add_argument("--branch",
8793
help="Obtain Sources for specific branch")
8894
args = parser.parse_args()
8995

9096
clone = args.clone
9197
clone_with_ssh = args.clone_with_ssh
98+
skip_history = args.skip_history
9299
branch = args.branch
93100

94101
if clone or clone_with_ssh:
95-
obtain_additional_swift_sources(clone_with_ssh, branch)
102+
obtain_additional_swift_sources(clone_with_ssh, branch, skip_history)
96103
return 0
97104

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

0 commit comments

Comments
 (0)