Example #1
0
 def commit_message_for_local_commit(self, commit_id):
     if commit_id == "Commitish1":
         return CommitMessage("CommitMessage1\n" \
             "https://bugs.example.org/show_bug.cgi?id=50000\n")
     if commit_id == "Commitish2":
         return CommitMessage("CommitMessage2\n" \
             "https://bugs.example.org/show_bug.cgi?id=50001\n")
     raise Exception("Bogus commit_id in commit_message_for_local_commit.")
Example #2
0
 def test_bug_id_for_this_commit(self):
     scm = Mock()
     checkout = Checkout(scm)
     checkout.commit_message_for_this_commit = lambda git_commit: CommitMessage(
         ChangeLogEntry(_changelog1entry1).contents().splitlines())
     self.assertEqual(checkout.bug_id_for_this_commit(git_commit=None),
                      36629)
Example #3
0
    def commit_message_for_this_commit(self, git_commit, changed_files=None, return_stderr=False):
        changelog_paths = self.modified_changelogs(git_commit, changed_files)
        if not len(changelog_paths):
            raise ScriptError(message="Found no modified ChangeLogs, cannot create a commit message.\n"
                              "All changes require a ChangeLog.  See:\n %s" % urls.contribution_guidelines)

        message_text = self._scm.run([self._scm.script_path('commit-log-editor'), '--print-log'] + changelog_paths, return_stderr=return_stderr)
        return CommitMessage(message_text.splitlines())
Example #4
0
    def commit_message_for_this_commit(self, git_commit, squash):
        changelog_paths = self.modified_changelogs(git_commit, squash)
        if not len(changelog_paths):
            raise ScriptError(message="Found no modified ChangeLogs, cannot create a commit message.\n"
                              "All changes require a ChangeLog.  See:\n"
                              "http://webkit.org/coding/contributing.html")

        changelog_messages = []
        for changelog_path in changelog_paths:
            log("Parsing ChangeLog: %s" % changelog_path)
            changelog_entry = ChangeLog(changelog_path).latest_entry()
            if not changelog_entry:
                raise ScriptError(message="Failed to parse ChangeLog: %s" % os.path.abspath(changelog_path))
            changelog_messages.append(changelog_entry.contents())

        # FIXME: We should sort and label the ChangeLog messages like commit-log-editor does.
        return CommitMessage("".join(changelog_messages).splitlines())
Example #5
0
 def test_bug_id_for_this_commit(self):
     checkout = self._make_checkout()
     checkout.commit_message_for_this_commit = lambda git_commit, changed_files=None, return_stderr=False: CommitMessage(
         ChangeLogEntry(_changelog1entry1).contents().splitlines())
     self.assertEqual(checkout.bug_id_for_this_commit(git_commit=None),
                      36629)