def test_commit_custom_parent(self): gitrepo = Repository(self.main_repo) gitrepo.update('master') c1 = gitrepo.commit('A commit', allow_empty=True) c2 = gitrepo.commit('Other commit', allow_empty=True) gitrepo.commit('Commit with custom parent', allow_empty=True, custom_parent=c1.hash) self.assertEquals([p.hash for p in gitrepo.parents()], [c2.hash, c1.hash])
def test_commit_custom_parent(self): gitrepo = Repository(self.main_repo) gitrepo.update('master') c1 = gitrepo.commit('A commit', allow_empty=True) c2 = gitrepo.commit('Other commit', allow_empty=True) gitrepo.commit('Commit with custom parent', allow_empty=True, custom_parent=c1.hash) self.assertEquals( [p.hash for p in gitrepo.parents()], [c2.hash, c1.hash])
def test_parents(self): git = GitCmd(self.cloned_from_repo) gitrepo = Repository(self.cloned_from_repo) self.assertEquals([x.hash for x in gitrepo.parents()], git('log', '-1', pretty='%P').split())
def test_parents(self): repo = pygit2.Repository(self.cloned_from_repo) gitrepo = Repository(self.cloned_from_repo) self.assertEquals([x.hash for x in gitrepo.parents()], [x.hex for x in repo.head.get_object().parents])