def test_from_pygit(self): directory = mkdtemp() repo = Repository.clone(url="git://github.com/heynemann/wight.git", path=directory) head_commit = tuple(repo.walk(repo.head.target, GIT_SORT_TIME))[0] commit = Commit.from_pygit(head_commit) commit_date = datetime.datetime.fromtimestamp(head_commit.commit_time) expect(commit.hex).to_equal(head_commit.hex) expect(commit.author_name).to_equal(head_commit.author.name) expect(commit.author_email).to_equal(head_commit.author.email) expect(commit.committer_name).to_equal(head_commit.committer.name) expect(commit.committer_email).to_equal(head_commit.committer.email) expect(commit.commit_date).to_equal(commit_date)
def _save_last_commit(self, load_test, repo): last_commit = tuple(repo.walk(repo.head.target, GIT_SORT_TIME))[0] load_test.last_commit = Commit.from_pygit(last_commit) load_test.save()