1 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
6 class ParserInterface(object):
7 """The interface for parsers."""
9 def ParseChangelog(self
, component_path
, range_start
, range_end
):
10 """Parses changelog from the URL stored in the parser object.
13 component_path: A string, path of the component. Path is used because
14 path is unique while component name is not.
15 range_start: The start range of the regression.
16 range_end: The end range of the regression.
19 A tuple containing revision_map and file_to_revision_map,
20 revision_map maps a CL number to a dictionary containing revision
21 information such as author, commit message and the revision url.
22 file_to_revision_map maps a name of a file to a tuple containing the CL
23 number and path of the file that CL changes.
25 raise NotImplementedError()
27 def ParseLineDiff(self
, path
, component
, file_action
, githash
):
28 """Parses the line diff of the given hash.
31 path: The path of the file.
32 component: The component the file is from.
33 file_action: Whether file is modified, deleted or added.
34 githash: The git hashcode to check the line diff.
37 url: The URL of the diff page, returns the changelog page for the
38 file if the diff cannot be retrieved.
39 changed_line_numbers: The list of the line numbers that has been
41 changed_line_contents: The content of the changed lines.
43 raise NotImplementedError()
45 def ParseBlameInfo(self
, component
, file_path
, line
, revision
):
46 """Parses blame information of the given file/line in revision.
49 component: The component this line is from.
50 file_path: The path of the file.
51 line: The line that caused the crash.
52 revision: The revision to parse blame information for.
55 The content of the line, the last changed revision of the line, author
56 and the url of the revision.
58 raise NotImplementedError()