@@ -44,7 +44,7 @@ def update_working_copy(repo_path, branch):
44
44
check_call (["git" , "fetch" ])
45
45
check_call (["git" , "rebase" , "FETCH_HEAD" ])
46
46
47
- def obtain_additional_swift_sources (with_ssh , branch ):
47
+ def obtain_additional_swift_sources (with_ssh , branch , skip_history ):
48
48
additional_repos = {
49
49
'llvm' : 'apple/swift-llvm' ,
50
50
'clang' : 'apple/swift-clang' ,
@@ -65,7 +65,10 @@ def obtain_additional_swift_sources(with_ssh, branch):
65
65
remote = "[email protected] :" + repo + '.git'
66
66
else :
67
67
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 ])
69
72
if branch :
70
73
src_path = SWIFT_SOURCE_ROOT + "/" + dir_name + "/" + ".git"
71
74
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.""")
83
86
parser .add_argument ("--clone-with-ssh" ,
84
87
help = "Obtain Sources for Swift and Related Projects via SSH" ,
85
88
action = "store_true" )
89
+ parser .add_argument ("--skip-history" ,
90
+ help = "Skip histories when obtain sources" ,
91
+ action = "store_true" )
86
92
parser .add_argument ("--branch" ,
87
93
help = "Obtain Sources for specific branch" )
88
94
args = parser .parse_args ()
89
95
90
96
clone = args .clone
91
97
clone_with_ssh = args .clone_with_ssh
98
+ skip_history = args .skip_history
92
99
branch = args .branch
93
100
94
101
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 )
96
103
return 0
97
104
98
105
update_working_copy (os .path .join (SWIFT_SOURCE_ROOT , "llbuild" ), branch )
0 commit comments