| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from collections import namedtuple | 5 from collections import namedtuple |
| 6 | 6 |
| 7 from libs.gitiles.diff import ChangeType | 7 from libs.gitiles.diff import ChangeType |
| 8 | 8 |
| 9 # TODO(wrengr): it'd be better to have a class hierarchy here, so we can | 9 # TODO(wrengr): it'd be better to have a class hierarchy here, so we can |
| 10 # avoid playing around with None, and so the change_type can be stored | 10 # avoid playing around with None, and so the change_type can be stored |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 """Represents the change log of a revision.""" | 58 """Represents the change log of a revision.""" |
| 59 __slots__ = () | 59 __slots__ = () |
| 60 | 60 |
| 61 def __new__(cls, author_name, author_email, author_time, committer_name, | 61 def __new__(cls, author_name, author_email, author_time, committer_name, |
| 62 committer_email, committer_time, revision, commit_position, | 62 committer_email, committer_time, revision, commit_position, |
| 63 message, touched_files, commit_url, code_review_url=None, | 63 message, touched_files, commit_url, code_review_url=None, |
| 64 reverted_revision=None): | 64 reverted_revision=None): |
| 65 return super(cls, ChangeLog).__new__(cls, | 65 return super(cls, ChangeLog).__new__(cls, |
| 66 author_name, author_email, author_time, committer_name, | 66 author_name, author_email, author_time, committer_name, |
| 67 committer_email, committer_time, revision, commit_position, | 67 committer_email, committer_time, revision, commit_position, |
| 68 message, touched_files, commit_url, code_review_url, | 68 message, touched_files, commit_url, code_review_url, |
| 69 reverted_revision) | 69 reverted_revision) |
| 70 | 70 |
| 71 def ToDict(self): | 71 def ToDict(self): |
| 72 """Returns the change log as a JSON object.""" | 72 """Returns the change log as a JSON object.""" |
| 73 json_data = { | 73 json_data = { |
| 74 'author_name': self.author_name, | 74 'author_name': self.author_name, |
| 75 'author_email': self.author_email, | 75 'author_email': self.author_email, |
| 76 'author_time': self.author_time, | 76 'author_time': self.author_time, |
| 77 'committer_name': self.committer_name, | 77 'committer_name': self.committer_name, |
| 78 'committer_email': self.committer_email, | 78 'committer_email': self.committer_email, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 101 % touched_file_info.__class__.__name__) | 101 % touched_file_info.__class__.__name__) |
| 102 touched_files.append(touched_file_info) | 102 touched_files.append(touched_file_info) |
| 103 | 103 |
| 104 return ChangeLog( | 104 return ChangeLog( |
| 105 info['author_name'], info['author_email'], info['author_time'], | 105 info['author_name'], info['author_email'], info['author_time'], |
| 106 info['committer_name'], info['committer_email'], info['committer_time'], | 106 info['committer_name'], info['committer_email'], info['committer_time'], |
| 107 info['revision'], info['commit_position'], info['message'], | 107 info['revision'], info['commit_position'], info['message'], |
| 108 touched_files, info['commit_url'], info['code_review_url'], | 108 touched_files, info['commit_url'], info['code_review_url'], |
| 109 info['reverted_revision'] | 109 info['reverted_revision'] |
| 110 ) | 110 ) |
| OLD | NEW |