コード例 #1
0
ファイル: project.py プロジェクト: CambrianTech/clowder-1
 def herd(self):
     """Clone project or update latest from upstream"""
     self._print_status()
     if not os.path.isdir(os.path.join(self.full_path(), '.git')):
         git_clone_url_at_path(self.url, self.full_path(), self.ref, self.remote_name)
     else:
         ref_type = git_ref_type(self.ref)
         if ref_type is 'branch':
             git_create_remote(self.full_path(), self.remote_name, self.url)
             git_fetch(self.full_path())
             git_checkout_ref(self.full_path(), self.ref, self.remote_name)
             branch = git_truncate_ref(self.ref)
             git_pull_remote_branch(self.full_path(), self.remote_name, branch)
         elif ref_type is 'tag' or ref_type is 'sha':
             git_create_remote(self.full_path(), self.remote_name, self.url)
             git_fetch(self.full_path())
             git_checkout_ref(self.full_path(), self.ref, self.remote_name)
         else:
             print('Unknown ref ' + self.ref)
コード例 #2
0
 def test_git_ref_type_unknown(self):
     """Test git_ref_type() function for unknown ref type"""
     self.assertEqual(git_ref_type('42'), 'unknown')
コード例 #3
0
 def test_git_ref_type_sha(self):
     """Test git_ref_type() function for sha ref"""
     self.assertEqual(git_ref_type(self.sha_ref), 'sha')
コード例 #4
0
 def test_git_ref_type_tag(self):
     """Test git_ref_type() function for tag ref"""
     self.assertEqual(git_ref_type(self.tag_ref), 'tag')
コード例 #5
0
 def test_git_ref_type_branch(self):
     """Test git_ref_type() function for branch ref"""
     self.assertEqual(git_ref_type(self.branch_ref), 'branch')