本文整理汇总了Python中passpie.history.Repository.commit_list方法的典型用法代码示例。如果您正苦于以下问题:Python Repository.commit_list方法的具体用法?Python Repository.commit_list怎么用?Python Repository.commit_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类passpie.history.Repository
的用法示例。
在下文中一共展示了Repository.commit_list方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_git_commit_list_has_expected_commit_list
# 需要导入模块: from passpie.history import Repository [as 别名]
# 或者: from passpie.history.Repository import commit_list [as 别名]
def test_git_commit_list_has_expected_commit_list(mocker, mock_process):
commit_list = [
'another commit',
'initial commit'
]
mock_process.call.return_value = ("\n".join(commit_list), 'no error')
cmd = ['git', 'log', '--reverse', '--pretty=format:%s']
repo = Repository('path')
commits = repo.commit_list()
assert len(repo.commit_list()) == len(commits)
mock_process.call.assert_any_call(cmd, cwd=repo.path)
示例2: test_git_commit_list_has_expected_reversed_commits_with_index
# 需要导入模块: from passpie.history import Repository [as 别名]
# 或者: from passpie.history.Repository import commit_list [as 别名]
def test_git_commit_list_has_expected_reversed_commits_with_index(mocker):
MockRepo = mocker.patch('passpie.history.Repo')
mock_repo = MockRepo()
commits = [
'another commit',
'initial commit'
]
mock_repo.iter_commits.return_value = commits
path = 'some_path'
git = Repository(path)
commit_list = git.commit_list()
assert len(commit_list) == len(commits)
assert [i for i, _ in commit_list] == list(reversed(list(range(len(commits)))))