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

Side by Side Diff: appengine/findit/libs/gitiles/change_log.py

Issue 2607613002: Converting Region class to a namedtuple (Closed)
Patch Set: Created 3 years, 12 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 unified diff | Download patch
« no previous file with comments | « appengine/findit/libs/gitiles/blame.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 )
OLDNEW
« no previous file with comments | « appengine/findit/libs/gitiles/blame.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698