@@ -25,18 +25,25 @@ def system(self, *args):
25
25
raise Exception ('Command failed: {}' .format (' ' .join (args )))
26
26
27
27
class CloneAction (Action ):
28
+ def __init__ (self , options , repo : str , branch : str ):
29
+ super ().__init__ (options )
30
+ self .repo = repo
31
+ self .repo_basename = repo .split ('/' )[- 1 ]
32
+ self .branch = branch
33
+
28
34
def run (self ):
29
- if os .path .exists ("../swift/.git" ):
35
+ repo_dir = os .path .join ('..' , self .repo_basename )
36
+ if os .path .exists (os .path .join (repo_dir , '.git' )):
30
37
return
31
38
print ('=====> Cloning Swift repository' )
32
39
git_options = []
33
40
if self .options .skip_history :
34
- git_options += ['--depth' , '1' , '--branch' , self .options . tag ]
41
+ git_options += ['--depth' , '1' , '--branch' , self .branch ]
35
42
36
- args = ['git' , 'clone' ] + git_options + ['https://github.com/apple/swift. git' , '../swift' ]
43
+ args = ['git' , 'clone' ] + git_options + [f 'https://github.com/{ self . repo } . git' , repo_dir ]
37
44
self .system (* args )
38
- print ('=====> Checking out Swift tag {}' .format (self .options . tag ))
39
- self .system ('git' , '-C' , '../swift' , 'checkout' , self .options . tag )
45
+ print ('=====> Checking out Swift tag {}' .format (self .branch ))
46
+ self .system ('git' , '-C' , repo_dir , 'checkout' , self .branch )
40
47
41
48
class UpdateCheckoutAction (Action ):
42
49
def run (self ):
0 commit comments