Title: [147984] trunk/Tools
Revision
147984
Author
[email protected]
Date
2013-04-08 23:44:56 -0700 (Mon, 08 Apr 2013)

Log Message

WKR (new-commit-bot) is too slow
https://bugs.webkit.org/show_bug.cgi?id=110087

Reviewed by Geoffrey Garen.

Running "svn up" or "git svn fetch" is way too slow (takes 2-3 minutes) on the machine I'm running the bot.
Just run "svn log -r <revision>" instead to cut down the delay.

Unfortunately, this work around doesn't work in a git checkout but who cares given I'm the one running the bot.

* Scripts/webkitpy/tool/commands/newcommitbot.py:
(NewCommitBot):
(NewCommitBot.next_work_item):
(NewCommitBot._is_empty_log):
(NewCommitBot._update_checkout):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (147983 => 147984)


--- trunk/Tools/ChangeLog	2013-04-09 06:16:14 UTC (rev 147983)
+++ trunk/Tools/ChangeLog	2013-04-09 06:44:56 UTC (rev 147984)
@@ -1,5 +1,23 @@
 2013-04-08  Ryosuke Niwa  <[email protected]>
 
+        WKR (new-commit-bot) is too slow
+        https://bugs.webkit.org/show_bug.cgi?id=110087
+
+        Reviewed by Geoffrey Garen.
+
+        Running "svn up" or "git svn fetch" is way too slow (takes 2-3 minutes) on the machine I'm running the bot.
+        Just run "svn log -r <revision>" instead to cut down the delay.
+
+        Unfortunately, this work around doesn't work in a git checkout but who cares given I'm the one running the bot.
+
+        * Scripts/webkitpy/tool/commands/newcommitbot.py:
+        (NewCommitBot):
+        (NewCommitBot.next_work_item):
+        (NewCommitBot._is_empty_log):
+        (NewCommitBot._update_checkout):
+
+2013-04-08  Ryosuke Niwa  <[email protected]>
+
         Build fix. Can't remove appendCustomBuildFlags.
 
         * BuildSlaveSupport/build.webkit.org-config/master.cfg:

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py (147983 => 147984)


--- trunk/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py	2013-04-09 06:16:14 UTC (rev 147983)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/newcommitbot.py	2013-04-09 06:44:56 UTC (rev 147984)
@@ -31,6 +31,7 @@
 import re
 
 from webkitpy.common.config.committers import CommitterList
+from webkitpy.common.system.executive import ScriptError
 from webkitpy.tool.bot.irc_command import IRCCommand
 from webkitpy.tool.bot.irc_command import Help
 from webkitpy.tool.bot.irc_command import Hi
@@ -56,6 +57,8 @@
         "restart": Restart,
     }
 
+    _maximum_number_of_revisions_to_avoid_spamming_irc = 10
+
     # AbstractQueue methods
 
     def begin_work_queue(self):
@@ -72,19 +75,23 @@
 
         _log.info('Last SVN revision: %d' % self._last_svn_revision)
 
-        _log.info('Updating checkout')
-        self._update_checkout()
+        if self._tool.scm().executable_name != 'svn':
+            _log.error('This bot only works inside a SVN checkout')
 
-        _log.info('Obtaining new SVN revisions')
-        revisions = self._new_svn_revisions()
+        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.scm().svn_commit_log(revision)
+            except ScriptError:
+                break
+            if self._is_empty_log(commit_log):
+                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'))
 
-        _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'))
+    def _is_empty_log(self, commit_log):
+        return re.match(r'^\-+$', commit_log)
 
-        return
-
     def process_work_item(self, failure_map):
         return True
 
@@ -92,13 +99,6 @@
         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)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to