How to use the mike.git_utils.get_latest_commit function in mike

To help you get started, we’ve selected a few mike examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jimporter / mike / test / unit / test_git_utils.py View on Github external
def test_diverged(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')
        check_call_silent(['git', 'fetch', 'origin'])

        self.assertRaises(git_utils.GitBranchDiverged,
                          git_utils.try_rebase_branch, 'origin', 'master')
        new_rev = git_utils.get_latest_commit('master')
        self.assertEqual(old_rev, new_rev)
github jimporter / mike / test / integration / test_deploy.py View on Github external
with git_utils.Commit('gh-pages', 'add file') as commit:
            commit.add_file(git_utils.FileInfo(
                'file2.txt', 'this is some text'
            ))
        clone_rev = git_utils.get_latest_commit('gh-pages')
        check_call_silent(['git', 'fetch', 'origin'])

        assertOutput(self, ['mike', 'deploy', '1.0'], output=(
            'mike: gh-pages has diverged from origin/gh-pages\n' +
            '  Pass --ignore to ignore this or --rebase to rebase onto ' +
            'remote\n'
        ), returncode=1)
        self.assertEqual(git_utils.get_latest_commit('gh-pages'), clone_rev)

        assertPopen(['mike', 'deploy', '--ignore', '1.0'])
        self.assertEqual(git_utils.get_latest_commit('gh-pages^'), clone_rev)

        assertPopen(['mike', 'deploy', '--rebase', '1.0'])
        self.assertEqual(git_utils.get_latest_commit('gh-pages^'), origin_rev)
github jimporter / mike / test / unit / test_git_utils.py View on Github external
def test_ahead(self):
        commit_file('file2.txt', 'second commit')

        rev = git_utils.get_latest_commit('master')
        git_utils.update_ref('branch', rev)
        self.assertEqual(git_utils.get_latest_commit('branch'), rev)
github jimporter / mike / test / unit / test_git_utils.py View on Github external
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)
github jimporter / mike / test / integration / test_list.py View on Github external
def test_ahead_remote(self):
        origin_rev = git_utils.get_latest_commit('gh-pages')

        stage_dir('list_clone')
        check_call_silent(['git', 'clone', self.stage, '.'])
        check_call_silent(['git', 'fetch', 'origin', 'gh-pages:gh-pages'])
        git_config()

        with git_utils.Commit('gh-pages', 'add file') as commit:
            commit.add_file(git_utils.FileInfo(
                'file.txt', 'this is some text'
            ))
        clone_rev = git_utils.get_latest_commit('gh-pages')

        self._check_list()
        self.assertEqual(git_utils.get_latest_commit('gh-pages'), clone_rev)
        self.assertEqual(git_utils.get_latest_commit('gh-pages^'), origin_rev)
github jimporter / mike / test / integration / test_serve.py View on Github external
def test_local_empty(self):
        origin_rev = git_utils.get_latest_commit('gh-pages')

        stage_dir('serve_clone')
        check_call_silent(['git', 'clone', self.stage, '.'])
        git_config()

        self._check_serve()
        self.assertEqual(git_utils.get_latest_commit('gh-pages'), origin_rev)
github jimporter / mike / test / integration / test_delete.py View on Github external
def test_remote_empty(self):
        stage_dir('delete_clone')
        check_call_silent(['git', 'clone', self.stage, '.'])
        git_config()

        self._deploy(versions=['1.0'])
        old_rev = git_utils.get_latest_commit('gh-pages')

        assertPopen(['mike', 'delete', '1.0'])
        self.assertEqual(git_utils.get_latest_commit('gh-pages^'), old_rev)
github jimporter / mike / test / integration / test_list.py View on Github external
def test_behind_remote(self):
        stage_dir('list_clone')
        check_call_silent(['git', 'clone', self.stage, '.'])
        check_call_silent(['git', 'fetch', 'origin', 'gh-pages:gh-pages'])
        git_config()

        with pushd(self.stage):
            with git_utils.Commit('gh-pages', 'add file') as commit:
                commit.add_file(git_utils.FileInfo(
                    'file.txt', 'this is some text'
                ))
            origin_rev = git_utils.get_latest_commit('gh-pages')
        check_call_silent(['git', 'fetch', 'origin'])

        self._check_list()
        self.assertEqual(git_utils.get_latest_commit('gh-pages'), origin_rev)
github jimporter / mike / test / unit / test_git_utils.py View on Github external
def test_nonexistent_ref(self):
        rev = git_utils.get_latest_commit('branch')
        self.assertRaises(git_utils.GitError, git_utils.update_ref,
                          'branch', 'nonexist')
        self.assertEqual(git_utils.get_latest_commit('branch'), rev)
github jimporter / mike / test / integration / test_retitle.py View on Github external
def test_ahead_remote(self):
        self._deploy()
        origin_rev = git_utils.get_latest_commit('gh-pages')

        stage_dir('retitle_clone')
        check_call_silent(['git', 'clone', self.stage, '.'])
        check_call_silent(['git', 'fetch', 'origin', 'gh-pages:gh-pages'])
        git_config()

        self._deploy(versions=['2.0'])
        old_rev = git_utils.get_latest_commit('gh-pages')

        assertPopen(['mike', 'retitle', '1.0', '1.0.1'])
        self.assertEqual(git_utils.get_latest_commit('gh-pages^'), old_rev)
        self.assertEqual(git_utils.get_latest_commit('gh-pages^^'), origin_rev)