Beispiel #1
0
    def testSimpleFork(self):
        self._createCommitNewFile("README")
        self.repo("branch", "fork")
        self._createCommitNewFile("ONLY_MASTER")
        self.repo("checkout", "fork")
        self._createCommitNewFile("ONLY_FORK", "ONLY_FORK", "BODY\nBODY")
        self._createCommitNewFile("ONLY_FORK2")

        log = phlgit_log.get_range_to_here_raw_body(self.repo, "master")
        self.assertIn("ONLY_FORK", log)
        self.assertNotIn("ONLY_MASTER", log)
        self.assertNotIn("README", log)

        hashes = phlgit_log.get_range_to_here_hashes(self.repo, "master")
        hashes2 = phlgit_log.get_range_hashes(self.repo, "master", "fork")
        self.assertListEqual(hashes, hashes2)
        r0 = phlgit_log.make_revision_from_hash(self.repo, hashes[0])
        self.assertEqual(r0.subject, "ONLY_FORK")
        self.assertEqual(r0.message, "BODY\nBODY\n")
        r1 = phlgit_log.make_revision_from_hash(self.repo, hashes[1])
        self.assertEqual(r1.subject, "ONLY_FORK2")
        self.assertIsNotNone(r1.message)
        self.assertIsInstance(r1.message, str)

        committers = phlgit_log.get_author_names_emails_from_hashes(
            self.repo, hashes)
        self.assertEqual(len(committers), 1)
        self.assertEqual(committers[0], (self.authorName, self.authorEmail))
Beispiel #2
0
 def get_commit_message_from_tip(self):
     """Return string commit message from latest commit on branch."""
     hashes = self._get_commit_hashes()
     revision = phlgit_log.make_revision_from_hash(self._repo, hashes[-1])
     message = revision.subject + "\n"
     message += "\n"
     message += revision.message + "\n"
     return phlsys_textconvert.ensure_ascii(message)
 def get_commit_message_from_tip(self):
     """Return string commit message from latest commit on branch."""
     hashes = self._get_commit_hashes()
     revision = phlgit_log.make_revision_from_hash(self._clone, hashes[-1])
     message = revision.subject + "\n"
     message += "\n"
     message += revision.message + "\n"
     return message
Beispiel #4
0
 def get_commit_message_from_tip(self):
     """Return string commit message from latest commit on branch."""
     hashes = self._get_commit_hashes()
     revision = phlgit_log.make_revision_from_hash(self._repo, hashes[-1])
     message = revision.subject + "\n"
     message += "\n"
     message += revision.message + "\n"
     return phlsys_textconvert.ensure_ascii(message)
def getFieldsFromCommitHash(conduit, clone, commit_hash, defaultTestPlan=None):
    """Return a ParseCommitMessageResponse based on the commit message.

    :conduit: supports call()
    :clone: supports call()
    :commit_hash: a single commit hash to get the message from
    :returns: a phlcon_differential.ParseCommitMessageResponse

    """
    revision = phlgit_log.make_revision_from_hash(clone, commit_hash)
    message = revision.subject + "\n"
    message += "\n"
    message += revision.message + "\n"
    parsed = phlcon_differential.parse_commit_message(conduit, message)

    testPlan = "testPlan"
    if defaultTestPlan is not None:
        if parsed.fields is not None:
            if not testPlan in parsed.fields or not parsed.fields[testPlan]:
                message += "Test Plan:\n" + defaultTestPlan
                parsed = phlcon_differential.parse_commit_message(
                    conduit, message)

    return parsed