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

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

Issue 1154593005: [Findit] Add a sub-pipeline to analyze failures caused by DEPS rolls. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Improve readability. Created 5 years, 6 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 import collections
5 6
6 class Dependency(object): 7 class Dependency(object):
7 """Represent a dependency in Chrome, like blink, v8, pdfium, etc.""" 8 """Represents a dependency in Chrome, like blink, v8, pdfium, etc."""
8 def __init__(self, path, repo_url, revision, deps_file): 9 def __init__(self, path, repo_url, revision, deps_file='DEPS'):
9 self.path = path 10 self.path = path
10 self.repo_url = repo_url 11 self.repo_url = repo_url
11 self.revision = revision 12 self.revision = revision
12 self.deps_file = deps_file 13 self.deps_file = deps_file
13 self.parent = None 14 self.parent = None
14 self.children = dict() 15 self.children = dict()
15 16
16 def SetParent(self, parent): 17 def SetParent(self, parent):
17 assert self.parent is None 18 assert self.parent is None
18 self.parent = parent 19 self.parent = parent
19 self.parent.AddChild(self) 20 self.parent.AddChild(self)
20 21
21 def AddChild(self, child): 22 def AddChild(self, child):
22 self.children[child.path] = child 23 self.children[child.path] = child
23 24
24 def ToDict(self): 25 def ToDict(self):
25 children_dict = {} 26 children_dict = {}
26 for path, child in self.children.iteritems(): 27 for path, child in self.children.iteritems():
27 children_dict[path] = child.ToDict() 28 children_dict[path] = child.ToDict()
28 return { 29 return {
29 'path': self.path, 30 'path': self.path,
30 'repo_url': self.repo_url, 31 'repo_url': self.repo_url,
31 'revision': self.revision, 32 'revision': self.revision,
32 'deps_file': self.deps_file, 33 'deps_file': self.deps_file,
33 'children': children_dict, 34 'children': children_dict,
34 } 35 }
36
37
38 class DependencyRoll(collections.namedtuple(
39 'DependencyRoll', ('path', 'repo_url', 'old_revision', 'new_revision'))):
40 """Represents a dependency roll (revision update) in chromium.
41
42 Note: It is possible that the DEPS roll is a revert so that |new_revision| is
43 actually older than |old_revision| in the dependency.
44 """
45
46 def ToDict(self):
47 return self._asdict()
OLDNEW
« no previous file with comments | « appengine/findit/common/chromium_deps.py ('k') | appengine/findit/common/http_client_appengine.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698