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

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

Issue 2435863003: [Findit] Add local git parsers. (Closed)
Patch Set: Fix nits. Created 4 years, 2 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
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 5
6 class Region(object): 6 class Region(object):
7 """A region of some (unspecified) file at a (known) revision.""" 7 """A region of some (unspecified) file at a (known) revision."""
8 def __init__(self, start, count, revision, 8 def __init__(self, start, count, revision,
9 author_name, author_email, author_time): 9 author_name=None, author_email=None, author_time=None):
10 self.start = start 10 self.start = start
11 self.count = count 11 self.count = count
12 self.revision = revision 12 self.revision = revision
13 self.author_name = author_name 13 self.author_name = author_name
14 self.author_email = author_email 14 self.author_email = author_email
15 self.author_time = author_time 15 self.author_time = author_time
16 16
17 def ToDict(self): 17 def ToDict(self):
18 return { 18 return {
19 'start': self.start, 19 'start': self.start,
20 'count': self.count, 20 'count': self.count,
21 'revision': self.revision, 21 'revision': self.revision,
22 'author_name': self.author_name, 22 'author_name': self.author_name,
23 'author_email': self.author_email, 23 'author_email': self.author_email,
24 'author_time': self.author_time 24 'author_time': self.author_time
25 } 25 }
26 26
27 27
28 class Blame(list): 28 class Blame(list):
29 """A list of regions for a (known) revision of a (known) file.""" 29 """A list of regions for a (known) revision of a (known) file."""
30 def __init__(self, revision, path): 30 def __init__(self, revision, path, regions=None):
31 super(Blame, self).__init__() 31 super(Blame, self).__init__(regions or [])
stgao 2016/10/22 00:39:16 Can we just use the AddRegion below or remove AddR
Sharu Jiang 2016/10/25 00:36:19 This is removed in the newest patch.
32 self.revision = revision 32 self.revision = revision
33 self.path = path 33 self.path = path
34 34
35 def AddRegion(self, region): 35 def AddRegion(self, region):
36 self.append(region) 36 self.append(region)
37 37
38 def ToDict(self): 38 def ToDict(self):
39 regions = [] 39 regions = []
40 for region in self: 40 for region in self:
41 regions.append(region.ToDict()) 41 regions.append(region.ToDict())
42 return { 42 return {
43 'revision': self.revision, 43 'revision': self.revision,
44 'path': self.path, 44 'path': self.path,
45 'regions': regions 45 'regions': regions
46 } 46 }
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/common/change_log.py » ('j') | appengine/findit/common/change_log.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698