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

Side by Side Diff: appengine/findit/common/change_log.py

Issue 2435863003: [Findit] Add local git parsers. (Closed)
Patch Set: Fix nits. Created 4 years, 1 month 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
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 class FileChangeInfo(object): 5 class FileChangeInfo(object):
6 """Represents a file change (add/delete/modify/rename/copy/etc).""" 6 """Represents a file change (add/delete/modify/rename/copy/etc)."""
7 def __init__(self, change_type, old_path, new_path): 7 def __init__(self, change_type, old_path, new_path):
8 self.change_type = change_type 8 self.change_type = change_type
9 self.old_path = old_path 9 self.old_path = old_path
10 self.new_path = new_path 10 self.new_path = new_path
11 11
12 def ToDict(self): 12 def ToDict(self):
13 return { 13 return {
14 'change_type': self.change_type, 14 'change_type': self.change_type,
15 'old_path': self.old_path, 15 'old_path': self.old_path,
16 'new_path': self.new_path 16 'new_path': self.new_path
17 } 17 }
18 18
19 @staticmethod 19 @staticmethod
20 def FromDict(info): 20 def FromDict(info):
21 return FileChangeInfo( 21 return FileChangeInfo(
22 info['change_type'], info['old_path'], info['new_path']) 22 info['change_type'], info['old_path'], info['new_path'])
23 23
24 24
25 class ChangeLog(object): 25 class ChangeLog(object):
26 """Represents the change log of a revision.""" 26 """Represents the change log of a revision."""
27 27
28 def __init__(self, author_name, author_email, author_time, committer_name, 28 def __init__(self, author_name, author_email, author_time,
29 committer_email, committer_time, revision, commit_position, 29 committer_name, committer_email, committer_time,
30 message, touched_files, commit_url, code_review_url=None, 30 revision, commit_position, message,
31 reverted_revision=None): 31 touched_files, commit_url, code_review_url,
32 reverted_revision):
stgao 2016/10/25 23:01:33 Is code-review-url and reverted_revision always av
Sharu Jiang 2016/10/26 06:13:38 Oops, shouldn't delete all of them.
32 self.author_name = author_name 33 self.author_name = author_name
33 self.author_email = author_email 34 self.author_email = author_email
34 self.author_time = author_time 35 self.author_time = author_time
35 self.committer_name = committer_name 36 self.committer_name = committer_name
36 self.committer_email = committer_email 37 self.committer_email = committer_email
37 self.committer_time = committer_time 38 self.committer_time = committer_time
38 self.revision = revision 39 self.revision = revision
39 self.commit_position = commit_position 40 self.commit_position = commit_position
40 self.touched_files = touched_files 41 self.touched_files = touched_files
41 self.message = message 42 self.message = message
(...skipping 29 matching lines...) Expand all
71 for touched_file_info in info['touched_files']: 72 for touched_file_info in info['touched_files']:
72 touched_files.append(FileChangeInfo.FromDict(touched_file_info)) 73 touched_files.append(FileChangeInfo.FromDict(touched_file_info))
73 74
74 return ChangeLog( 75 return ChangeLog(
75 info['author_name'], info['author_email'], info['author_time'], 76 info['author_name'], info['author_email'], info['author_time'],
76 info['committer_name'], info['committer_email'], info['committer_time'], 77 info['committer_name'], info['committer_email'], info['committer_time'],
77 info['revision'], info['commit_position'], info['message'], 78 info['revision'], info['commit_position'], info['message'],
78 touched_files, info['commit_url'], info['code_review_url'], 79 touched_files, info['commit_url'], info['code_review_url'],
79 info['reverted_revision'] 80 info['reverted_revision']
80 ) 81 )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698