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

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

Issue 2344443005: [Findit] Factoring the gitiles (etc) stuff out into its own directory (Closed)
Patch Set: reordering imports 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
« no previous file with comments | « no previous file | appengine/findit/common/cache_decorator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5
6 class Region(object):
7 """A region of some (unspecified) file at a (known) revision."""
8 def __init__(self, start, count, revision,
9 author_name, author_email, author_time):
10 self.start = start
11 self.count = count
12 self.revision = revision
13 self.author_name = author_name
14 self.author_email = author_email
15 self.author_time = author_time
16
17 def ToDict(self):
18 return {
19 'start': self.start,
20 'count': self.count,
21 'revision': self.revision,
22 'author_name': self.author_name,
23 'author_email': self.author_email,
24 'author_time': self.author_time
25 }
26
27
28 class Blame(list):
29 """A list of regions for a (known) revision of a (known) file."""
30 def __init__(self, revision, path):
31 super(Blame, self).__init__()
32 self.revision = revision
33 self.path = path
34
35 def AddRegion(self, region):
36 self.append(region)
37
38 def ToDict(self):
39 regions = []
40 for region in self:
41 regions.append(region.ToDict())
42 return {
43 'revision': self.revision,
44 'path': self.path,
45 'regions': regions
46 }
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/common/cache_decorator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698