Пример #1
0
 def commit_info_for_revision(self, svn_revision):
     return CommitInfo(svn_revision, "*****@*****.**", {
         "bug_id": 42,
         "author_name": "Adam Barth",
         "author_email": "*****@*****.**",
         "author": self._committer_list.committer_by_email("*****@*****.**"),
         "reviewer_text": "Darin Adler",
         "reviewer": self._committer_list.committer_by_name("Darin Adler"),
     })
Пример #2
0
 def commit_info_for_revision(self, svn_revision):
     # The real Checkout would probably throw an exception, but this is the only way tests have to get None back at the moment.
     if not svn_revision:
         return None
     return CommitInfo(svn_revision, "*****@*****.**", {
         "bug_id": 42,
         "author_name": "Adam Barth",
         "author_email": "*****@*****.**",
         "author": self._committer_list.committer_by_email("*****@*****.**"),
         "reviewer_text": "Darin Adler",
         "reviewer": self._committer_list.committer_by_name("Darin Adler"),
     })
Пример #3
0
 def commit_info_for_revision(self, revision):
     committer_email = self._scm.committer_email_for_revision(revision)
     changelog_entries = self.changelog_entries_for_revision(revision)
     # Assume for now that the first entry has everything we need:
     # FIXME: This will throw an exception if there were no ChangeLogs.
     if not len(changelog_entries):
         return None
     changelog_entry = changelog_entries[0]
     changelog_data = {
         "bug_id": parse_bug_id_from_changelog(changelog_entry.contents()),
         "author_name": changelog_entry.author_name(),
         "author_email": changelog_entry.author_email(),
         "author": changelog_entry.author(),
         "reviewer_text": changelog_entry.reviewer_text(),
         "reviewer": changelog_entry.reviewer(),
     }
     # We could pass the changelog_entry instead of a dictionary here, but that makes
     # mocking slightly more involved, and would make aggregating data from multiple
     # entries more difficult to wire in if we need to do that in the future.
     return CommitInfo(revision, committer_email, changelog_data)
Пример #4
0
 def commit_info_for_revision(self, revision):
     committer_email = self._scm.committer_email_for_revision(revision)
     changelog_data = self._changelog_data_for_revision(revision)
     if not changelog_data:
         return None
     return CommitInfo(revision, committer_email, changelog_data)
Пример #5
0
    def test_commit_info_creation(self):
        author = Committer("Author", "*****@*****.**")
        committer = Committer("Committer", "*****@*****.**")
        reviewer = Reviewer("Reviewer", "*****@*****.**")
        committer_list = CommitterList(committers=[author, committer],
                                       reviewers=[reviewer])

        changelog_data = {
            "bug_id": 1234,
            "author_name": "Committer",
            "author_email": "*****@*****.**",
            "author": author,
            "reviewer_text": "Reviewer",
            "reviewer": reviewer,
        }
        commit = CommitInfo(123, "*****@*****.**", changelog_data,
                            committer_list)

        self.assertEqual(commit.revision(), 123)
        self.assertEqual(commit.bug_id(), 1234)
        self.assertEqual(commit.author_name(), "Committer")
        self.assertEqual(commit.author_email(), "*****@*****.**")
        self.assertEqual(commit.author(), author)
        self.assertEqual(commit.reviewer_text(), "Reviewer")
        self.assertEqual(commit.reviewer(), reviewer)
        self.assertEqual(commit.committer(), committer)
        self.assertEqual(commit.committer_email(), "*****@*****.**")
        self.assertEqual(commit.responsible_parties(),
                         set([author, committer, reviewer]))
Пример #6
0
    def test_commit_info_creation(self):
        author = Committer("Author", "*****@*****.**")
        committer = Committer("Committer", "*****@*****.**")
        reviewer = Reviewer("Reviewer", "*****@*****.**")
        committer_list = CommitterList(committers=[author, committer], reviewers=[reviewer])

        changelog_data = {
            "bug_id": 1234,
            "author_name": "Committer",
            "author_email": "*****@*****.**",
            "author": author,
            "reviewer_text": "Reviewer",
            "reviewer": reviewer,
            "bug_description": "Bug description",
        }
        commit = CommitInfo(123, "*****@*****.**", changelog_data, committer_list)

        self.assertEqual(commit.revision(), 123)
        self.assertEqual(commit.bug_id(), 1234)
        self.assertEqual(commit.author_name(), "Committer")
        self.assertEqual(commit.author_email(), "*****@*****.**")
        self.assertEqual(commit.author(), author)
        self.assertEqual(commit.reviewer_text(), "Reviewer")
        self.assertEqual(commit.reviewer(), reviewer)
        self.assertEqual(commit.committer(), committer)
        self.assertEqual(commit.committer_email(), "*****@*****.**")
        self.assertEqual(commit.responsible_parties(), set([author, committer, reviewer]))
        self.assertEqual(commit.bug_description(), "Bug description")
Пример #7
0
class MockCommitMessage(object):
    def message(self):
        return "This is a fake commit message that is at least 50 characters."


committer_list = CommitterList()

mock_revisions = {
    1: CommitInfo(852, "*****@*****.**", {
        "bug_id": 50000,
        "author_name": "Adam Barth",
        "author_email": "*****@*****.**",
        "author": committer_list.contributor_by_email("*****@*****.**"),
        "reviewer_text": "Darin Adler",
        "reviewer": committer_list.committer_by_name("Darin Adler"),
        "changed_files": [
            "path/to/file",
            "another/file",
        ],
        "bug_description": "Example description of bug 50000.",
    }),
    963: CommitInfo(963, "*****@*****.**", {
        "bug_id": 50005,
        "author_name": "Carol Szabo",
        "author_email": "*****@*****.**",
        "author": committer_list.contributor_by_email("*****@*****.**"),
        "reviewer_text": "Darin Adler",
        "reviewer": committer_list.committer_by_name("Darin Adler"),
        "changed_files": [
            "path/to/file",