@@ -25,18 +25,25 @@ def system(self, *args):
2525 raise Exception ('Command failed: {}' .format (' ' .join (args )))
2626
2727class 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+
2834 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' )):
3037 return
3138 print ('=====> Cloning Swift repository' )
3239 git_options = []
3340 if self .options .skip_history :
34- git_options += ['--depth' , '1' , '--branch' , self .options . tag ]
41+ git_options += ['--depth' , '1' , '--branch' , self .branch ]
3542
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 ]
3744 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 )
4047
4148class UpdateCheckoutAction (Action ):
4249 def run (self ):
0 commit comments