Ejemplo n.º 1
0
class MockCheckout(object):
    def __init__(self):
        # FIXME: It's unclear if a MockCheckout is very useful.  A normal Checkout
        # with a MockSCM/MockFileSystem/MockExecutive is probably better.
        self._filesystem = MockFileSystem()

    def is_path_to_changelog(self, path):
        return self._filesystem.basename(path) == "ChangeLog"

    def recent_commit_infos_for_files(self, paths):
        return [self.commit_info_for_revision(32)]

    def modified_changelogs(self, git_commit, changed_files=None):
        # Ideally we'd return something more interesting here.  The problem is
        # that LandDiff will try to actually read the patch from disk!
        return []

    def commit_message_for_this_commit(self, git_commit, changed_files=None):
        return MockCommitMessage()

    def apply_patch(self, patch):
        pass

    def apply_reverse_diffs(self, revision):
        pass
Ejemplo n.º 2
0
class MockCheckout(object):
    def __init__(self):
        # FIXME: It's unclear if a MockCheckout is very useful.  A normal Checkout
        # with a MockSCM/MockFileSystem/MockExecutive is probably better.
        self._filesystem = MockFileSystem()

    # FIXME: This should move onto the Host object, and we should use a MockCommitterList for tests.
    _committer_list = CommitterList()

    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": 50000,
            "author_name": "Adam Barth",
            "author_email": "*****@*****.**",
            "author": self._committer_list.contributor_by_email("*****@*****.**"),
            "reviewer_text": "Darin Adler",
            "reviewer": self._committer_list.committer_by_name("Darin Adler"),
            "changed_files": [
                "path/to/file",
                "another/file",
            ],
        })

    def is_path_to_changelog(self, path):
        return self._filesystem.basename(path) == "ChangeLog"

    def bug_id_for_revision(self, svn_revision):
        return 12345

    def recent_commit_infos_for_files(self, paths):
        return [self.commit_info_for_revision(32)]

    def modified_changelogs(self, git_commit, changed_files=None):
        # Ideally we'd return something more interesting here.  The problem is
        # that LandDiff will try to actually read the patch from disk!
        return []

    def commit_message_for_this_commit(self, git_commit, changed_files=None):
        return MockCommitMessage()

    def chromium_deps(self):
        return MockDEPS()

    def apply_patch(self, patch):
        pass

    def apply_reverse_diffs(self, revision):
        pass

    def suggested_reviewers(self, git_commit, changed_files=None):
        # FIXME: We should use a shared mock commiter list.
        return [_mock_reviewers[0]]
Ejemplo n.º 3
0
class MockCheckout(object):
    def __init__(self):
        # FIXME: It's unclear if a MockCheckout is very useful.  A normal Checkout
        # with a MockSCM/MockFileSystem/MockExecutive is probably better.
        self._filesystem = MockFileSystem()

    def commit_info_for_revision(self, svn_revision):
        # There are legacy tests that all expected these revision numbers to map
        # to the same commit description (now mock_revisions[1])
        if svn_revision in [32, 123, 852, 853, 854, 1234, 21654, 21655, 21656]:
            return mock_revisions[1]

        if svn_revision in mock_revisions:
            return mock_revisions[svn_revision]

        # any "unrecognized" svn_revision will return None.

    def is_path_to_changelog(self, path):
        return self._filesystem.basename(path) == "ChangeLog"

    def bug_id_for_revision(self, svn_revision):
        return 12345

    def recent_commit_infos_for_files(self, paths):
        return [self.commit_info_for_revision(32)]

    def modified_changelogs(self, git_commit, changed_files=None):
        # Ideally we'd return something more interesting here.  The problem is
        # that LandDiff will try to actually read the patch from disk!
        return []

    def commit_message_for_this_commit(self, git_commit, changed_files=None):
        return MockCommitMessage()

    def chromium_deps(self):
        return MockDEPS()

    def apply_patch(self, patch):
        pass

    def apply_reverse_diffs(self, revision):
        pass

    def suggested_reviewers(self, git_commit, changed_files=None):
        # FIXME: We should use a shared mock commiter list.
        return [_mock_reviewers[0]]
Ejemplo n.º 4
0
class MockCheckout(object):
    def __init__(self):
        # FIXME: It's unclear if a MockCheckout is very useful.  A normal Checkout
        # with a MockSCM/MockFileSystem/MockExecutive is probably better.
        self._filesystem = MockFileSystem()

    def commit_info_for_revision(self, svn_revision):
        # There are legacy tests that all expected these revision numbers to map
        # to the same commit description (now mock_revisions[1])
        if svn_revision in [32, 123, 852, 853, 854, 1234, 21654, 21655, 21656]:
            return mock_revisions[1]

        if svn_revision in mock_revisions:
            return mock_revisions[svn_revision]

        # any "unrecognized" svn_revision will return None.

    def is_path_to_changelog(self, path):
        return self._filesystem.basename(path) == "ChangeLog"

    def bug_id_for_revision(self, svn_revision):
        return 12345

    def recent_commit_infos_for_files(self, paths):
        return [self.commit_info_for_revision(32)]

    def modified_changelogs(self, git_commit, changed_files=None):
        # Ideally we'd return something more interesting here.  The problem is
        # that LandDiff will try to actually read the patch from disk!
        return []

    def commit_message_for_this_commit(self, git_commit, changed_files=None):
        return MockCommitMessage()

    def chromium_deps(self):
        return MockDEPS()

    def apply_patch(self, patch):
        pass

    def apply_reverse_diffs(self, revision):
        pass

    def suggested_reviewers(self, git_commit, changed_files=None):
        # FIXME: We should use a shared mock commiter list.
        return [_mock_reviewers[0]]