Пример #1
0
    def test_nonexistent_remote(self):
        old_rev = git_utils.get_latest_commit('master')
        check_call_silent(['git', 'fetch', 'origin'])
        git_utils.try_rebase_branch('upstream', 'master')
        new_rev = git_utils.get_latest_commit('master')

        self.assertEqual(old_rev, new_rev)
Пример #2
0
    def test_ahead(self):
        commit_files(['file2.txt'], 'add file2')
        old_rev = git_utils.get_latest_commit('master')

        git_utils.try_rebase_branch('origin', 'master')
        new_rev = git_utils.get_latest_commit('master')
        self.assertEqual(old_rev, new_rev)
Пример #3
0
    def test_nonexistent_local(self):
        check_call_silent(['git', 'checkout', '-b', 'branch'])
        check_call_silent(['git', 'branch', '-d', 'master'])
        with pushd(self.origin):
            origin_rev = git_utils.get_latest_commit('master')

        git_utils.try_rebase_branch('origin', 'master')
        local_rev = git_utils.get_latest_commit('master')
        self.assertEqual(local_rev, origin_rev)
Пример #4
0
    def test_behind(self):
        old_rev = git_utils.get_latest_commit('master')
        with pushd(self.origin):
            commit_files(['file2.txt'], 'add file2')
            origin_rev = git_utils.get_latest_commit('master')
        check_call_silent(['git', 'fetch', 'origin'])

        git_utils.try_rebase_branch('origin', 'master')
        new_rev = git_utils.get_latest_commit('master')
        self.assertNotEqual(old_rev, origin_rev)
        self.assertEqual(new_rev, origin_rev)
Пример #5
0
    def test_diverged_force(self):
        commit_file('file2.txt', 'add file2')
        old_rev = git_utils.get_latest_commit('master')
        with pushd(self.origin):
            commit_file('file2-origin.txt', 'add file2')
            origin_rev = git_utils.get_latest_commit('master')
        check_call_silent(['git', 'fetch', 'origin'])

        git_utils.try_rebase_branch('origin', 'master', force=True)
        new_rev = git_utils.get_latest_commit('master')
        self.assertNotEqual(old_rev, origin_rev)
        self.assertEqual(new_rev, origin_rev)
Пример #6
0
    def test_even(self):
        old_rev = git_utils.get_latest_commit('master')

        git_utils.try_rebase_branch('origin', 'master')
        new_rev = git_utils.get_latest_commit('master')
        self.assertEqual(old_rev, new_rev)