コード例 #1
0
def run(message):
    tool = MockTool()
    tool.ensure_irc_connected(None)
    bot = IRCBot("sheriffbot", tool, Sheriff(tool, MockSheriffBot()),
                 irc_command.commands)
    bot._message_queue.post(["mock_nick", message])
    bot.process_pending_messages()
コード例 #2
0
    def test_exception_during_command(self):
        tool = MockTool()
        tool.ensure_irc_connected(None)
        bot = IRCBot("sheriffbot", tool, Sheriff(tool, MockSheriffBot()),
                     irc_command.commands)

        class CommandWithException(object):
            def execute(self, nick, args, tool, sheriff):
                raise Exception("mock_exception")

        bot._parse_command_and_args = lambda request: (CommandWithException, [
        ])
        expected_logs = 'MOCK: irc.post: Exception executing command: mock_exception\n'
        OutputCapture().assert_outputs(self,
                                       bot.process_message,
                                       args=["mock_nick", "ignored message"],
                                       expected_logs=expected_logs)

        class CommandWithException(object):
            def execute(self, nick, args, tool, sheriff):
                raise KeyboardInterrupt()

        bot._parse_command_and_args = lambda request: (CommandWithException, [
        ])
        # KeyboardInterrupt and SystemExit are not subclasses of Exception and thus correctly will not be caught.
        OutputCapture().assert_outputs(self,
                                       bot.process_message,
                                       args=["mock_nick", "ignored message"],
                                       expected_exception=KeyboardInterrupt)
コード例 #3
0
 def test_parse_command_and_args(self):
     tool = MockTool()
     bot = IRCBot("sheriffbot", tool, Sheriff(tool, MockSheriffBot()), irc_command.commands)
     self.assertEqual(bot._parse_command_and_args(""), (Eliza, [""]))
     self.assertEqual(bot._parse_command_and_args("   "), (Eliza, [""]))
     self.assertEqual(bot._parse_command_and_args(" hi "), (irc_command.Hi, []))
     self.assertEqual(bot._parse_command_and_args(" hi there "), (irc_command.Hi, ["there"]))
コード例 #4
0
ファイル: sheriffbot.py プロジェクト: venkatarajasekhar/Qt
class SheriffBot(AbstractQueue, StepSequenceErrorHandler):
    name = "webkitbot"
    watchers = AbstractQueue.watchers + ["*****@*****.**", "*****@*****.**"]

    # AbstractQueue methods

    def begin_work_queue(self):
        AbstractQueue.begin_work_queue(self)
        self._sheriff = Sheriff(self._tool, self)
        self._irc_bot = IRCBot(self.name, self._tool, self._sheriff, irc_commands)
        self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())

    def work_item_log_path(self, failure_map):
        return None

    def _is_old_failure(self, revision):
        return self._tool.status_server.svn_revision(revision)

    def next_work_item(self):
        self._irc_bot.process_pending_messages()
        return

    def process_work_item(self, failure_map):
        return True

    def handle_unexpected_error(self, failure_map, message):
        _log.error(message)

    # StepSequenceErrorHandler methods

    @classmethod
    def handle_script_error(cls, tool, state, script_error):
        # Ideally we would post some information to IRC about what went wrong
        # here, but we don't have the IRC password in the child process.
        pass
コード例 #5
0
ファイル: perfalizer.py プロジェクト: wendelas/openjfx
class Perfalizer(AbstractQueue, StepSequenceErrorHandler):
    name = "perfalizer"
    watchers = AbstractQueue.watchers + ["*****@*****.**"]

    _commands = {
        "help": Help,
        "hi": Hi,
        "restart": Restart,
        "test": PerfTest,
    }

    # AbstractQueue methods

    def begin_work_queue(self):
        AbstractQueue.begin_work_queue(self)
        self._sheriff = Sheriff(self._tool, self)
        self._irc_bot = IRCBot("perfalizer", self._tool, self._sheriff,
                               self._commands)
        self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())

    def work_item_log_path(self, failure_map):
        return None

    def _is_old_failure(self, revision):
        return self._tool.status_server.svn_revision(revision)

    def next_work_item(self):
        self._irc_bot.process_pending_messages()
        return

    def process_work_item(self, failure_map):
        return True

    def handle_unexpected_error(self, failure_map, message):
        _log.error(message)

    # StepSequenceErrorHandler methods

    @classmethod
    def handle_script_error(cls, tool, state, script_error):
        # Ideally we would post some information to IRC about what went wrong
        # here, but we don't have the IRC password in the child process.
        pass
コード例 #6
0
class Perfalizer(AbstractQueue, StepSequenceErrorHandler):
    name = "perfalizer"
    watchers = AbstractQueue.watchers + ["*****@*****.**"]

    _commands = {
        "help": Help,
        "hi": Hi,
        "restart": Restart,
        "test": PerfTest,
    }

    # AbstractQueue methods

    def begin_work_queue(self):
        AbstractQueue.begin_work_queue(self)
        self._sheriff = Sheriff(self._tool, self)
        self._irc_bot = IRCBot("perfalizer", self._tool, self._sheriff, self._commands)
        self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())

    def work_item_log_path(self, failure_map):
        return None

    def _is_old_failure(self, revision):
        return self._tool.status_server.svn_revision(revision)

    def next_work_item(self):
        self._irc_bot.process_pending_messages()
        return

    def process_work_item(self, failure_map):
        return True

    def handle_unexpected_error(self, failure_map, message):
        log(message)

    # StepSequenceErrorHandler methods

    @classmethod
    def handle_script_error(cls, tool, state, script_error):
        # Ideally we would post some information to IRC about what went wrong
        # here, but we don't have the IRC password in the child process.
        pass
コード例 #7
0
    def test_exception_during_command(self):
        tool = MockTool()
        tool.ensure_irc_connected(None)
        bot = IRCBot("sheriffbot", tool, Sheriff(tool, MockSheriffBot()), irc_command.commands)

        class CommandWithException(object):
            def execute(self, nick, args, tool, sheriff):
                raise Exception("mock_exception")

        bot._parse_command_and_args = lambda request: (CommandWithException, [])
        expected_logs = 'MOCK: irc.post: Exception executing command: mock_exception\n'
        OutputCapture().assert_outputs(self, bot.process_message, args=["mock_nick", "ignored message"], expected_logs=expected_logs)

        class CommandWithException(object):
            def execute(self, nick, args, tool, sheriff):
                raise KeyboardInterrupt()

        bot._parse_command_and_args = lambda request: (CommandWithException, [])
        # KeyboardInterrupt and SystemExit are not subclasses of Exception and thus correctly will not be caught.
        OutputCapture().assert_outputs(self, bot.process_message, args=["mock_nick", "ignored message"], expected_exception=KeyboardInterrupt)
コード例 #8
0
 def test_parse_command_and_args(self):
     tool = MockTool()
     bot = IRCBot("sheriffbot", tool, Sheriff(tool, MockSheriffBot()), irc_command.commands)
     self.assertEqual(bot._parse_command_and_args(""), (Eliza, [""]))
     self.assertEqual(bot._parse_command_and_args("   "), (Eliza, [""]))
     self.assertEqual(bot._parse_command_and_args(" hi "), (irc_command.Hi, []))
     self.assertEqual(bot._parse_command_and_args(" hi there "), (irc_command.Hi, ["there"]))
コード例 #9
0
ファイル: sheriffbot.py プロジェクト: harry0102/iptv
class SheriffBot(AbstractQueue, StepSequenceErrorHandler):
    name = "sheriff-bot"
    watchers = AbstractQueue.watchers + [
        "*****@*****.**",
        "*****@*****.**",
    ]

    # AbstractQueue methods

    def begin_work_queue(self):
        AbstractQueue.begin_work_queue(self)
        self._sheriff = Sheriff(self._tool, self)
        self._irc_bot = IRCBot("sheriffbot", self._tool, self._sheriff,
                               irc_commands)
        self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())

    def work_item_log_path(self, failure_map):
        return None

    def _is_old_failure(self, revision):
        return self._tool.status_server.svn_revision(revision)

    def next_work_item(self):
        self._irc_bot.process_pending_messages()
        return

    def process_work_item(self, failure_map):
        return True

    def handle_unexpected_error(self, failure_map, message):
        log(message)

    # StepSequenceErrorHandler methods

    @classmethod
    def handle_script_error(cls, tool, state, script_error):
        # Ideally we would post some information to IRC about what went wrong
        # here, but we don't have the IRC password in the child process.
        pass
コード例 #10
0
def run(message):
    tool = MockTool()
    tool.ensure_irc_connected(None)
    bot = IRCBot("sheriffbot", tool, Sheriff(tool, MockSheriffBot()), irc_command.commands)
    bot._message_queue.post(["mock_nick", message])
    bot.process_pending_messages()
コード例 #11
0
ファイル: newcommitbot.py プロジェクト: edcwconan/webkit
 def begin_work_queue(self):
     self._last_svn_revision = int(self._tool.scm().head_svn_revision())
     self._irc_bot = IRCBot(self.name, self._tool, Agent(self._tool, self), self._commands)
     self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
コード例 #12
0
 def begin_work_queue(self):
     AbstractQueue.begin_work_queue(self)
     self._sheriff = Sheriff(self._tool, self)
     self._irc_bot = IRCBot("perfalizer", self._tool, self._sheriff, self._commands)
     self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
コード例 #13
0
ファイル: perfalizer.py プロジェクト: wendelas/openjfx
 def begin_work_queue(self):
     AbstractQueue.begin_work_queue(self)
     self._sheriff = Sheriff(self._tool, self)
     self._irc_bot = IRCBot("perfalizer", self._tool, self._sheriff,
                            self._commands)
     self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
コード例 #14
0
 def begin_work_queue(self):
     self._sheriff = Sheriff(self._tool, self)
     self._irc_bot = IRCBot(self.name, self._tool, self._sheriff, irc_commands)
     self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
コード例 #15
0
 def begin_work_queue(self):
     AbstractQueue.begin_work_queue(self)
     self._last_svn_revision = int(self._tool.scm().head_svn_revision())
     self._irc_bot = IRCBot('WKR', self._tool, None, self._commands)
     self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
コード例 #16
0
class NewCommitBot(AbstractQueue, StepSequenceErrorHandler):
    name = "new-commit-bot"
    watchers = AbstractQueue.watchers + ["*****@*****.**"]

    _commands = {
        "ping": PingPong,
        "restart": Restart,
    }

    _maximum_number_of_revisions_to_avoid_spamming_irc = 10

    # AbstractQueue methods

    def begin_work_queue(self):
        AbstractQueue.begin_work_queue(self)
        self._last_svn_revision = int(self._tool.scm().head_svn_revision())
        self._irc_bot = IRCBot('WKR', self._tool, None, self._commands)
        self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())

    def work_item_log_path(self, failure_map):
        return None

    def next_work_item(self):
        self._irc_bot.process_pending_messages()

        _log.info('Last SVN revision: %d' % self._last_svn_revision)

        for revision in range(self._last_svn_revision + 1, self._last_svn_revision + self._maximum_number_of_revisions_to_avoid_spamming_irc):
            try:
                commit_log = self._tool.executive.run_command(['svn', 'log', 'https://svn.webkit.org/repository/webkit/trunk', '--non-interactive', '--revision',
                    self._tool.scm().strip_r_from_svn_revision(revision)])
            except ScriptError:
                break
            if self._is_empty_log(commit_log) or commit_log.find('No such revision') >= 0:
                continue
            _log.info('Found revision %d' % revision)
            self._last_svn_revision = revision
            self._tool.irc().post(self._summarize_commit_log(commit_log).encode('utf-8'))

    def _is_empty_log(self, commit_log):
        return re.match(r'^\-+$', commit_log)

    def process_work_item(self, failure_map):
        return True

    _patch_by_regex = re.compile(r'^Patch\s+by\s+(?P<author>.+?)\s+on(\s+\d{4}-\d{2}-\d{2})?\n?', re.MULTILINE | re.IGNORECASE)
    _rollout_regex = re.compile(r'(rolling out|reverting) (?P<revisions>r?\d+((,\s*|,?\s*and\s+)?r?\d+)*)\.?\s*', re.MULTILINE | re.IGNORECASE)
    _requested_by_regex = re.compile(r'^\"?(?P<reason>.+?)\"? \(Requested\s+by\s+(?P<author>.+?)\s+on\s+#webkit\)\.', re.MULTILINE | re.IGNORECASE)
    _bugzilla_url_regex = re.compile(r'http(s?)://bugs\.webkit\.org/show_bug\.cgi\?id=(?P<id>\d+)', re.MULTILINE)
    _trac_url_regex = re.compile(r'http(s?)://trac.webkit.org/changeset/(?P<revision>\d+)', re.MULTILINE)

    @classmethod
    def _summarize_commit_log(self, commit_log, committer_list=CommitterList()):
        patch_by = self._patch_by_regex.search(commit_log)
        commit_log = self._patch_by_regex.sub('', commit_log, count=1)

        rollout = self._rollout_regex.search(commit_log)
        commit_log = self._rollout_regex.sub('', commit_log, count=1)

        requested_by = self._requested_by_regex.search(commit_log)

        commit_log = self._bugzilla_url_regex.sub(r'https://webkit.org/b/\g<id>', commit_log)
        commit_log = self._trac_url_regex.sub(r'https://trac.webkit.org/r\g<revision>', commit_log)

        for contributor in committer_list.contributors():
            if not contributor.irc_nicknames:
                continue
            name_with_nick = "%s (%s)" % (contributor.full_name, contributor.irc_nicknames[0])
            if contributor.full_name in commit_log:
                commit_log = commit_log.replace(contributor.full_name, name_with_nick)
                for email in contributor.emails:
                    commit_log = commit_log.replace(' <' + email + '>', '')
            else:
                for email in contributor.emails:
                    commit_log = commit_log.replace(email, name_with_nick)

        lines = commit_log.split('\n')[1:-2]  # Ignore lines with ----------.

        firstline = re.match(r'^(?P<revision>r\d+) \| (?P<email>[^\|]+) \| (?P<timestamp>[^|]+) \| [^\n]+', lines[0])
        assert firstline
        author = firstline.group('email')
        if patch_by:
            author = patch_by.group('author')

        linkified_revision = 'https://trac.webkit.org/%s' % firstline.group('revision')
        lines[0] = '%s by %s' % (linkified_revision, author)

        if rollout:
            if requested_by:
                author = requested_by.group('author')
                contributor = committer_list.contributor_by_irc_nickname(author)
                if contributor:
                    author = "%s (%s)" % (contributor.full_name, contributor.irc_nicknames[0])
                return '%s rolled out %s in %s : %s' % (author, rollout.group('revisions'),
                    linkified_revision, requested_by.group('reason'))
            lines[0] = '%s rolled out %s in %s' % (author, rollout.group('revisions'), linkified_revision)

        return ' '.join(filter(lambda line: len(line), lines)[0:4])

    def handle_unexpected_error(self, failure_map, message):
        _log.error(message)

    # StepSequenceErrorHandler methods

    @classmethod
    def handle_script_error(cls, tool, state, script_error):
        # Ideally we would post some information to IRC about what went wrong
        # here, but we don't have the IRC password in the child process.
        pass
コード例 #17
0
ファイル: newcommitbot.py プロジェクト: fmalita/webkit
class NewCommitBot(AbstractQueue, StepSequenceErrorHandler):
    name = "new-commit-bot"
    watchers = AbstractQueue.watchers + ["*****@*****.**"]

    _commands = {
        "ping": PingPong,
        "restart": Restart,
    }

    # AbstractQueue methods

    def begin_work_queue(self):
        AbstractQueue.begin_work_queue(self)
        self._last_svn_revision = int(self._tool.scm().head_svn_revision())
        self._irc_bot = IRCBot('WKR', self._tool, None, self._commands)
        self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())

    def work_item_log_path(self, failure_map):
        return None

    def next_work_item(self):
        self._irc_bot.process_pending_messages()

        _log.info('Last SVN revision: %d' % self._last_svn_revision)

        _log.info('Updating checkout')
        self._update_checkout()

        _log.info('Obtaining new SVN revisions')
        revisions = self._new_svn_revisions()

        _log.info('Obtaining commit logs for %d revisions' % len(revisions))
        for revision in revisions:
            commit_log = self._tool.scm().svn_commit_log(revision)
            self._tool.irc().post(self._summarize_commit_log(commit_log).encode('ascii', 'ignore'))

        return

    def process_work_item(self, failure_map):
        return True

    def _update_checkout(self):
        tool = self._tool
        tool.executive.run_and_throw_if_fail(tool.deprecated_port().update_webkit_command(), quiet=True, cwd=tool.scm().checkout_root)

    def _new_svn_revisions(self):
        scm = self._tool.scm()
        current_head = int(scm.head_svn_revision())
        first_new_revision = self._last_svn_revision + 1
        self._last_svn_revision = current_head
        return range(max(first_new_revision, current_head - 20), current_head + 1)

    _patch_by_regex = re.compile(r'^Patch\s+by\s+(?P<author>.+?)\s+on(\s+\d{4}-\d{2}-\d{2})?\n?', re.MULTILINE | re.IGNORECASE)
    _rollout_regex = re.compile(r'(rolling out|reverting) (?P<revisions>r?\d+((,\s*|,?\s*and\s+)?r?\d+)*)\.?\s*', re.MULTILINE | re.IGNORECASE)
    _requested_by_regex = re.compile(r'^\"?(?P<reason>.+?)\"? \(Requested\s+by\s+(?P<author>.+?)\s+on\s+#webkit\)\.', re.MULTILINE | re.IGNORECASE)
    _bugzilla_url_regex = re.compile(r'http(s?)://bugs\.webkit\.org/show_bug\.cgi\?id=(?P<id>\d+)', re.MULTILINE)
    _trac_url_regex = re.compile(r'http(s?)://trac.webkit.org/changeset/(?P<revision>\d+)', re.MULTILINE)

    @classmethod
    def _summarize_commit_log(self, commit_log, committer_list=CommitterList()):
        patch_by = self._patch_by_regex.search(commit_log)
        commit_log = self._patch_by_regex.sub('', commit_log, count=1)

        rollout = self._rollout_regex.search(commit_log)
        commit_log = self._rollout_regex.sub('', commit_log, count=1)

        requested_by = self._requested_by_regex.search(commit_log)

        commit_log = self._bugzilla_url_regex.sub(r'https://webkit.org/b/\g<id>', commit_log)
        commit_log = self._trac_url_regex.sub(r'https://trac.webkit.org/r\g<revision>', commit_log)

        for contributor in committer_list.contributors():
            if not contributor.irc_nicknames:
                continue
            name_with_nick = "%s (%s)" % (contributor.full_name, contributor.irc_nicknames[0])
            if contributor.full_name in commit_log:
                commit_log = commit_log.replace(contributor.full_name, name_with_nick)
                for email in contributor.emails:
                    commit_log = commit_log.replace(' <' + email + '>', '')
            else:
                for email in contributor.emails:
                    commit_log = commit_log.replace(email, name_with_nick)

        lines = commit_log.split('\n')[1:-2]  # Ignore lines with ----------.

        firstline = re.match(r'^(?P<revision>r\d+) \| (?P<email>[^\|]+) \| (?P<timestamp>[^|]+) \| [^\n]+', lines[0])
        assert firstline
        author = firstline.group('email')
        if patch_by:
            author = patch_by.group('author')

        linkified_revision = 'https://trac.webkit.org/%s' % firstline.group('revision')
        lines[0] = '%s by %s' % (linkified_revision, author)

        if rollout:
            if requested_by:
                author = requested_by.group('author')
                contributor = committer_list.contributor_by_irc_nickname(author)
                if contributor:
                    author = "%s (%s)" % (contributor.full_name, contributor.irc_nicknames[0])
                return '%s rolled out %s in %s : %s' % (author, rollout.group('revisions'),
                    linkified_revision, requested_by.group('reason'))
            lines[0] = '%s rolled out %s in %s' % (author, rollout.group('revisions'), linkified_revision)

        return ' '.join(filter(lambda line: len(line), lines)[0:4])

    def handle_unexpected_error(self, failure_map, message):
        _log.error(message)

    # StepSequenceErrorHandler methods

    @classmethod
    def handle_script_error(cls, tool, state, script_error):
        # Ideally we would post some information to IRC about what went wrong
        # here, but we don't have the IRC password in the child process.
        pass
コード例 #18
0
ファイル: newcommitbot.py プロジェクト: dnomi/WebKitGL2D
class NewCommitBot(AbstractQueue, StepSequenceErrorHandler):
    name = "new-commit-bot"
    watchers = AbstractQueue.watchers + ["*****@*****.**"]

    _commands = {
        "hi": Hi,
        "ping": PingPong,
        "restart": Restart,
    }

    _maximum_number_of_revisions_to_avoid_spamming_irc = 10

    # AbstractQueue methods

    def begin_work_queue(self):
        AbstractQueue.begin_work_queue(self)
        self._last_svn_revision = int(self._tool.scm().head_svn_revision())
        self._irc_bot = IRCBot('WKR', self._tool, None, self._commands)
        self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())

    def work_item_log_path(self, failure_map):
        return None

    def next_work_item(self):
        self._irc_bot.process_pending_messages()

        _log.info('Last SVN revision: %d' % self._last_svn_revision)

        count = 0
        while count < self._maximum_number_of_revisions_to_avoid_spamming_irc:
            new_revision = self._last_svn_revision + 1
            try:
                commit_log = self._tool.executive.run_command([
                    'svn', 'log',
                    'https://svn.webkit.org/repository/webkit/trunk',
                    '--non-interactive', '--revision',
                    self._tool.scm().strip_r_from_svn_revision(new_revision)
                ])
            except ScriptError:
                break

            if commit_log.find('No such revision') >= 0:
                continue

            self._last_svn_revision = new_revision
            if self._is_empty_log(commit_log):
                continue

            count += 1
            _log.info('Found revision %d' % new_revision)
            self._tool.irc().post(
                self._summarize_commit_log(commit_log).encode('utf-8'))

    def _is_empty_log(self, commit_log):
        return re.match(r'^\-+$', commit_log)

    def process_work_item(self, failure_map):
        return True

    _patch_by_regex = re.compile(
        r'^Patch\s+by\s+(?P<author>.+?)\s+on(\s+\d{4}-\d{2}-\d{2})?\n?',
        re.MULTILINE | re.IGNORECASE)
    _rollout_regex = re.compile(
        r'(rolling out|reverting) (?P<revisions>r?\d+((,\s*|,?\s*and\s+)?r?\d+)*)\.?\s*',
        re.MULTILINE | re.IGNORECASE)
    _requested_by_regex = re.compile(
        r'^\"?(?P<reason>.+?)\"? \(Requested\s+by\s+(?P<author>.+?)\s+on\s+#webkit\)\.',
        re.MULTILINE | re.IGNORECASE)
    _bugzilla_url_regex = re.compile(
        r'http(s?)://bugs\.webkit\.org/show_bug\.cgi\?id=(?P<id>\d+)',
        re.MULTILINE)
    _trac_url_regex = re.compile(
        r'http(s?)://trac.webkit.org/changeset/(?P<revision>\d+)',
        re.MULTILINE)

    @classmethod
    def _summarize_commit_log(self, commit_log,
                              committer_list=CommitterList()):
        patch_by = self._patch_by_regex.search(commit_log)
        commit_log = self._patch_by_regex.sub('', commit_log, count=1)

        rollout = self._rollout_regex.search(commit_log)
        commit_log = self._rollout_regex.sub('', commit_log, count=1)

        requested_by = self._requested_by_regex.search(commit_log)

        commit_log = self._bugzilla_url_regex.sub(
            r'https://webkit.org/b/\g<id>', commit_log)
        commit_log = self._trac_url_regex.sub(
            r'https://trac.webkit.org/r\g<revision>', commit_log)

        for contributor in committer_list.contributors():
            if not contributor.irc_nicknames:
                continue
            name_with_nick = "%s (%s)" % (contributor.full_name,
                                          contributor.irc_nicknames[0])
            if contributor.full_name in commit_log:
                commit_log = commit_log.replace(contributor.full_name,
                                                name_with_nick)
                for email in contributor.emails:
                    commit_log = commit_log.replace(' <' + email + '>', '')
            else:
                for email in contributor.emails:
                    commit_log = commit_log.replace(email, name_with_nick)

        lines = commit_log.split('\n')[1:-2]  # Ignore lines with ----------.

        firstline = re.match(
            r'^(?P<revision>r\d+) \| (?P<email>[^\|]+) \| (?P<timestamp>[^|]+) \| [^\n]+',
            lines[0])
        assert firstline
        author = firstline.group('email')
        if patch_by:
            author = patch_by.group('author')

        linkified_revision = 'https://trac.webkit.org/%s' % firstline.group(
            'revision')
        lines[0] = '%s by %s' % (linkified_revision, author)

        if rollout:
            if requested_by:
                author = requested_by.group('author')
                contributor = committer_list.contributor_by_irc_nickname(
                    author)
                if contributor:
                    author = "%s (%s)" % (contributor.full_name,
                                          contributor.irc_nicknames[0])
                return '%s rolled out %s in %s : %s' % (
                    author, rollout.group('revisions'), linkified_revision,
                    requested_by.group('reason'))
            lines[0] = '%s rolled out %s in %s' % (
                author, rollout.group('revisions'), linkified_revision)

        return ' '.join(filter(lambda line: len(line), lines)[0:4])

    def handle_unexpected_error(self, failure_map, message):
        _log.error(message)

    # StepSequenceErrorHandler methods

    @classmethod
    def handle_script_error(cls, tool, state, script_error):
        # Ideally we would post some information to IRC about what went wrong
        # here, but we don't have the IRC password in the child process.
        pass
コード例 #19
0
ファイル: newcommitbot.py プロジェクト: dnomi/WebKitGL2D
 def begin_work_queue(self):
     AbstractQueue.begin_work_queue(self)
     self._last_svn_revision = int(self._tool.scm().head_svn_revision())
     self._irc_bot = IRCBot('WKR', self._tool, None, self._commands)
     self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
コード例 #20
0
ファイル: sheriffbot.py プロジェクト: butday/webkit
 def begin_work_queue(self):
     self._sheriff = Sheriff(self._tool, self)
     self._irc_bot = IRCBot(self.name, self._tool, self._sheriff, irc_commands)
     self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())
コード例 #21
0
ファイル: newcommitbot.py プロジェクト: wuyibo0817/webkit
 def begin_work_queue(self):
     self._last_svn_revision = int(self._tool.scm().head_svn_revision())
     self._irc_bot = IRCBot(self.name, self._tool, Agent(self._tool, self),
                            self._commands)
     self._tool.ensure_irc_connected(self._irc_bot.irc_delegate())