Index: media/tools/layout_tests/bug.py |
diff --git a/media/tools/layout_tests/bug.py b/media/tools/layout_tests/bug.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6c1b583bf54f8195871002a8f99bbd5025df6c46 |
--- /dev/null |
+++ b/media/tools/layout_tests/bug.py |
@@ -0,0 +1,45 @@ |
+#!/usr/bin/python |
+# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import re |
+ |
+ |
+class Bug: |
+ """A class dealing with bug. |
+ |
+ TODO(imasaki): add more functionalities here if bug-tracker API is available. |
+ For example, you can get owner of the bug. |
+ """ |
+ CHROME_BUG_URL = 'http://crbug.com/' |
+ WEBKIT_BUG_URL = 'http://bugs.webkit.org/show_bug.cgi?id=' |
Ami GONE FROM CHROMIUM
2011/08/23 14:49:14
FWIW there's a redirect from http://webkit.org/b/<
imasaki1
2011/08/23 21:18:03
Done.
|
+ # Type enum for the bug |
+ WEBKIT = 0 |
+ CHROMIUM = 1 |
+ OTHERS = 2 |
+ |
+ def __init__(self, bug_txt): |
+ self.bug_txt = bug_txt |
+ pattern_for_webkit_bug = r'BUGWK(\d+)' |
+ match = re.search(pattern_for_webkit_bug, bug_txt) |
+ if match: |
+ self.type = self.WEBKIT |
+ self.url = self.WEBKIT_BUG_URL + match.group(1) |
+ return |
+ pattern_for_chrome_bug = r'BUGCR(\d+)' |
+ match = re.search(pattern_for_chrome_bug, bug_txt) |
+ if match: |
+ self.type = self.CHROMIUM |
+ self.url = self.CHROME_BUG_URL + match.group(1) |
+ return |
+ pattern_for_other_bug = r'BUG(\S+)' |
+ match = re.search(pattern_for_other_bug, bug_txt) |
+ if match: |
+ self.type = self.OTHERS |
+ self.url = 'mailto:%s@chromium.org' % match.group(1).lower() |
+ return |
+ self.url = '' |
+ |
+ def ToString(self): |
+ return '<a href="%s">%s</a>' % (self.url, self.bug_txt) |