def testTwoCommits(self): self._createCommitNewFile("README") self._createCommitNewFile("README2") head = phlgit_log.get_last_commit_hash(self.repo) self.assertIsNotNone(head) hashes = phlgit_log.get_last_n_commit_hashes(self.repo, 2) self.assertIsNotNone(hashes) self.assertEqual(head, hashes[-1]) self.assertListEqual(hashes, hashes)
def testOneCommit(self): self._createCommitNewFile("README") hashes = phlgit_log.get_range_to_here_hashes(self.repo, "HEAD") self.assertIsNotNone(hashes) self.assertTrue(not hashes) self.assertIsInstance(hashes, list) head = phlgit_log.get_last_commit_hash(self.repo) self.assertIsNotNone(head) head2 = phlgit_log.get_last_n_commit_hashes(self.repo, 1) self.assertIsNotNone(head2) self.assertEqual(head, head2[0]) self.assertListEqual( phlgit_log.get_last_n_commit_hashes(self.repo, 0), []) self.assertRaises( ValueError, phlgit_log.get_last_n_commit_hashes, self.repo, 2)
def test_simpleWorkflow(self): self._devCheckoutPushNewBranch("ph-review/simpleWorkflow/master") self._devPushNewFile("NEWFILE") self._phabUpdateWithExpectations(total=1, bad=0) self._devPushNewFile("NEWFILE2") self._phabUpdateWithExpectations(total=1, bad=0) self._acceptTheOnlyReview() self._phabUpdateWithExpectations(total=0, bad=0, emails=0) # check the author on master with phlsys_fs.chdir_context("developer"): runCommands("git fetch -p", "git checkout master") clone = phlsys_git.GitClone(".") head = phlgit_log.get_last_commit_hash(clone) authors = phlgit_log.get_author_names_emails_from_hashes( clone, [head]) author = authors[0] name = author[0] email = author[1] self.assertEqual(self.author_account.user, name) self.assertEqual(self.author_account.email, email)