Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1982)

Unified Diff: appengine/findit/crash/component.py

Issue 2657913002: [Predator] Add ``Project`` class and ``ClassifySuspect`` method to project and component classifier (Closed)
Patch Set: Fix nits. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/findit/crash/component_classifier.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/crash/component.py
diff --git a/appengine/findit/crash/component.py b/appengine/findit/crash/component.py
index 5e1c7a66ab75cce7d17c01ed7433157183a78918..61ead96bfb6e0d8dc5fbe791a2d5f84d908cb501 100644
--- a/appengine/findit/crash/component.py
+++ b/appengine/findit/crash/component.py
@@ -3,8 +3,11 @@
# found in the LICENSE file.
from collections import namedtuple
+import os
import re
+from libs.gitiles.diff import ChangeType
+
# TODO(http://crbug.com/659346): write the coverage tests.
class Component(namedtuple('Component',
@@ -23,10 +26,9 @@ class Component(namedtuple('Component',
re.compile(path_regex),
re.compile(function_regex) if function_regex else None)
-
def MatchesStackFrame(self, frame):
"""Returns true if this component matches the frame."""
- if not self.path_regex.match(frame.dep_path + frame.file_path):
+ if not self.path_regex.match(os.path.join(frame.dep_path, frame.file_path)):
return False
# We interpret function_regex=None to mean the regex that matches
@@ -35,6 +37,6 @@ class Component(namedtuple('Component',
return True
return self.function_regex.match(frame.function)
- def MatchesFile(self, file_path):
- """Returns true if this component matches file path."""
- return self.path_regex.match(file_path)
+ def MatchesTouchedFile(self, dep_path, file_path):
+ """Returns true if the touched file belongs to this component."""
+ return self.path_regex.match(os.path.join(dep_path, file_path))
« no previous file with comments | « no previous file | appengine/findit/crash/component_classifier.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698