예제 #1
0
 def __call__(self):
     output.warning('GIT repositories are not supported yet ' +\
                        '(only svn or gitsvn)')
     if len(self.args) == 0:
         output.error('package_name is required', exit=1)
     package_name = self.args[0]
     git.setup_gitsvn_cache()
     default_vcs = config.Configuration().default_vcs
     if default_vcs == 'git':
         # already checked out once?
         cache_path = os.path.join(git.get_gitsvn_cache_path(),
                                   package_name)
         if not os.path.isdir(cache_path):
             svn_url = self.get_svn_url(package_name)
             git.checkout_gitsvn(svn_url)
         else:
             # cache_path existing ; just update and clone
             runcmd('cd %s; git reset --hard' % cache_path)
             runcmd('cd %s; git svn fetch' % cache_path)
             runcmd('cd %s; git svn rebase' % cache_path)
             runcmd('cp -r %s .' % cache_path)
             runcmd('cd %s ; git checkout %s' % (
                     package_name,
                     'master',
                     ))
             git.apply_svn_ignores(package_name)
     elif default_vcs == 'svn':
         svn_url = self.get_svn_url(package_name)
         runcmd('svn co %s %s' % (
                 svn_url,
                 package_name))