Example #1
0
 def test_revision_to_branched_from_no_branched_from(
         self, mock_get_url_content):
     """Test revision_to_branched_from() where commit has no branch-from"""
     mock_get_url_content.side_effect = self.mock_get_url_content
     val = revisions.revision_to_branched_from(
         'https://test-repository/src.git', 'f00d')
     self.assertEqual(None, val)
Example #2
0
def get_component_impacts_from_url(component_name,
                                   regression_range,
                                   job_type,
                                   platform=None):
    """Gets component impact string using the build information url."""
    start_revision, end_revision = get_start_and_end_revision(
        regression_range, job_type)
    if not end_revision:
        return Impacts()

    found_impacts = dict()
    for build in ['stable', 'beta']:
        build_revision_mappings = revisions.get_build_to_revision_mappings(
            platform)
        if not build_revision_mappings:
            return Impacts()
        mapping = build_revision_mappings.get(build)
        if not mapping:
            return Impacts()
        chromium_revision = mapping['revision']
        component_revision = get_component_information_by_name(
            chromium_revision, component_name)
        if not component_revision:
            return Impacts()
        branched_from = revisions.revision_to_branched_from(
            component_revision['url'], component_revision['rev'])
        if not branched_from:
            return Impacts()
        impact = get_impact(
            {
                'revision': branched_from,
                'version': mapping['version']
            }, start_revision, end_revision)
        found_impacts[build] = impact
    return Impacts(found_impacts['stable'], found_impacts['beta'])
Example #3
0
def get_component_impacts_from_url(component_name,
                                   regression_range,
                                   job_type,
                                   platform=None):
    """Gets component impact string using the build information url."""
    start_revision, end_revision = get_start_and_end_revision(
        regression_range, job_type)
    if not end_revision:
        return Impacts()

    build_revision_mappings = build_info.get_build_to_revision_mappings(
        platform)
    if not build_revision_mappings:
        return Impacts()

    found_impacts = dict()
    for build in ['extended_stable', 'stable', 'beta', 'canary']:
        mapping = build_revision_mappings.get(build)
        # TODO(yuanjunh): bypass for now but remove it after ES is enabled.
        if build == 'extended_stable' and not mapping:
            found_impacts[build] = Impact()
            continue
        # Some platforms don't have canary, so use dev to represent
        # the affected head version.
        if build == 'canary' and not mapping:
            mapping = build_revision_mappings.get('dev')
        if not mapping:
            return Impacts()
        chromium_revision = mapping['revision']
        component_revision = get_component_information_by_name(
            chromium_revision, component_name)
        if not component_revision:
            return Impacts()
        branched_from = revisions.revision_to_branched_from(
            component_revision['url'], component_revision['rev'])
        if not branched_from:
            return Impacts()
        impact = get_impact(
            {
                'revision': branched_from,
                'version': mapping['version']
            }, start_revision, end_revision)
        found_impacts[build] = impact
    return Impacts(found_impacts['stable'], found_impacts['beta'],
                   found_impacts['extended_stable'], found_impacts['canary'])
Example #4
0
def get_component_impacts_from_url(component_name,
                                   regression_range,
                                   job_type,
                                   platform=None):
    """Gets component impact string using the build information url."""
    start_revision, end_revision = get_start_and_end_revision(
        regression_range, job_type)
    if not end_revision:
        return Impacts()

    found_impacts = {}
    for build in ["stable", "beta"]:
        build_revision_mappings = revisions.get_build_to_revision_mappings(
            platform)
        if not build_revision_mappings:
            return Impacts()
        mapping = build_revision_mappings.get(build)
        if not mapping:
            return Impacts()
        chromium_revision = mapping["revision"]
        component_revision = get_component_information_by_name(
            chromium_revision, component_name)
        if not component_revision:
            return Impacts()
        branched_from = revisions.revision_to_branched_from(
            component_revision["url"], component_revision["rev"])
        if not branched_from:
            return Impacts()
        impact = get_impact(
            {
                "revision": branched_from,
                "version": mapping["version"]
            },
            start_revision,
            end_revision,
        )
        found_impacts[build] = impact
    return Impacts(found_impacts["stable"], found_impacts["beta"])
Example #5
0
 def test_revision_to_branched_from_no_message(self, mock_get_url_content):
     """Test revision_to_branched_from() with no commit message at all"""
     mock_get_url_content.side_effect = self.mock_get_url_content
     val = revisions.revision_to_branched_from(
         'https://test-repository/src.git', 'd00d')
     self.assertEqual(None, val)
Example #6
0
 def test_revision_to_branched_from(self, mock_get_url_content):
     """Test revision_to_branched_from() with normal branch."""
     mock_get_url_content.side_effect = self.mock_get_url_content
     val = revisions.revision_to_branched_from(
         'https://test-repository/src.git', 'abcd')
     self.assertEqual('36884', val)