예제 #1
0
파일: git_tests.py 프로젝트: jhford/uplift
 def test_cherry_pick_commit_not_on_upstream(self):
     contents = [{'A': '1', 'B': '2'}]
     commits = self.create_repo(contents)
     subject.checkout(self.scratch, branch_name='branch')
     branch_contents = [{'C': '3'}]
     branch_commits = self.create_commits(branch_contents)
     subject.checkout(self.scratch, branch_name='other_branch')
     with self.assertRaises(subject.GitError):
         subject.cherry_pick(self.scratch, branch_commits[0], 'other_branch', 'master')
예제 #2
0
파일: git_tests.py 프로젝트: jhford/uplift
 def test_cherry_pick_commit_not_merge_commit(self):
     contents = [{'A': '1', 'B': '2'}]
     commits = self.create_repo(contents)
     subject.checkout(self.scratch, branch_name='newbranch', tracking='master')
     subject.checkout(self.scratch, 'master')
     new_master_contents = [{'A': '3'}]
     new_master_commits = self.create_commits(new_master_contents)
     branch_commit = subject.cherry_pick(self.scratch, new_master_commits[0], 'newbranch')
     self.assertTrue(subject.commit_on_branch(self.scratch, branch_commit, 'newbranch'))
     self.assertFalse(subject.commit_on_branch(self.scratch, branch_commit, 'master'))
예제 #3
0
파일: git_tests.py 프로젝트: jhford/uplift
 def test_merge_ff(self):
     contents = [{'A': '1'}]
     branch_contents = [{'A': '2'}]
     commits = self.create_repo(contents)
     subject.checkout(self.scratch, branch_name='newbranch')
     branch_commits = self.create_commits(branch_contents)
     subject.checkout(self.scratch, 'master')
     
     subject.merge(self.scratch, 'newbranch', ff_only=True)
     self.assertEqual(branch_commits[0], subject.get_rev(self.scratch, id='master'))
     self.assertEqual(1, len(subject.find_parents(self.scratch, 'master')))
예제 #4
0
파일: git_tests.py 프로젝트: jhford/uplift
 def test_merge_non_ff(self):
     contents = [{'A': '1'}]
     branch_contents = [{'A': '2'}]
     new_master_contents = [{'A': '4'}]
     commits = self.create_repo(contents)
     subject.checkout(self.scratch, branch_name='newbranch')
     branch_commits = self.create_commits(branch_contents)
     subject.checkout(self.scratch, 'master')
     new_master_commits = self.create_commits(new_master_contents)
     
     with self.assertRaises(subject.GitError):
         subject.merge(self.scratch, 'newbranch', ff_only=True)
         #subject.reset(self.scratch)
     subject.merge(self.scratch, 'newbranch', ff_only=False, strategy='ours')
     self.assertEqual(2, len(subject.find_parents(self.scratch, 'master')))
예제 #5
0
파일: git_tests.py 프로젝트: jhford/uplift
    def test_for_real_clean(self):
        contents = [{'A': x} for x in range(5)] 
        common_commits = self.create_repos(2, contents)
        new_content = [{'A': x} for x in range(5, 10)]
        new_commits = self.create_commits(1, new_content)
        subject.checkout(self.scratch[0], branch_name='notmaster')
        
        expected = {
            'url': os.path.abspath(self.scratch[0]),
            'branches':{
                'master': (common_commits[-1], new_commits[-1])
            }
        }
        actual = subject.push(self.scratch[1], 'origin', ['master'], dry_run=False)

        self.assertEqual(new_commits[0],
            subject.get_rev(self.scratch[0], new_commits[0][:7]))
예제 #6
0
파일: git_tests.py 프로젝트: jhford/uplift
 def test_checkout(self):
     contents = [{'A': '1'}]
     commits = self.create_repo(contents)
     subject.checkout(self.scratch, 'master')
     self.assertEqual('master', subject.current_branch(self.scratch))
     subject.checkout(self.scratch, branch_name='newbranch2')
     self.assertEqual('newbranch2', subject.current_branch(self.scratch))
     subject.checkout(self.scratch, 'master')
     self.assertEqual('master', subject.current_branch(self.scratch))
예제 #7
0
파일: git_tests.py 프로젝트: jhford/uplift
 def test_cherry_pick_commit_is_merge_commit(self):
     contents = [{'A': '1', 'B': '2'}]
     commits = self.create_repo(contents)
     subject.checkout(self.scratch, branch_name='newbranch', tracking='master')
     subject.checkout(self.scratch, branch_name='pr_branch', tracking='master')
     pr_contents = [{'C': '3'}]
     pr_commits = self.create_commits(pr_contents)
     subject.checkout(self.scratch, 'master')
     subject.merge(self.scratch, 'pr_branch', no_ff=True)
     merge_commit = subject.get_rev(self.scratch)
     self.assertEqual(sorted([pr_commits[0], commits[-1]]), sorted(subject.find_parents(self.scratch, merge_commit)))
     branch_commit = subject.cherry_pick(self.scratch, merge_commit, 'newbranch')
     self.assertTrue(subject.commit_on_branch(self.scratch, branch_commit, 'newbranch'))
     self.assertFalse(subject.commit_on_branch(self.scratch, branch_commit, 'master'))
예제 #8
0
파일: git_tests.py 프로젝트: jhford/uplift
 def test_cherry_pick_noop(self):
     contents = [{'A': '1'}]
     commits = self.create_repo(contents)
     subject.checkout(self.scratch, tracking='master', branch_name='other')
     with self.assertRaises(subject.GitNoop):
         result = subject.cherry_pick(self.scratch, commits[0], 'other', 'master')