def test_list_commits(repo: Git): change_sets = list(repo.get_list_commits()) list_commits = {'a88c84ddf42066611e76e6cb690144e5357d132c', '6411e3096dd2070438a17b225f44475136e54e3a', '09f6182cef737db02a085e1d018963c7a29bde5a', '1f99848edadfffa903b8ba1286a935f1b92b2845', 'da39b1326dbc2edfe518b90672734a08f3c13458'} for commit in change_sets: assert commit.hash in list_commits assert len(change_sets) == 5
def test_get_all_commits(repo: Git): change_sets = list(repo.get_list_commits()) assert len(change_sets) == 13 assert change_sets[0].hash == '866e997a9e44cb4ddd9e00efe49361420aff2559' assert change_sets[12].hash == 'e7d13b0511f8a176284ce4f92ed8c6e8d09c77f2'
def commit_by_msg(repo: Git, msg: str) -> Commit: for commit in repo.get_list_commits(): if commit.msg == msg: return commit raise Exception('cannot find commit with msg {}'.format(msg))