Пример #1
0
def getCommitByBugId(dotreleases):
    """Get the revisions from the hg.m.o urls in the bug comments"""
    nightly_pats = Bugzilla.get_landing_patterns(channels=['nightly'])

    def comment_handler(bug, bugid, data):
        r = Bugzilla.get_landing_comments(bug['comments'], [], nightly_pats)
        data[bugid]['revs'] = [i['revision'] for i in r]

    def bug_handler(bug, data):
        if 'id' in bug:
            data[str(bug['id'])]['title'] = bug['summary']

    bugids = []
    for r, bug in dotreleases.items():
        bugids += bug

    revisions = {
        bugid: {
            'revs': [],
            'title': ''
        }
        for bugid in map(str, bugids)
    }

    Bugzilla(bugids=bugids,
             include_fields=['id', 'summary'],
             bughandler=bug_handler,
             bugdata=revisions,
             commenthandler=comment_handler,
             commentdata=revisions,
             comment_include_fields=['text']).get_data().wait()
    return revisions
Пример #2
0
 def __init__(self, channel):
     # since it's used in name() we must have it before to call parent ctor
     self.channel = channel
     super(Unlanded, self).__init__()
     self.bug_ids = []
     self.versions = utils.get_checked_versions()
     self.channel_pat = Bugzilla.get_landing_patterns(channels=[channel])
Пример #3
0
 def __init__(self, channel):
     # since it's used in name() we must have it before to call parent ctor
     self.channel = channel
     super(Unlanded, self).__init__()
     self.bug_ids = []
     self.versions = utils.get_checked_versions()
     self.channel_pat = Bugzilla.get_landing_patterns(channels=[channel])
    def get_revisions(self, bugs):
        """Get the revisions from the hg.m.o urls in the bug comments"""
        nightly_pats = Bugzilla.get_landing_patterns(channels=['nightly'])

        def comment_handler(bug, bugid, data):
            commenters = data[bugid]['commenters']
            for comment in bug['comments']:
                commenter = comment['author']
                if commenter in commenters:
                    commenters[commenter] += 1
                else:
                    commenters[commenter] = 1

            r = Bugzilla.get_landing_comments(bug['comments'], [],
                                              nightly_pats)
            data[bugid]['revisions'] = [i['revision'] for i in r]

        def attachment_handler(attachments, bugid, data):
            for attachment in attachments:
                if self.is_patch(attachment):
                    data[bugid]['creators'].add(attachment['creator'])

        bugids = list(bugs.keys())
        revisions = {
            bugid: {
                'revisions': [],
                'creators': set(),
                'commenters': {}
            }
            for bugid in bugids
        }
        Bugzilla(
            bugids=bugids,
            commenthandler=comment_handler,
            commentdata=revisions,
            comment_include_fields=['text', 'author'],
            attachmenthandler=attachment_handler,
            attachmentdata=revisions,
        ).get_data().wait()

        return revisions
Пример #5
0
    def get_revisions(self, bugs):
        """Get the revisions from the hg.m.o urls in the bug comments"""
        nightly_pats = Bugzilla.get_landing_patterns(channels=['nightly'])

        def comment_handler(bug, bugid, data):
            commenters = data[bugid]['commenters']
            for comment in bug['comments']:
                commenter = comment['author']
                if commenter in commenters:
                    commenters[commenter] += 1
                else:
                    commenters[commenter] = 1

            r = Bugzilla.get_landing_comments(bug['comments'], [], nightly_pats)
            data[bugid]['revisions'] = [i['revision'] for i in r]

        def attachment_handler(attachments, bugid, data):
            for attachment in attachments:
                if self.is_patch(attachment):
                    data[bugid]['creators'].add(attachment['creator'])

        bugids = list(bugs.keys())
        revisions = {
            bugid: {'revisions': [], 'creators': set(), 'commenters': {}}
            for bugid in bugids
        }
        Bugzilla(
            bugids=bugids,
            commenthandler=comment_handler,
            commentdata=revisions,
            comment_include_fields=['text', 'author'],
            attachmenthandler=attachment_handler,
            attachmentdata=revisions,
        ).get_data().wait()

        return revisions
Пример #6
0
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import datetime
from dateutil.relativedelta import relativedelta
from libmozdata.bugzilla import Bugzilla
from libmozdata.connection import Query
from libmozdata.release_calendar import get_calendar
from libmozdata import utils as lmdutils, hgmozilla
import re
import whatthepatch
from auto_nag.bzcleaner import BzCleaner
from auto_nag.people import People
from auto_nag import utils

NIGHTLY_PAT = Bugzilla.get_landing_patterns(channels=['nightly'])
BUG_PAT = re.compile('[\t ]*bug[s]?[\t ]*([0-9]+)', re.I)
BACKOUT_PAT = re.compile('^back(ed)?[ \t]*out', re.I)


class CodeFreezeWeek(BzCleaner):
    def __init__(self):
        super(CodeFreezeWeek, self).__init__()
        self.versions = utils.get_checked_versions()
        if not self.versions:
            return

        self.people = People()
        self.nightly = self.versions['central']
        self.beta = self.versions['beta']
        self.release = self.versions['release']
Пример #7
0
    def get_patch_data(self, bugs):
        """Get patch information in bugs
        """
        nightly_pats = Bugzilla.get_landing_patterns(channels=['nightly'])

        def comment_handler(bug, bugid, data):
            r = Bugzilla.get_landing_comments(bug['comments'], [], nightly_pats)
            landed = bool(r)
            if not landed:
                for comment in bug['comments']:
                    comment = comment['text'].lower()
                    if 'backed out' in comment or 'backout' in comment:
                        landed = True
                        break

            data[bugid]['landed'] = landed

        def attachment_handler(attachments, bugid, data):
            res = {}
            for attachment in attachments:
                self.handle_attachment(attachment, res)

            if 'phab' in res:
                if res['phab']:
                    data[bugid]['patch'] = 'phab'
                    data[bugid]['author'] = res['author']
                    data[bugid]['count'] = res['count']
            elif 'splinter' in res and res['splinter']:
                data[bugid]['patch'] = 'splinter'
                data[bugid]['author'] = res['author']
                data[bugid]['count'] = res['count']

        bugids = list(bugs.keys())
        data = {
            bugid: {'landed': False, 'patch': None, 'author': None, 'count': 0}
            for bugid in bugids
        }
        Bugzilla(
            bugids=bugids,
            attachmenthandler=attachment_handler,
            attachmentdata=data,
            attachment_include_fields=[
                'bug_id',
                'creator',
                'data',
                'is_obsolete',
                'is_patch',
                'content_type',
                'flags',
            ],
        ).get_data().wait()

        data = {bugid: v for bugid, v in data.items() if v['patch'] is not None}
        splinter_bugs = [bugid for bugid, v in data.items() if v['patch'] == 'splinter']

        Bugzilla(
            bugids=splinter_bugs,
            commenthandler=comment_handler,
            commentdata=data,
            comment_include_fields=['text'],
        ).get_data().wait()

        data = {
            bugid: {'authors': v['author'], 'patch_count': v['count']}
            for bugid, v in data.items()
            if v['patch'] == 'phab' or not v['landed']
        }

        return data
Пример #8
0
 def __init__(self, channel):
     super(Unlanded, self).__init__()
     self.channel = channel
     self.bug_ids = []
     self.versions = utils.get_checked_versions()
     self.channel_pat = Bugzilla.get_landing_patterns(channels=[channel])
# You can obtain one at http://mozilla.org/MPL/2.0/.

import datetime
from dateutil.relativedelta import relativedelta
from libmozdata.bugzilla import Bugzilla
from libmozdata.connection import Query
from libmozdata.release_calendar import get_calendar
from libmozdata import utils as lmdutils, hgmozilla
import re
import whatthepatch
from auto_nag.bzcleaner import BzCleaner
from auto_nag.people import People
from auto_nag import utils


NIGHTLY_PAT = Bugzilla.get_landing_patterns(channels=['nightly'])
BUG_PAT = re.compile('[\t ]*bug[s]?[\t ]*([0-9]+)', re.I)
BACKOUT_PAT = re.compile('^back(ed)?[ \t]*out', re.I)


class CodeFreezeWeek(BzCleaner):
    def __init__(self):
        super(CodeFreezeWeek, self).__init__()
        self.versions = utils.get_checked_versions()
        if not self.versions:
            return

        self.people = People()
        self.nightly = self.versions['central']
        self.beta = self.versions['beta']
        self.release = self.versions['release']
Пример #10
0
    def get_patch_data(self, bugs):
        """Get patch information in bugs
        """
        nightly_pats = Bugzilla.get_landing_patterns(channels=['nightly'])

        def comment_handler(bug, bugid, data):
            r = Bugzilla.get_landing_comments(bug['comments'], [],
                                              nightly_pats)
            landed = bool(r)
            if not landed:
                for comment in bug['comments']:
                    comment = comment['text'].lower()
                    if 'backed out' in comment or 'backout' in comment:
                        landed = True
                        break

            data[bugid]['landed'] = landed

        def attachment_handler(attachments, bugid, data):
            res = {}
            for attachment in attachments:
                self.handle_attachment(attachment, res)

            if 'phab' in res:
                if res['phab']:
                    data[bugid]['patch'] = 'phab'
                    data[bugid]['author'] = res['author']
                    data[bugid]['count'] = res['count']
            elif 'splinter' in res and res['splinter']:
                data[bugid]['patch'] = 'splinter'
                data[bugid]['author'] = res['author']
                data[bugid]['count'] = res['count']

        bugids = list(bugs.keys())
        data = {
            bugid: {
                'landed': False,
                'patch': None,
                'author': None,
                'count': 0
            }
            for bugid in bugids
        }
        Bugzilla(
            bugids=bugids,
            attachmenthandler=attachment_handler,
            attachmentdata=data,
            attachment_include_fields=[
                'bug_id',
                'creator',
                'data',
                'is_obsolete',
                'is_patch',
                'content_type',
                'flags',
            ],
        ).get_data().wait()

        data = {
            bugid: v
            for bugid, v in data.items() if v['patch'] is not None
        }
        splinter_bugs = [
            bugid for bugid, v in data.items() if v['patch'] == 'splinter'
        ]

        Bugzilla(
            bugids=splinter_bugs,
            commenthandler=comment_handler,
            commentdata=data,
            comment_include_fields=['text'],
        ).get_data().wait()

        data = {
            bugid: {
                'authors': v['author'],
                'patch_count': v['count']
            }
            for bugid, v in data.items()
            if v['patch'] == 'phab' or not v['landed']
        }

        return data
Пример #11
0
    def get_patch_data(self, bugs):
        """Get patch information in bugs"""
        nightly_pat = Bugzilla.get_landing_patterns(channels=["nightly"])[0][0]

        def comment_handler(bug, bugid, data):
            # if a comment contains a backout: don't nag
            for comment in bug["comments"]:
                comment = comment["text"].lower()
                if nightly_pat.match(comment) and ("backed out" in comment
                                                   or "backout" in comment):
                    data[bugid]["backout"] = True

        def attachment_id_handler(attachments, bugid, data):
            for a in attachments:
                if (a["content_type"] == "text/x-phabricator-request"
                        and a["is_obsolete"] == 0):
                    data.append(a["id"])

        def attachment_handler(attachments, data):
            for attachment in attachments:
                bugid = str(attachment["bug_id"])
                if bugid in data:
                    data[bugid].append(attachment)
                else:
                    data[bugid] = [attachment]

        bugids = list(bugs.keys())
        data = {
            bugid: {
                "backout": False,
                "author": None,
                "count": 0
            }
            for bugid in bugids
        }

        # Get the ids of the attachments of interest
        # to avoid to download images, videos, ...
        attachment_ids = []
        Bugzilla(
            bugids=bugids,
            attachmenthandler=attachment_id_handler,
            attachmentdata=attachment_ids,
            attachment_include_fields=["is_obsolete", "content_type", "id"],
        ).get_data().wait()

        # Once we've the ids we can get the data
        attachments_by_bug = {}
        Bugzilla(
            attachmentids=attachment_ids,
            attachmenthandler=attachment_handler,
            attachmentdata=attachments_by_bug,
            attachment_include_fields=[
                "bug_id",
                "data",
                "is_obsolete",
                "content_type",
                "id",
                "creator",
            ],
        ).get_data().wait()

        for bugid, attachments in attachments_by_bug.items():
            res = {}
            for attachment in attachments:
                self.handle_attachment(attachment, res)

            if "phab" in res:
                if res["phab"]:
                    data[bugid]["author"] = res["author"]
                    data[bugid]["count"] = res["count"]

        data = {bugid: v for bugid, v in data.items() if v["author"]}

        if not data:
            return data

        Bugzilla(
            bugids=list(data.keys()),
            commenthandler=comment_handler,
            commentdata=data,
            comment_include_fields=["text"],
        ).get_data().wait()

        data = {bugid: v for bugid, v in data.items() if not v["backout"]}

        return data
Пример #12
0
    def get_patch_data(self, bugs):
        """Get patch information in bugs
        """
        nightly_pats = Bugzilla.get_landing_patterns(channels=["nightly"])

        def comment_handler(bug, bugid, data):
            r = Bugzilla.get_landing_comments(bug["comments"], [],
                                              nightly_pats)
            landed = bool(r)
            if not landed:
                for comment in bug["comments"]:
                    comment = comment["text"].lower()
                    if "backed out" in comment or "backout" in comment:
                        landed = True
                        break

            data[bugid]["landed"] = landed

        def attachment_handler(attachments, bugid, data):
            res = {}
            for attachment in attachments:
                self.handle_attachment(attachment, res)

            if "phab" in res:
                if res["phab"]:
                    data[bugid]["patch"] = "phab"
                    data[bugid]["author"] = res["author"]
                    data[bugid]["count"] = res["count"]
            elif "splinter" in res and res["splinter"]:
                data[bugid]["patch"] = "splinter"
                data[bugid]["author"] = res["author"]
                data[bugid]["count"] = res["count"]

        bugids = list(bugs.keys())
        data = {
            bugid: {
                "landed": False,
                "patch": None,
                "author": None,
                "count": 0
            }
            for bugid in bugids
        }
        Bugzilla(
            bugids=bugids,
            attachmenthandler=attachment_handler,
            attachmentdata=data,
            attachment_include_fields=[
                "bug_id",
                "creator",
                "data",
                "is_obsolete",
                "is_patch",
                "content_type",
                "flags",
            ],
        ).get_data().wait()

        data = {
            bugid: v
            for bugid, v in data.items() if v["patch"] is not None
        }
        splinter_bugs = [
            bugid for bugid, v in data.items() if v["patch"] == "splinter"
        ]

        Bugzilla(
            bugids=splinter_bugs,
            commenthandler=comment_handler,
            commentdata=data,
            comment_include_fields=["text"],
        ).get_data().wait()

        data = {
            bugid: {
                "authors": v["author"],
                "patch_count": v["count"]
            }
            for bugid, v in data.items()
            if v["patch"] == "phab" or not v["landed"]
        }

        return data
Пример #13
0
 def __init__(self, channel):
     super(Unlanded, self).__init__()
     self.channel = channel
     self.bug_ids = []
     self.versions = utils.get_checked_versions()
     self.channel_pat = Bugzilla.get_landing_patterns(channels=[channel])